From owner-cvs-all@FreeBSD.ORG Mon Apr 9 17:58:49 2007 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A88216A402; Mon, 9 Apr 2007 17:58:49 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (arm132.internetdsl.tpnet.pl [83.17.198.132]) by mx1.freebsd.org (Postfix) with ESMTP id C4BA313C484; Mon, 9 Apr 2007 17:58:48 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 70A1845CD9; Mon, 9 Apr 2007 19:58:46 +0200 (CEST) Received: from localhost (154.81.datacomsa.pl [195.34.81.154]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id C28A24569A; Mon, 9 Apr 2007 19:58:39 +0200 (CEST) Date: Mon, 9 Apr 2007 19:58:28 +0200 From: Pawel Jakub Dawidek To: Nate Lawson Message-ID: <20070409175828.GK76673@garage.freebsd.pl> References: <20070408235405.1BD0616A506@hub.freebsd.org> <461A7647.10509@root.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="08ATZu8fEq0x2T3M" Content-Disposition: inline In-Reply-To: <461A7647.10509@root.org> X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 7.0-CURRENT i386 User-Agent: mutt-ng/devel-r804 (FreeBSD) X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.4 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 X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Apr 2007 17:58:49 -0000 --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--