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
[EMAIL PROTECTED]                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

Attachment: pgpXP8QKK0Be9.pgp
Description: PGP signature

Reply via email to