Date: Mon, 9 Apr 2007 19:58:28 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Nate Lawson <nate@root.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: <20070409175828.GK76673@garage.freebsd.pl> In-Reply-To: <461A7647.10509@root.org> References: <20070408235405.1BD0616A506@hub.freebsd.org> <461A7647.10509@root.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--08ATZu8fEq0x2T3M
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Mon, Apr 09, 2007 at 10:22:15AM -0700, Nate Lawson wrote:
> Pawel Jakub Dawidek wrote:
> > pjd 2007-04-08 23:54:01 UTC
> >=20
> > FreeBSD src repository
> >=20
> > Modified files:
> > sys/sys systm.h=20
> > sys/kern vfs_mount.c=20
> > Log:
> > Add root_mounted() function that returns true if the root file system=
is
> > already mounted.
> > =20
> > Revision Changes Path
> > 1.254 +14 -0 src/sys/kern/vfs_mount.c
> > 1.255 +1 -0 src/sys/sys/systm.h
> >=20
> >=20
> > 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);
> > }
> > =20
> > + /*
> > + * Return true if root is already mounted.
> > + */
> > +int
> > +root_mounted(void)
> > +{
> > + int mounted;
> > +
> > + mtx_lock(&mountlist_mtx);
> > + mounted =3D root_mount_complete;
> > + mtx_unlock(&mountlist_mtx);
> > + return (mounted);
> > +}
> > +
>=20
> 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.
Yes, I think so to, I more added it for consistency. If you think it can
be read as bad example, feel free to remove it.
--=20
Pawel Jakub Dawidek http://www.wheel.pl
pjd@FreeBSD.org http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!
--08ATZu8fEq0x2T3M
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)
iD8DBQFGGn7EForvXbEpPzQRApkZAKDKMpIgdl1enzsS1Mx5RydztRlCnQCbBDDW
K3hOBhbepDUxX+Wi/RuQNvk=
=g9o9
-----END PGP SIGNATURE-----
--08ATZu8fEq0x2T3M--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070409175828.GK76673>
