Date: Mon, 09 Apr 2007 10:22:15 -0700 From: Nate Lawson <nate@root.org> To: Pawel Jakub Dawidek <pjd@FreeBSD.org> Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/sys systm.h src/sys/kern vfs_mount.c Message-ID: <461A7647.10509@root.org> In-Reply-To: <20070408235405.1BD0616A506@hub.freebsd.org> References: <20070408235405.1BD0616A506@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?461A7647.10509>
