svn commit: r212050 - head/cddl/contrib/opensolaris/cmd/zpool

Fabian Keil freebsd-listen at fabiankeil.de
Tue Aug 31 19:05:48 UTC 2010


Pawel Jakub Dawidek <pjd at FreeBSD.org> wrote:

> On Tue, Aug 31, 2010 at 08:44:21PM +0200, Fabian Keil wrote:
> > Pawel Jakub Dawidek <pjd at FreeBSD.org> wrote:
> > >  static int
> > > +is_root_pool(zpool_handle_t *zhp)
> > > +{
> > > +	static struct statfs sfs;
> > > +	static char *poolname = NULL;
> > > +	static boolean_t stated = B_FALSE;
> > 
> > Why are those variables static? They all seem to be (re)initialized
> > before first-use in the function.
> 
> Not really. We enter while () loop only if stated is false and it will
> be false only for the first call. By having those variables static we
> statfs(2) the root file system only once.

Right, I missed that. Thanks.

Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20100831/98235d49/signature.pgp


More information about the svn-src-all mailing list