diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-07-04 20:51:19 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-07-04 20:51:19 -0400 |
commit | f37901a22d618916b53105e39ff91a8bb84d67bc (patch) | |
tree | 8741e9ba9b26caa30c5e2687d131410d71fcbd5c /misc | |
parent | c0b3deb5f8574f0486a00e6adb1d685040f2fe16 (diff) | |
parent | 5b734a0e715ba6590624247b0866e4791f717981 (diff) | |
download | e2fsprogs-f37901a22d618916b53105e39ff91a8bb84d67bc.tar.gz |
Merge branch 'maint' into next
Conflicts:
misc/tune2fs.c
Diffstat (limited to 'misc')
-rw-r--r-- | misc/mke2fs.c | 4 | ||||
-rw-r--r-- | misc/tune2fs.c | 22 |
2 files changed, 18 insertions, 8 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 05cbbce7..e062bda0 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -680,7 +680,7 @@ static void parse_extended_opts(struct ext2_super_block *param, continue; } param->s_raid_stride = strtoul(arg, &p, 0); - if (*p || (param->s_raid_stride == 0)) { + if (*p) { fprintf(stderr, _("Invalid stride parameter: %s\n"), arg); @@ -695,7 +695,7 @@ static void parse_extended_opts(struct ext2_super_block *param, continue; } param->s_raid_stripe_width = strtoul(arg, &p, 0); - if (*p || (param->s_raid_stripe_width == 0)) { + if (*p) { fprintf(stderr, _("Invalid stripe-width parameter: %s\n"), arg); diff --git a/misc/tune2fs.c b/misc/tune2fs.c index d7cb124c..5bf51870 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -81,6 +81,7 @@ static int stride, stripe_width; static int stride_set, stripe_width_set; static char *extended_cmd; static unsigned long new_inode_size; +static char *ext_mount_opts; int journal_size, journal_flags; char *journal_device; @@ -939,7 +940,7 @@ static void parse_extended_opts(ext2_filsys fs, const char *opts) continue; } stride = strtoul(arg, &p, 0); - if (*p || (stride == 0)) { + if (*p) { fprintf(stderr, _("Invalid RAID stride: %s\n"), arg); @@ -954,7 +955,7 @@ static void parse_extended_opts(ext2_filsys fs, const char *opts) continue; } stripe_width = strtoul(arg, &p, 0); - if (*p || (stripe_width == 0)) { + if (*p) { fprintf(stderr, _("Invalid RAID stripe-width: %s\n"), arg); @@ -981,7 +982,7 @@ static void parse_extended_opts(ext2_filsys fs, const char *opts) "to %s (%d)\n"), arg, hash_alg); ext2fs_mark_super_dirty(fs); - } else if (strcmp(token, "mount-options")) { + } else if (!strcmp(token, "mount_opts")) { if (!arg) { r_usage++; continue; @@ -991,8 +992,7 @@ static void parse_extended_opts(ext2_filsys fs, const char *opts) "Extended mount options too long\n"); continue; } - strcpy((char *)fs->super->s_mount_opts, arg); - ext2fs_mark_super_dirty(fs); + ext_mount_opts = strdup(arg); } else r_usage++; } @@ -1002,9 +1002,10 @@ static void parse_extended_opts(ext2_filsys fs, const char *opts) "and may take an argument which\n" "\tis set off by an equals ('=') sign.\n\n" "Valid extended options are:\n" + "\thash_alg=<hash algorithm>\n" + "\tmount_opts=<extended default mount options>\n" "\tstride=<RAID per-disk chunk size in blocks>\n" "\tstripe_width=<RAID stride*data disks in blocks>\n" - "\thash_alg=<hash algorithm>\n" "\ttest_fs\n" "\t^test_fs\n")); free(buf); @@ -1862,6 +1863,15 @@ retry_open: ext2fs_mark_super_dirty(fs); printf(_("Setting stripe width to %d\n"), stripe_width); } + if (ext_mount_opts) { + strncpy(fs->super->s_mount_opts, ext_mount_opts, + sizeof(fs->super->s_mount_opts)); + fs->super->s_mount_opts[sizeof(fs->super->s_mount_opts)-1] = 0; + ext2fs_mark_super_dirty(fs); + printf(_("Setting extended default mount options to '%s'\n"), + ext_mount_opts); + free(ext_mount_opts); + } free(device_name); remove_error_table(&et_ext2_error_table); return (ext2fs_close(fs) ? 1 : 0); |