From owner-svn-src-all@freebsd.org Tue Apr 26 12:00:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E031B1BF17; Tue, 26 Apr 2016 12:00:06 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C9B591039; Tue, 26 Apr 2016 12:00:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3QC04Zb078058; Tue, 26 Apr 2016 12:00:04 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3QC04d6078057; Tue, 26 Apr 2016 12:00:04 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201604261200.u3QC04d6078057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 26 Apr 2016 12:00:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r298629 - stable/9/sbin/geom/class/part X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 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, 26 Apr 2016 12:00:06 -0000 Author: ae Date: Tue Apr 26 12:00:04 2016 New Revision: 298629 URL: https://svnweb.freebsd.org/changeset/base/298629 Log: MFC r297820: Fix the problem, when gpart(8) can't write both bootcode and partcode in one command due to wrong file size limit. Do not use bootcode size to calculate partsize limit. Also add report message about successful partcode writing. Modified: stable/9/sbin/geom/class/part/geom_part.c Directory Properties: stable/9/sbin/geom/class/part/ (props changed) Modified: stable/9/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/9/sbin/geom/class/part/geom_part.c Tue Apr 26 11:55:28 2016 (r298628) +++ stable/9/sbin/geom/class/part/geom_part.c Tue Apr 26 12:00:04 2016 (r298629) @@ -1115,6 +1115,7 @@ gpart_write_partcode(struct ggeom *gp, i err(EXIT_FAILURE, "%s", dsf); free(buf); close(fd); + printf("partcode written to %s\n", pp->lg_name); } else errx(EXIT_FAILURE, "invalid partition index"); } @@ -1161,6 +1162,9 @@ gpart_write_partcode_vtoc8(struct ggeom } if (installed == 0) errx(EXIT_FAILURE, "%s: no partitions", gp->lg_name); + else + printf("partcode written to %s\n", + idx != 0 ? pp->lg_name: gp->lg_name); } static void @@ -1182,10 +1186,8 @@ gpart_bootcode(struct gctl_req *req, uns bootcode); if (error) errc(EXIT_FAILURE, error, "internal error"); - } else { + } else bootcode = NULL; - bootsize = 0; - } s = gctl_get_ascii(req, "class"); if (s == NULL) @@ -1209,21 +1211,23 @@ gpart_bootcode(struct gctl_req *req, uns s = find_geomcfg(gp, "scheme"); if (s == NULL) errx(EXIT_FAILURE, "Scheme not found for geom %s", gp->lg_name); - vtoc8 = 0; if (strcmp(s, "VTOC8") == 0) vtoc8 = 1; + else + vtoc8 = 0; if (gctl_has_param(req, GPART_PARAM_PARTCODE)) { s = gctl_get_ascii(req, GPART_PARAM_PARTCODE); - partsize = vtoc8 != 0 ? VTOC_BOOTSIZE : bootsize * 1024; + if (vtoc8 != 0) + partsize = VTOC_BOOTSIZE; + else + partsize = 1024 * 1024; /* Arbitrary limit. */ partcode = gpart_bootfile_read(s, &partsize); error = gctl_delete_param(req, GPART_PARAM_PARTCODE); if (error) errc(EXIT_FAILURE, error, "internal error"); - } else { + } else partcode = NULL; - partsize = 0; - } if (gctl_has_param(req, GPART_PARAM_INDEX)) { if (partcode == NULL)