Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Aug 2010 21:02:50 +0200
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Fabian Keil <freebsd-listen@fabiankeil.de>
Cc:        svn-src-all@freebsd.org
Subject:   Re: svn commit: r212050 - head/cddl/contrib/opensolaris/cmd/zpool
Message-ID:  <20100831190250.GB1932@garage.freebsd.pl>
In-Reply-To: <20100831185752.GA1932@garage.freebsd.pl>
References:  <201008311041.o7VAfrAF028012@svn.freebsd.org> <20100831204421.4ad0a99a@r500.local> <20100831185752.GA1932@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

--K8nIJk4ghYZn606h
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 =3D B_TRUE;
> > > +		if (statfs("/", &sfs) =3D=3D -1) {
> > > +			(void) fprintf(stderr,
> > > +			    "Unable to stat root file system: %s.\n",
> > > +			    strerror(errno));
> > > +			break;
> > > +		}
> > > +		if (strcmp(sfs.f_fstypename, "zfs") !=3D 0)
> > > +			break;
> > > +		poolname =3D sfs.f_mntfromname;
> > > +		if ((slash =3D strchr(poolname, '/')) !=3D NULL)
> > > +			*slash =3D '\0';
> > > +		break;
> > > +	}
> > > +	return (poolname !=3D NULL && strcmp(poolname, zpool_get_name(zhp))=
 =3D=3D 0);
> > > +}
> >=20
> > This while "loop" doesn't seem to loop at all, is this intended?
>=20
> 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.

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--K8nIJk4ghYZn606h
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iEYEARECAAYFAkx9UdkACgkQForvXbEpPzS30ACgliLFgYZYpwru9aOOi5mSiPOO
mFkAnRX0Q8C+pOYddHwT6ZggvIJ79QWv
=tFx5
-----END PGP SIGNATURE-----

--K8nIJk4ghYZn606h--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100831190250.GB1932>