Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Jun 2014 20:08:37 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r266954 - user/nwhitehorn/bsdinstall_zfspartedit/partedit
Message-ID:  <201406012008.s51K8bvD051826@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Sun Jun  1 20:08:37 2014
New Revision: 266954
URL: http://svnweb.freebsd.org/changeset/base/266954

Log:
  Diff reduction to HEAD: cut this down just to ZFS-related bits.

Modified:
  user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c
  user/nwhitehorn/bsdinstall_zfspartedit/partedit/part_wizard.c
  user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c

Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c	Sun Jun  1 18:52:21 2014	(r266953)
+++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c	Sun Jun  1 20:08:37 2014	(r266954)
@@ -399,11 +399,7 @@ gpart_partcode(struct gprovider *pp, con
 	/* Shell out to gpart for partcode for now */
 	sprintf(command, "gpart bootcode -p %s -i %s %s",
 	    partcode_path(scheme, fstype), indexstr, pp->lg_geom->lg_name);
-	sprintf(message, "(echo %s; %s) >>%s 2>>%s",
-	    command, command, getenv("BSDINSTALL_LOG"),
-	    getenv("BSDINSTALL_LOG"));
-
-	if (system(message) != 0) {
+	if (system(command) != 0) {
 		sprintf(message, "Error installing partcode on partition %s",
 		    pp->lg_name);
 		dialog_msgbox("Error", message, 0, 0, TRUE);
@@ -623,7 +619,7 @@ set_default_part_metadata(const char *na
 
 		if (newfs != NULL && newfs[0] != '\0') {
 			md->newfs = malloc(strlen(newfs) + strlen(" /dev/") +
-			    strlen(name) + strlen(".nop") + 1);
+			    strlen(name) + 1);
 			sprintf(md->newfs, "%s /dev/%s", newfs, name);
 		}
 	}
@@ -1031,11 +1027,6 @@ addpartform:
 			snprintf(sizestr, sizeof(sizestr), "%jd",
 			    bootpart_size(scheme) / sector);
 			gctl_ro_param(r, "size", -1, sizestr);
-#if 0
-// XXX I don't understand the following part of the patch
-+                       if (34 == firstfree)
-+                               firstfree += 30+64; /* round to 64K boundary */
-#endif
 			snprintf(startstr, sizeof(startstr), "%jd", firstfree);
 			gctl_ro_param(r, "start", -1, startstr);
 			gctl_rw_param(r, "output", sizeof(output), output);

Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/part_wizard.c
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/partedit/part_wizard.c	Sun Jun  1 18:52:21 2014	(r266953)
+++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/part_wizard.c	Sun Jun  1 20:08:37 2014	(r266954)
@@ -45,21 +45,18 @@
 
 static char *boot_disk(struct gmesh *mesh);
 static char *wizard_partition(struct gmesh *mesh, const char *disk);
-static intmax_t calc_swapsize(void);
 
 int
 part_wizard(const char *fsreq) {
 	int error;
 	struct gmesh mesh;
-	char *disk, *schemeroot, *fstype;
-	char *fstypes[] = {"ufs", "zfs"};
+	char *disk, *schemeroot;
+	const char *fstype;
 
-	if (fsreq != NULL && strcmp(fsreq, "zfs") == 0) {
-		fstype = fstypes[1];
-	} else {
-		/* default to UFS */
-		fstype = fstypes[0];
-	}
+	if (fsreq != NULL)
+		fstype = fsreq;
+	else
+		fstype = "ufs";
 
 startwizard:
 	error = geom_gettree(&mesh);
@@ -293,30 +290,6 @@ query:
 	return (retval);
 }
 
-intmax_t
-calc_swapsize(void)
-{
-	size_t physmem;
-	size_t physmemlen = sizeof(physmem);
-	intmax_t swapsize;
-
-	sysctlbyname("hw.physmem", &physmem, &physmemlen, NULL, 0);
-	fprintf(stderr, "system physmem = %ld\n", physmem);
-	swapsize = physmem;
-	if (physmem > 1024 * 1024 * 1024) {
-		swapsize += 1024LL * 1024 * 1024 + 1024LL * 1024;
-		fprintf(stderr, "swapsize before rounding = %ld\n", swapsize);
-		swapsize = swapsize & 0xFFFFFFFFC0000000LL; // GB
-	} else {
-		swapsize += 2LL * 1024 * 1024;
-		fprintf(stderr, "swapsize before rounding = %ld\n", swapsize);
-		swapsize = swapsize & 0xFFFFFFFFFFF00000LL; // MB
-	}
-	fprintf(stderr, "rounded swapsize = %ld\n", swapsize);
-
-	return swapsize;
-}
-
 int
 wizard_makeparts(struct gmesh *mesh, const char *disk, const char *fstype, int interactive)
 {
@@ -367,7 +340,7 @@ wizard_makeparts(struct gmesh *mesh, con
 		return (!retval); /* Editor -> return 0 */
 	}
 
-	swapsize = calc_swapsize();
+	swapsize = SWAP_SIZE(available);
 	humanize_number(swapsizestr, 7, swapsize, "B", HN_AUTOSCALE,
 	    HN_NOSPACE | HN_DECIMAL);
 	humanize_number(rootsizestr, 7, available - swapsize - 1024*1024,

Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c	Sun Jun  1 18:52:21 2014	(r266953)
+++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c	Sun Jun  1 20:08:37 2014	(r266954)
@@ -95,7 +95,8 @@ main(int argc, const char **argv)
 	if (strcmp(basename(argv[0]), "autopart") == 0) { /* Guided */
 		prompt = "Please review the disk setup. When complete, press "
 		    "the Finish button.";
-		if (argc > 1 && strcmp(basename(argv[1]), "zfs") == 0) {
+		/* Experimental ZFS autopartition support */
+		if (argc > 1 && strcmp(argv[1], "zfs") == 0) {
 			part_wizard("zfs");
 		} else {
 			part_wizard("ufs");
@@ -166,7 +167,7 @@ main(int argc, const char **argv)
 			init_fstab_metadata();
 			break;
 		case 4: /* Auto */
-			part_wizard("zfs");
+			part_wizard("ufs");
 			break;
 		}
 



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