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

Pawel Jakub Dawidek pjd at FreeBSD.org
Tue Aug 31 19:03:05 UTC 2010


On Tue, Aug 31, 2010 at 08:57:52PM +0200, Pawel Jakub Dawidek wrote:
> On Tue, Aug 31, 2010 at 08:44:21PM +0200, Fabian Keil wrote:
> > > +	while (!stated) {
> > > +		stated = B_TRUE;
> > > +		if (statfs("/", &sfs) == -1) {
> > > +			(void) fprintf(stderr,
> > > +			    "Unable to stat root file system: %s.\n",
> > > +			    strerror(errno));
> > > +			break;
> > > +		}
> > > +		if (strcmp(sfs.f_fstypename, "zfs") != 0)
> > > +			break;
> > > +		poolname = sfs.f_mntfromname;
> > > +		if ((slash = strchr(poolname, '/')) != NULL)
> > > +			*slash = '\0';
> > > +		break;
> > > +	}
> > > +	return (poolname != NULL && strcmp(poolname, zpool_get_name(zhp)) == 0);
> > > +}
> > 
> > This while "loop" doesn't seem to loop at all, is this intended?
> 
> Yes. This is a trick to avoid goto. I don't like tricks in code in
> general, but I hope the code is readable.

Actually it was there to avoid goto in the first version of the code.
In the committed version we don't need goto, so the loop can go away.
I eliminated it in r212067.

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
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: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20100831/78448bf9/attachment.pgp


More information about the svn-src-all mailing list