cvs commit: src/sys/sys systm.h src/sys/kern vfs_mount.c

Pawel Jakub Dawidek pjd at FreeBSD.org
Mon Apr 9 17:58:49 UTC 2007


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
> > 
> >   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.

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.

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd at FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/cvs-src/attachments/20070409/10bbb9aa/attachment.pgp


More information about the cvs-src mailing list