cvs commit: src/sys/sys systm.h src/sys/kern vfs_mount.c
Nate Lawson
nate at root.org
Mon Apr 9 17:54:15 UTC 2007
Pawel Jakub Dawidek wrote:
> pjd 2007-04-08 23:54:01 UTC
>
> FreeBSD src repository
>
> Modified files:
> sys/sys systm.h
> sys/kern vfs_mount.c
> Log:
> Add root_mounted() function that returns true if the root file system is
> already mounted.
>
> Revision Changes Path
> 1.254 +14 -0 src/sys/kern/vfs_mount.c
> 1.255 +1 -0 src/sys/sys/systm.h
>
>
> Index: src/sys/kern/vfs_mount.c
> diff -u src/sys/kern/vfs_mount.c:1.253 src/sys/kern/vfs_mount.c:1.254
> --- src/sys/kern/vfs_mount.c:1.253 Thu Apr 5 21:03:04 2007
> +++ src/sys/kern/vfs_mount.c Sun Apr 8 23:54:01 2007
> @@ -1383,6 +1383,20 @@
> mtx_unlock(&mountlist_mtx);
> }
>
> + /*
> + * Return true if root is already mounted.
> + */
> +int
> +root_mounted(void)
> +{
> + int mounted;
> +
> + mtx_lock(&mountlist_mtx);
> + mounted = root_mount_complete;
> + mtx_unlock(&mountlist_mtx);
> + return (mounted);
> +}
> +
I don't think a mutex is needed here. Reading an integer should be
atomic, and you can use the atomic_get_int() or whatever function instead.
--
Nate
More information about the cvs-src
mailing list