From owner-svn-src-head@FreeBSD.ORG Tue Aug 31 23:13:10 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BC0C10656A5; Tue, 31 Aug 2010 23:13:10 +0000 (UTC) (envelope-from pgollucci@p6m7g8.com) Received: from cell.p6m7g8.net (static-71-178-236-107.washdc.fios.verizon.net [71.178.236.107]) by mx1.freebsd.org (Postfix) with ESMTP id CA37D8FC15; Tue, 31 Aug 2010 23:13:09 +0000 (UTC) Received: from philip.hq.rws (wsip-174-79-184-239.dc.dc.cox.net [174.79.184.239]) (authenticated bits=0) by cell.p6m7g8.net (8.14.4/8.14.3) with ESMTP id o7VND6SX051887 (version=TLSv1/SSLv3 cipher=DHE-DSS-CAMELLIA256-SHA bits=256 verify=NO); Tue, 31 Aug 2010 23:13:06 GMT (envelope-from pgollucci@p6m7g8.com) Message-ID: <4C7D8C82.5090703@p6m7g8.com> Date: Tue, 31 Aug 2010 23:13:06 +0000 From: "Philip M. Gollucci" Organization: P6M7G8 Inc. User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.9) Gecko/20100607 Thunderbird/3.0.4 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <201008311041.o7VAfrAF028012@svn.freebsd.org> In-Reply-To: <201008311041.o7VAfrAF028012@svn.freebsd.org> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on cell.p6m7g8.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212050 - head/cddl/contrib/opensolaris/cmd/zpool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 23:13:10 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Nice! On 08/31/10 10:41, 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 > > Log: > When upgrading a pool which contain root file system, give user a hint that > he should update boot code. > > MFC after: 2 weeks > > Modified: > head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c > > Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c > ============================================================================== > --- 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; > > static int > +is_root_pool(zpool_handle_t *zhp) > +{ > + static struct statfs sfs; > + static char *poolname = NULL; > + static boolean_t stated = B_FALSE; > + char *slash; > + > + 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); > +} > + > +static int > upgrade_cb(zpool_handle_t *zhp, void *arg) > { > upgrade_cbdata_t *cbp = arg; > @@ -3371,6 +3398,12 @@ upgrade_cb(zpool_handle_t *zhp, void *ar > if (!ret) { > (void) printf(gettext("Successfully upgraded " > "'%s'\n\n"), zpool_get_name(zhp)); > + if (cbp->cb_poolname[0] == '\0' && > + is_root_pool(zhp)) { > + (void) strlcpy(cbp->cb_poolname, > + zpool_get_name(zhp), > + sizeof(cbp->cb_poolname)); > + } > } > } > } else if (cbp->cb_newer && version > SPA_VERSION) { > @@ -3428,6 +3461,10 @@ upgrade_one(zpool_handle_t *zhp, void *d > "from version %llu to version %llu\n\n"), > zpool_get_name(zhp), (u_longlong_t)cur_version, > (u_longlong_t)cbp->cb_version); > + if (cbp->cb_poolname[0] == '\0' && is_root_pool(zhp)) { > + (void) strlcpy(cbp->cb_poolname, zpool_get_name(zhp), > + sizeof(cbp->cb_poolname)); > + } > } > > return (ret != 0); > @@ -3569,6 +3606,16 @@ zpool_do_upgrade(int argc, char **argv) > upgrade_one, &cb); > } > > + if (cb.cb_poolname[0] != '\0') { > + (void) printf( > + "If you boot from pool '%s', don't forget to update boot code.\n" > + "Assuming you use GPT partitioning and da0 is your boot disk\n" > + "the following command will do it:\n" > + "\n" > + "\tgpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0\n\n", > + cb.cb_poolname); > + } > + > return (ret); > } > > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" - -- - ------------------------------------------------------------------------ 1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70 3F8C 75B8 8FFB DB9B 8C1C Philip M. Gollucci (pgollucci@p6m7g8.com) c: 703.336.9354 VP Apache Infrastructure; Member, Apache Software Foundation Committer, FreeBSD Foundation Consultant, P6M7G8 Inc. Sr. System Admin, Ridecharge Inc. Work like you don't need the money, love like you'll never get hurt, and dance like nobody's watching. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iD8DBQFMfYyCdbiP+9ubjBwRAvY2AJ9c8KljK10d+BDUdxhoX+zs5IOrVwCeNqun xWIPcs2YJT0xAbAryFY8Gvs= =T0tq -----END PGP SIGNATURE-----