From owner-svn-src-all@FreeBSD.ORG Tue Aug 31 18:56:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A179C10656B0 for ; Tue, 31 Aug 2010 18:56:22 +0000 (UTC) (envelope-from freebsd-listen@fabiankeil.de) Received: from smtprelay01.ispgateway.de (smtprelay01.ispgateway.de [80.67.18.13]) by mx1.freebsd.org (Postfix) with ESMTP id 356BA8FC1C for ; Tue, 31 Aug 2010 18:56:22 +0000 (UTC) Received: from [78.34.172.129] (helo=r500.local) by smtprelay01.ispgateway.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.68) (envelope-from ) id 1OqVol-0006xB-HU; Tue, 31 Aug 2010 20:44:23 +0200 Date: Tue, 31 Aug 2010 20:44:21 +0200 From: Fabian Keil To: Pawel Jakub Dawidek Message-ID: <20100831204421.4ad0a99a@r500.local> In-Reply-To: <201008311041.o7VAfrAF028012@svn.freebsd.org> References: <201008311041.o7VAfrAF028012@svn.freebsd.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd9.0) X-PGP-KEY-URL: http://www.fabiankeil.de/gpg-keys/freebsd-listen-2008-08-18.asc Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_//lmLcAq/u5XAtOsQj94cpsB"; protocol="application/pgp-signature" X-Df-Sender: 775067 Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r212050 - head/cddl/contrib/opensolaris/cmd/zpool X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 18:56:22 -0000 --Sig_//lmLcAq/u5XAtOsQj94cpsB Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Pawel Jakub Dawidek wrote: > Author: pjd > Date: Tue Aug 31 10:41:53 2010 > New Revision: 212050 > URL: http://svn.freebsd.org/changeset/base/212050 >=20 > Log: > When upgrading a pool which contain root file system, give user a hint = that > he should update boot code. > =20 > MFC after: 2 weeks >=20 > Modified: > head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c >=20 > Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Aug 31 09:38= :43 2010 (r212049) > +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Tue Aug 31 10:41= :53 2010 (r212050) > @@ -3333,12 +3333,39 @@ typedef struct upgrade_cbdata { > int cb_all; > int cb_first; > int cb_newer; > + char cb_poolname[ZPOOL_MAXNAMELEN]; > int cb_argc; > uint64_t cb_version; > char **cb_argv; > } upgrade_cbdata_t; > =20 > static int > +is_root_pool(zpool_handle_t *zhp) > +{ > + static struct statfs sfs; > + static char *poolname =3D NULL; > + static boolean_t stated =3D B_FALSE; Why are those variables static? They all seem to be (re)initialized before first-use in the function. > + char *slash; > + > + 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); > +} This while "loop" doesn't seem to loop at all, is this intended? Fabian --Sig_//lmLcAq/u5XAtOsQj94cpsB Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (FreeBSD) iEYEARECAAYFAkx9TYwACgkQBYqIVf93VJ3t0ACffnTnGOAGMyFhLSG06Lct4Z2/ 8KwAn2JyMGLXF9hfZhST4laE4U217h3a =kffu -----END PGP SIGNATURE----- --Sig_//lmLcAq/u5XAtOsQj94cpsB--