svn commit: r266949 - user/nwhitehorn/bsdinstall_zfspartedit/partedit
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sun Jun 1 16:35:23 UTC 2014
Author: nwhitehorn
Date: Sun Jun 1 16:35:22 2014
New Revision: 266949
URL: http://svnweb.freebsd.org/changeset/base/266949
Log:
Rip out all the gnop code. The same thing can be accomplished with the
vfs.zfs.min_auto_ashift sysctl. Either we change the default there, or
live with 512-byte blocks on disks that report such.
Modified:
user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c
user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c
user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h
Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c Sun Jun 1 13:33:22 2014 (r266948)
+++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/gpart_ops.c Sun Jun 1 16:35:22 2014 (r266949)
@@ -80,16 +80,6 @@ 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) {
@@ -472,7 +462,7 @@ gpart_edit(struct gprovider *pp)
const char *errstr, *oldtype, *scheme;
struct partition_metadata *md;
char sizestr[32];
- char gnop[255], newfs[255];
+ char newfs[255];
intmax_t idx;
int hadlabel, choice, junk, nitems;
unsigned i;
@@ -600,10 +590,8 @@ 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) ? gnop : NULL,
(strcmp(oldtype, items[0].text) != 0) ? newfs : NULL);
endedit:
@@ -620,27 +608,13 @@ endedit:
void
set_default_part_metadata(const char *name, const char *scheme,
- const char *type, const char *mountpoint, const char *gnop,
- const char *newfs)
+ const char *type, const char *mountpoint, 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);
@@ -651,8 +625,6 @@ set_default_part_metadata(const char *na
md->newfs = malloc(strlen(newfs) + strlen(" /dev/") +
strlen(name) + strlen(".nop") + 1);
sprintf(md->newfs, "%s /dev/%s", newfs, name);
- if (gnop != NULL)
- strcat(md->newfs, ".nop");
}
}
@@ -831,7 +803,7 @@ gpart_create(struct gprovider *pp, char
struct ggeom *geom;
const char *errstr, *scheme;
char sizestr[32], startstr[32], output[64], *newpartname;
- char gnop[255], newfs[255], options_fstype[64];
+ char newfs[255], options_fstype[64];
intmax_t maxsize, size, sector, firstfree, stripe;
uint64_t bytes;
int nitems, choice, junk;
@@ -929,7 +901,6 @@ 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";
@@ -946,7 +917,6 @@ addpartform:
strncpy(options_fstype, items[0].text,
sizeof(options_fstype));
newfs_command(options_fstype, newfs, 0);
- gnop_command(options_fstype, gnop, 0);
goto addpartform;
}
}
@@ -958,7 +928,6 @@ 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;
@@ -1129,7 +1098,7 @@ addpartform:
gpart_partition(newpartname, "BSD");
else
set_default_part_metadata(newpartname, scheme,
- items[0].text, items[2].text, gnop, newfs);
+ items[0].text, items[2].text, newfs);
for (i = 0; i < (sizeof(items) / sizeof(items[0])); i++)
if (items[i].text_free)
Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c Sun Jun 1 13:33:22 2014 (r266948)
+++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.c Sun Jun 1 16:35:22 2014 (r266949)
@@ -156,8 +156,6 @@ 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);
@@ -252,8 +250,6 @@ 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);
@@ -353,13 +349,6 @@ 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"));
@@ -508,7 +497,6 @@ 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;
Modified: user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h
==============================================================================
--- user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h Sun Jun 1 13:33:22 2014 (r266948)
+++ user/nwhitehorn/bsdinstall_zfspartedit/partedit/partedit.h Sun Jun 1 16:35:22 2014 (r266949)
@@ -44,7 +44,6 @@ 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 */
@@ -73,8 +72,7 @@ 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 *gnop,
- const char *newfs);
+ const char *type, const char *mountpoint, const char *newfs);
/* machine-dependent bootability checks */
const char *default_scheme(void);
More information about the svn-src-user
mailing list