From owner-cvs-all@FreeBSD.ORG Mon Apr 9 17:54:15 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 5F33B16A404 for ; Mon, 9 Apr 2007 17:54:15 +0000 (UTC) (envelope-from nate@root.org) Received: from root.org (root.org [67.118.192.226]) by mx1.freebsd.org (Postfix) with ESMTP id 3068A13C4B9 for ; Mon, 9 Apr 2007 17:54:15 +0000 (UTC) (envelope-from nate@root.org) Received: (qmail 12598 invoked from network); 9 Apr 2007 17:22:20 -0000 Received: from ppp-71-139-28-99.dsl.snfc21.pacbell.net (HELO ?10.0.0.235?) (nate-mail@71.139.28.99) by root.org with ESMTPA; 9 Apr 2007 17:22:20 -0000 Message-ID: <461A7647.10509@root.org> Date: Mon, 09 Apr 2007 10:22:15 -0700 From: Nate Lawson User-Agent: Thunderbird 1.5.0.7 (X11/20061027) MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <20070408235405.1BD0616A506@hub.freebsd.org> In-Reply-To: <20070408235405.1BD0616A506@hub.freebsd.org> X-Enigmail-Version: 0.94.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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:54:15 -0000 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