Date: Sun, 25 May 2014 16:42:33 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r266656 - user/nwhitehorn/bsdinstall_zfspartedit/partedit Message-ID: <201405251642.s4PGgXdG048416@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Sun May 25 16:42:33 2014 New Revision: 266656 URL: http://svnweb.freebsd.org/changeset/base/266656 Log: Commit patch to add ZFS support. This is compile-tested only and needs some further work, but it's a start. Submitted by: Kurt Lidl (thanks!) Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/part_wizard.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_generic.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_pc98.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_sparc64.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c user/nwhitehorn/bsdinstall_zfspartedit/partedit/scripted.c Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c Sun May 25 16:21:12 2014 (r266655) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c Sun May 25 16:42:33 2014 (r266656) @@ -38,6 +38,7 @@ #include "partedit.h" #define GPART_FLAGS "x" /* Do not commit changes by default */ +#define DEFAULT_ZPOOL_NAME "sys" /* default name for zpool */ static void gpart_show_error(const char *title, const char *explanation, const char *errstr) @@ -79,6 +80,16 @@ scheme_supports_labels(const char *schem } static void +gnop_command(const char *fstype, char *command, int use_default) +{ + if (strcmp(fstype, "freebsd-zfs") == 0) { + strcpy(command, "gnop create -S 4096 "); + } else { + command[0] = '\0'; + } +} + +static void newfs_command(const char *fstype, char *command, int use_default) { if (strcmp(fstype, "freebsd-ufs") == 0) { @@ -119,6 +130,47 @@ newfs_command(const char *fstype, char * else if (strcmp(items[i].name, "TRIM") == 0) strcat(command, "-t "); } + } else if (strcmp(fstype, "freebsd-zfs") == 0) { + int i; + DIALOG_LISTITEM items[] = { + {"fletcher4", "checksum algorithm: fletcher4", + "Use fletcher4 for data integrity checking. " + "(default)", 1 }, + {"fletcher2", "checksum algorithm: fletcher2", + "Use fletcher2 for data integrity checking. " + "(not recommended)", 0 }, + {"sha256", "checksum algorithm: sha256", + "Use sha256 for data integrity checking. " + "(not recommended)", 0 }, + {"atime", "Update atimes for files", + "Disable atime update", 0 }, + }; + + if (!use_default) { + int choice; + choice = dlg_checklist("ZFS Options", "", 0, 0, 0, + sizeof(items)/sizeof(items[0]), items, NULL, + FLAG_CHECK, &i); + if (choice == 1) /* Cancel */ + return; + } + + strcpy(command, "zpool create -f -o cachefile=none" + " -m none -R /mnt "); + for (i = 0; i < (int)(sizeof(items)/sizeof(items[0])); i++) { + if (items[i].state == 0) + continue; + if (strcmp(items[i].name, "fletcher4") == 0) + strcat(command, "-O checksum=fletcher4 "); + else if (strcmp(items[i].name, "fletcher2") == 0) + strcat(command, "-O checksum=fletcher2 "); + else if (strcmp(items[i].name, "sha256") == 0) + strcat(command, "-O checksum=sha256 "); + else if (strcmp(items[i].name, "atime") == 0) + strcat(command, "-O atime=off "); + } + strcat(command, DEFAULT_ZPOOL_NAME); + strcat(command, " "); } else if (strcmp(fstype, "fat32") == 0 || strcmp(fstype, "efi") == 0) { int i; DIALOG_LISTITEM items[] = { @@ -329,7 +381,7 @@ gpart_bootcode(struct ggeom *gp) } static void -gpart_partcode(struct gprovider *pp) +gpart_partcode(struct gprovider *pp, const char *fstype) { struct gconfig *gc; const char *scheme; @@ -344,7 +396,7 @@ gpart_partcode(struct gprovider *pp) } /* Make sure this partition scheme needs partcode on this platform */ - if (partcode_path(scheme) == NULL) + if (partcode_path(scheme, fstype) == NULL) return; LIST_FOREACH(gc, &pp->lg_config, lg_config) { @@ -356,8 +408,12 @@ gpart_partcode(struct gprovider *pp) /* Shell out to gpart for partcode for now */ sprintf(command, "gpart bootcode -p %s -i %s %s", - partcode_path(scheme), indexstr, pp->lg_geom->lg_name); - if (system(command) != 0) { + 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) { sprintf(message, "Error installing partcode on partition %s", pp->lg_name); dialog_msgbox("Error", message, 0, 0, TRUE); @@ -416,15 +472,15 @@ gpart_edit(struct gprovider *pp) const char *errstr, *oldtype, *scheme; struct partition_metadata *md; char sizestr[32]; - char newfs[64]; + char gnop[255], newfs[255]; intmax_t idx; int hadlabel, choice, junk, nitems; unsigned i; DIALOG_FORMITEM items[] = { {0, "Type:", 5, 0, 0, FALSE, "", 11, 0, 12, 15, 0, - FALSE, "Filesystem type (e.g. freebsd-ufs, freebsd-swap)", - FALSE}, + FALSE, "Filesystem type (e.g. freebsd-ufs, freebsd-zfs, " + "freebsd-swap)", FALSE}, {0, "Size:", 5, 1, 0, FALSE, "", 11, 1, 12, 0, 0, FALSE, "Partition size. Append K, M, G for kilobytes, " "megabytes or gigabytes.", FALSE}, @@ -544,9 +600,11 @@ editpart: gctl_free(r); newfs_command(items[0].text, newfs, 1); + gnop_command(items[0].text, gnop, 1); set_default_part_metadata(pp->lg_name, scheme, items[0].text, - items[2].text, (strcmp(oldtype, items[0].text) != 0) ? - newfs : NULL); + items[2].text, + (strcmp(oldtype, items[0].text) != 0) ? gnop : NULL, + (strcmp(oldtype, items[0].text) != 0) ? newfs : NULL); endedit: if (strcmp(oldtype, items[0].text) != 0 && cp != NULL) @@ -562,13 +620,27 @@ endedit: void set_default_part_metadata(const char *name, const char *scheme, - const char *type, const char *mountpoint, const char *newfs) + const char *type, const char *mountpoint, const char *gnop, + const char *newfs) { struct partition_metadata *md; /* Set part metadata */ md = get_part_metadata(name, 1); + if (gnop) { + if (md->gnop != NULL) { + free(md->gnop); + md->gnop = NULL; + } + + if (gnop != NULL && gnop[0] != '\0') { + md->gnop = malloc(strlen(gnop) + strlen(" /dev/") + + strlen(name) + 1); + sprintf(md->gnop, "%s /dev/%s", gnop, name); + } + } + if (newfs) { if (md->newfs != NULL) { free(md->newfs); @@ -577,8 +649,10 @@ set_default_part_metadata(const char *na if (newfs != NULL && newfs[0] != '\0') { md->newfs = malloc(strlen(newfs) + strlen(" /dev/") + - strlen(name) + 1); + strlen(name) + strlen(".nop") + 1); sprintf(md->newfs, "%s /dev/%s", newfs, name); + if (gnop != NULL) + strcat(md->newfs, ".nop"); } } @@ -587,8 +661,9 @@ set_default_part_metadata(const char *na if (strcmp(type, bootpart_type(scheme)) == 0) md->bootcode = 1; - /* VTOC8 needs partcode in UFS partitions */ - if (strcmp(scheme, "VTOC8") == 0 && strcmp(type, "freebsd-ufs") == 0) + /* VTOC8 needs partcode at the start of partitions */ + if (strcmp(scheme, "VTOC8") == 0 && (strcmp(type, "freebsd-ufs") == 0 + || strcmp(type, "freebsd-zfs") == 0)) md->bootcode = 1; if (mountpoint == NULL || mountpoint[0] == '\0') { @@ -611,7 +686,7 @@ set_default_part_metadata(const char *na free(md->fstab->fs_mntops); free(md->fstab->fs_type); } - md->fstab->fs_spec = malloc(strlen(name) + 6); + md->fstab->fs_spec = malloc(strlen(name) + strlen("/dev/") + 1); sprintf(md->fstab->fs_spec, "/dev/%s", name); md->fstab->fs_file = strdup(mountpoint); /* Get VFS from text after freebsd-, if possible */ @@ -626,7 +701,15 @@ set_default_part_metadata(const char *na md->fstab->fs_freq = 0; md->fstab->fs_passno = 0; } else { - md->fstab->fs_type = strdup(FSTAB_RW); + if (strcmp(md->fstab->fs_vfstype, "zfs") == 0) { + md->fstab->fs_type = strdup(FSTAB_XX ",noauto"); + free(md->fstab->fs_spec); + md->fstab->fs_spec = malloc(strlen(name) + + strlen("#/dev/") + 1); + sprintf(md->fstab->fs_spec, "#/dev/%s", name); + } else { + md->fstab->fs_type = strdup(FSTAB_RW); + } if (strcmp(mountpoint, "/") == 0) { md->fstab->fs_freq = 1; md->fstab->fs_passno = 1; @@ -748,7 +831,7 @@ gpart_create(struct gprovider *pp, char struct ggeom *geom; const char *errstr, *scheme; char sizestr[32], startstr[32], output[64], *newpartname; - char newfs[64], options_fstype[64]; + char gnop[255], newfs[255], options_fstype[64]; intmax_t maxsize, size, sector, firstfree, stripe; uint64_t bytes; int nitems, choice, junk; @@ -756,8 +839,8 @@ gpart_create(struct gprovider *pp, char DIALOG_FORMITEM items[] = { {0, "Type:", 5, 0, 0, FALSE, "freebsd-ufs", 11, 0, 12, 15, 0, - FALSE, "Filesystem type (e.g. freebsd-ufs, freebsd-swap)", - FALSE}, + FALSE, "Filesystem type (e.g. freebsd-ufs, freebsd-zfs, " + "freebsd-swap)", FALSE}, {0, "Size:", 5, 1, 0, FALSE, "", 11, 1, 12, 15, 0, FALSE, "Partition size. Append K, M, G for kilobytes, " "megabytes or gigabytes.", FALSE}, @@ -846,6 +929,7 @@ gpart_create(struct gprovider *pp, char strncpy(options_fstype, items[0].text, sizeof(options_fstype)); newfs_command(options_fstype, newfs, 1); + gnop_command(options_fstype, gnop, 1); addpartform: if (interactive) { dialog_vars.extra_label = "Options"; @@ -862,6 +946,7 @@ addpartform: strncpy(options_fstype, items[0].text, sizeof(options_fstype)); newfs_command(options_fstype, newfs, 0); + gnop_command(options_fstype, gnop, 0); goto addpartform; } } @@ -873,6 +958,7 @@ addpartform: if (strcmp(options_fstype, items[0].text) != 0) { strncpy(options_fstype, items[0].text, sizeof(options_fstype)); newfs_command(options_fstype, newfs, 1); + gnop_command(options_fstype, gnop, 1); } size = maxsize; @@ -976,6 +1062,11 @@ 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); @@ -1038,7 +1129,7 @@ addpartform: gpart_partition(newpartname, "BSD"); else set_default_part_metadata(newpartname, scheme, - items[0].text, items[2].text, newfs); + items[0].text, items[2].text, gnop, newfs); for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++) if (items[i].text_free) @@ -1222,7 +1313,7 @@ gpart_commit(struct gmesh *mesh) break; if (cp == NULL) /* No sub-partitions */ - gpart_partcode(pp); + gpart_partcode(pp, md->fstab->fs_vfstype); } r = gctl_get_handle(); Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/part_wizard.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/part_wizard.c Sun May 25 16:21:12 2014 (r266655) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/part_wizard.c Sun May 25 16:42:33 2014 (r266656) @@ -31,6 +31,9 @@ #include <libutil.h> #include <inttypes.h> +#include <sys/sysctl.h> +#include <string.h> + #include <libgeom.h> #include <dialog.h> #include <dlg_keys.h> @@ -42,12 +45,21 @@ 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(void) { +part_wizard(const char *fsreq) { int error; struct gmesh mesh; - char *disk, *schemeroot; + char *disk, *schemeroot, *fstype; + char *fstypes[] = {"ufs", "zfs"}; + + if (fsreq != NULL && strcmp(fsreq, "zfs") == 0) { + fstype = fstypes[1]; + } else { + /* default to UFS */ + fstype = fstypes[0]; + } startwizard: error = geom_gettree(&mesh); @@ -70,11 +82,11 @@ startwizard: dlg_put_backtitle(); error = geom_gettree(&mesh); - error = wizard_makeparts(&mesh, schemeroot, 1); + error = wizard_makeparts(&mesh, schemeroot, fstype, 1); if (error) goto startwizard; free(schemeroot); - + geom_deletetree(&mesh); return (0); @@ -106,9 +118,9 @@ boot_disk(struct gmesh *mesh) LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { desc = type = NULL; LIST_FOREACH(gc, &pp->lg_config, lg_config) { - if (strcmp(gc->lg_name, "type") == 0) + if (strcmp(gc->lg_name, "type") == 0) type = gc->lg_val; - if (strcmp(gc->lg_name, "descr") == 0) + if (strcmp(gc->lg_name, "descr") == 0) desc = gc->lg_val; } @@ -200,7 +212,7 @@ wizard_partition(struct gmesh *mesh, con break; if (classp != NULL) { - LIST_FOREACH(gpart, &classp->lg_geom, lg_geom) + LIST_FOREACH(gpart, &classp->lg_geom, lg_geom) if (strcmp(gpart->lg_name, disk) == 0) break; } @@ -281,22 +293,54 @@ 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, int interactive) +wizard_makeparts(struct gmesh *mesh, const char *disk, const char *fstype, int interactive) { struct gmesh submesh; struct gclass *classp; struct ggeom *gp; struct gprovider *pp; intmax_t swapsize, available; - char swapsizestr[10], rootsizestr[10]; + char swapsizestr[10], rootsizestr[10], *fsname; + char *fsnames[] = {"freebsd-ufs", "freebsd-zfs"}; int retval; + if (strcmp(fstype, "zfs") == 0) { + fsname = fsnames[1]; + } else { + /* default to UFS */ + fsname = fsnames[0]; + } + LIST_FOREACH(classp, &mesh->lg_class, lg_class) if (strcmp(classp->lg_name, "PART") == 0) break; - LIST_FOREACH(gp, &classp->lg_geom, lg_geom) + LIST_FOREACH(gp, &classp->lg_geom, lg_geom) if (strcmp(gp->lg_name, disk) == 0) break; @@ -323,7 +367,7 @@ wizard_makeparts(struct gmesh *mesh, con return (!retval); /* Editor -> return 0 */ } - swapsize = SWAP_SIZE(available); + swapsize = calc_swapsize(); humanize_number(swapsizestr, 7, swapsize, "B", HN_AUTOSCALE, HN_NOSPACE | HN_DECIMAL); humanize_number(rootsizestr, 7, available - swapsize - 1024*1024, @@ -331,7 +375,7 @@ wizard_makeparts(struct gmesh *mesh, con geom_gettree(&submesh); pp = provider_for_name(&submesh, disk); - gpart_create(pp, "freebsd-ufs", rootsizestr, "/", NULL, 0); + gpart_create(pp, fsname, rootsizestr, "/", NULL, 0); geom_deletetree(&submesh); geom_gettree(&submesh); Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c Sun May 25 16:21:12 2014 (r266655) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c Sun May 25 16:42:33 2014 (r266656) @@ -95,7 +95,11 @@ 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."; - part_wizard(); + if (argc > 1 && strcmp(basename(argv[1]), "zfs") == 0) { + part_wizard("zfs"); + } else { + part_wizard("ufs"); + } } else if (strcmp(basename(argv[0]), "scriptedpart") == 0) { error = scripted_editor(argc, argv); prompt = NULL; @@ -152,6 +156,8 @@ main(int argc, const char **argv) free(md->fstab->fs_type); free(md->fstab); } + if (md->gnop != NULL) + free(md->gnop); if (md->newfs != NULL) free(md->newfs); free(md->name); @@ -162,7 +168,7 @@ main(int argc, const char **argv) init_fstab_metadata(); break; case 4: /* Auto */ - part_wizard(); + part_wizard("zfs"); break; } @@ -246,6 +252,8 @@ delete_part_metadata(const char *name) free(md->fstab->fs_type); free(md->fstab); } + if (md->gnop != NULL) + free(md->gnop); if (md->newfs != NULL) free(md->newfs); free(md->name); @@ -345,6 +353,13 @@ apply_changes(struct gmesh *mesh) dialog_mixedgauge("Initializing", "Initializing file systems. Please wait.", 0, 0, i*100/nitems, nitems, __DECONST(char **, items)); + if (md->gnop != NULL) { + sprintf(message, "(echo %s; %s) >>%s 2>>%s", + md->gnop, md->gnop, + getenv("BSDINSTALL_LOG"), + getenv("BSDINSTALL_LOG")); + error = system(message); + } sprintf(message, "(echo %s; %s) >>%s 2>>%s", md->newfs, md->newfs, getenv("BSDINSTALL_LOG"), getenv("BSDINSTALL_LOG")); @@ -372,10 +387,10 @@ apply_changes(struct gmesh *mesh) dialog_msgbox("Error", message, 0, 0, TRUE); return (-1); } - fprintf(fstab, "# Device\tMountpoint\tFStype\tOptions\tDump\tPass#\n"); + fprintf(fstab, "# Device\t\tMountpoint\tFStype\tOptions\t\tDump\tPass#\n"); TAILQ_FOREACH(md, &part_metadata, metadata) { if (md->fstab != NULL) - fprintf(fstab, "%s\t%s\t\t%s\t%s\t%d\t%d\n", + fprintf(fstab, "%s\t\t%s\t\t%s\t%s\t\t%d\t%d\n", md->fstab->fs_spec, md->fstab->fs_file, md->fstab->fs_vfstype, md->fstab->fs_mntops, md->fstab->fs_freq, md->fstab->fs_passno); @@ -493,7 +508,9 @@ init_fstab_metadata(void) md->fstab->fs_freq = fstab->fs_freq; md->fstab->fs_passno = fstab->fs_passno; + md->gnop = NULL; md->newfs = NULL; + md->poolname = NULL; TAILQ_INSERT_TAIL(&part_metadata, md, metadata); } Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h Sun May 25 16:21:12 2014 (r266655) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h Sun May 25 16:42:33 2014 (r266656) @@ -44,7 +44,9 @@ struct partition_metadata { char *name; /* name of this partition, as in GEOM */ struct fstab *fstab; /* fstab data for this partition */ + char *gnop; /* shell command to initialize gnop */ char *newfs; /* shell command to initialize partition */ + char *poolname; /* ZFS pool name */ int bootcode; @@ -54,9 +56,10 @@ struct partition_metadata { struct partition_metadata *get_part_metadata(const char *name, int create); void delete_part_metadata(const char *name); -int part_wizard(void); +int part_wizard(const char *fstype); int scripted_editor(int argc, const char **argv); -int wizard_makeparts(struct gmesh *mesh, const char *disk, int interactive); +int wizard_makeparts(struct gmesh *mesh, const char *disk, const char *fstype, + int interactive); /* gpart operations */ void gpart_delete(struct gprovider *pp); @@ -70,7 +73,8 @@ void gpart_revert_all(struct gmesh *mesh void gpart_commit(struct gmesh *mesh); int gpart_partition(const char *lg_name, const char *scheme); void set_default_part_metadata(const char *name, const char *scheme, - const char *type, const char *mountpoint, const char *newfs); + const char *type, const char *mountpoint, const char *gnop, + const char *newfs); /* machine-dependent bootability checks */ const char *default_scheme(void); @@ -78,6 +82,6 @@ int is_scheme_bootable(const char *schem size_t bootpart_size(const char *scheme); const char *bootpart_type(const char *scheme); const char *bootcode_path(const char *scheme); -const char *partcode_path(const char *scheme); +const char *partcode_path(const char *scheme, const char *fs_type); #endif Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_generic.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_generic.c Sun May 25 16:21:12 2014 (r266655) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_generic.c Sun May 25 16:42:33 2014 (r266656) @@ -68,7 +68,7 @@ bootcode_path(const char *part_type) { } const char * -partcode_path(const char *part_type) { +partcode_path(const char *part_type, const char *fs_type) { return (NULL); } Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_pc98.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_pc98.c Sun May 25 16:21:12 2014 (r266655) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_pc98.c Sun May 25 16:42:33 2014 (r266656) @@ -67,7 +67,7 @@ bootcode_path(const char *part_type) { } const char * -partcode_path(const char *part_type) { +partcode_path(const char *part_type, const char *fs_type) { /* No partcode */ return (NULL); } Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c Sun May 25 16:21:12 2014 (r266655) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_powerpc.c Sun May 25 16:42:33 2014 (r266656) @@ -84,7 +84,7 @@ bootcode_path(const char *part_type) { } const char * -partcode_path(const char *part_type) { +partcode_path(const char *part_type, const char *fs_type) { if (strcmp(part_type, "APM") == 0) return ("/boot/boot1.hfs"); if (strcmp(part_type, "MBR") == 0) Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_sparc64.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_sparc64.c Sun May 25 16:21:12 2014 (r266655) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_sparc64.c Sun May 25 16:42:33 2014 (r266656) @@ -58,11 +58,16 @@ const char * bootcode_path(const char *part_type) { return (NULL); } - + const char * -partcode_path(const char *part_type) { - if (strcmp(part_type, "VTOC8") == 0) - return ("/boot/boot1"); +partcode_path(const char *part_type, const char *fs_type) { + if (strcmp(part_type, "VTOC8") == 0) { + if (strcmp(fs_type, "ufs") == 0) { + return ("/boot/boot1"); + } else if (strcmp(fs_type, "zfs") == 0) { + return ("/boot/zfsboot"); + } + } return (NULL); } Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c Sun May 25 16:21:12 2014 (r266655) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit_x86.c Sun May 25 16:42:33 2014 (r266656) @@ -107,7 +107,7 @@ bootcode_path(const char *part_type) { } const char * -partcode_path(const char *part_type) { +partcode_path(const char *part_type, const char *fs_type) { size_t platlen = sizeof(platform); if (strlen(platform) == 0) sysctlbyname(platform_sysctl, platform, &platlen, NULL, -1); @@ -115,6 +115,8 @@ partcode_path(const char *part_type) { if (strcmp(part_type, "GPT") == 0) { if (strcmp(platform, "UEFI") == 0) return ("/boot/boot1.efifat"); + else if (strcmp(fs_type, "zfs") == 0) + return ("/boot/gptzfsboot"); else return ("/boot/gptboot"); } Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/scripted.c ============================================================================== --- user/nwhitehorn/bsdinstall_zfspartedit/partedit/scripted.c Sun May 25 16:21:12 2014 (r266655) +++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/scripted.c Sun May 25 16:42:33 2014 (r266656) @@ -109,7 +109,7 @@ part_config(char *disk, const char *sche /* Create partitions */ if (config == NULL) { - wizard_makeparts(&mesh, disk, 0); + wizard_makeparts(&mesh, disk, "zfs", 0); goto finished; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405251642.s4PGgXdG048416>