"\t[-N number-of-inodes] [-m reserved-blocks-percentage] "
"[-o creator-os]\n\t[-g blocks-per-group] [-L volume-label] "
"[-M last-mounted-directory]\n\t[-O feature[,...]] "
- "[-r fs-revision] [-R options] [-qvSV]\n\tdevice [blocks-count]\n"),
+ "[-r fs-revision] [-E extended-option[,...]] [-qvSV]\n\tdevice [blocks-count]\n"),
program_name);
exit(1);
}
}
uid = getuid();
inode.i_uid = uid;
- inode.i_uid_high = uid >> 16;
+ ext2fs_set_i_uid_high(inode, uid >> 16);
if (uid) {
gid = getgid();
inode.i_gid = gid;
- inode.i_gid_high = gid >> 16;
+ ext2fs_set_i_gid_high(inode, gid >> 16);
}
retval = ext2fs_write_new_inode(fs, EXT2_ROOT_INO, &inode);
if (retval) {
static void parse_extended_opts(struct ext2_super_block *param,
const char *opts)
{
- char *buf, *token, *next, *p, *arg;
+ char *buf, *token, *next, *p, *arg, *badopt = "";
int len;
int r_usage = 0;
if (strcmp(token, "stride") == 0) {
if (!arg) {
r_usage++;
+ badopt = token;
continue;
}
- fs_stride = strtoul(arg, &p, 0);
- if (*p || (fs_stride == 0)) {
+ param->s_raid_stride = strtoul(arg, &p, 0);
+ if (*p || (param->s_raid_stride == 0)) {
fprintf(stderr,
_("Invalid stride parameter: %s\n"),
arg);
r_usage++;
continue;
}
+ } else if (strcmp(token, "stripe-width") == 0 ||
+ strcmp(token, "stripe_width") == 0) {
+ if (!arg) {
+ r_usage++;
+ badopt = token;
+ continue;
+ }
+ param->s_raid_stripe_width = strtoul(arg, &p, 0);
+ if (*p || (param->s_raid_stripe_width == 0)) {
+ fprintf(stderr,
+ _("Invalid stripe-width parameter: %s\n"),
+ arg);
+ r_usage++;
+ continue;
+ }
} else if (!strcmp(token, "resize")) {
unsigned long resize, bpg, rsv_groups;
unsigned long group_desc_count, desc_blocks;
if (!arg) {
r_usage++;
+ badopt = token;
continue;
}
param->s_reserved_gdt_blocks = rsv_gdb;
}
- } else
+ } else if (!strcmp(token, "test_fs")) {
+ param->s_flags |= EXT2_FLAGS_TEST_FILESYS;
+ } else {
r_usage++;
+ badopt = token;
+ }
}
if (r_usage) {
- fprintf(stderr, _("\nBad options specified.\n\n"
+ fprintf(stderr, _("\nBad option(s) specified: %s\n\n"
"Extended options are separated by commas, "
"and may take an argument which\n"
"\tis set off by an equals ('=') sign.\n\n"
"Valid extended options are:\n"
- "\tstride=<stride length in blocks>\n"
- "\tresize=<resize maximum size in blocks>\n\n"));
+ "\tstride=<RAID per-disk data chunk in blocks>\n"
+ "\tstripe-width=<RAID stride * data disks in blocks>\n"
+ "\tresize=<resize maximum size in blocks>\n\n"
+ "\ttest_fs\n"),
+ badopt);
free(buf);
exit(1);
}
+ if (param->s_raid_stride &&
+ (param->s_raid_stripe_width % param->s_raid_stride) != 0)
+ fprintf(stderr, _("\nWarning: RAID stripe-width %u not an even "
+ "multiple of stride %u.\n\n"),
+ param->s_raid_stripe_width, param->s_raid_stride);
+
free(buf);
}
static __u32 ok_features[3] = {
+ /* Compat */
EXT3_FEATURE_COMPAT_HAS_JOURNAL |
EXT2_FEATURE_COMPAT_RESIZE_INODE |
EXT2_FEATURE_COMPAT_DIR_INDEX |
- EXT2_FEATURE_COMPAT_LAZY_BG, /* Compat */
- EXT2_FEATURE_INCOMPAT_FILETYPE| /* Incompat */
+ EXT2_FEATURE_COMPAT_LAZY_BG |
+ EXT2_FEATURE_COMPAT_EXT_ATTR,
+ /* Incompat */
+ EXT2_FEATURE_INCOMPAT_FILETYPE|
EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|
EXT2_FEATURE_INCOMPAT_META_BG,
- EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER /* R/O compat */
+ /* R/O compat */
+ EXT2_FEATURE_RO_COMPAT_LARGE_FILE|
+ EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER
};
}
}
+extern const char *mke2fs_default_profile;
+static const char *default_files[] = { "<default>", 0 };
+
static void PRS(int argc, char *argv[])
{
int b, c;
if ((tmp = getenv("MKE2FS_CONFIG")) != NULL)
config_fn[0] = tmp;
profile_set_syntax_err_cb(syntax_err_report);
- profile_init(config_fn, &profile);
+ retval = profile_init(config_fn, &profile);
+ if (retval == ENOENT) {
+ profile_init(default_files, &profile);
+ profile_set_default(profile, mke2fs_default_profile);
+ }
setbuf(stdout, NULL);
setbuf(stderr, NULL);
exit(1);
}
+ if (fs_param.s_flags & EXT2_FLAGS_TEST_FILESYS)
+ fs->super->s_flags |= EXT2_FLAGS_TEST_FILESYS;
+
/*
* Wipe out the old on-disk superblock
*/
test_disk(fs, &bb_list);
handle_bad_blocks(fs, bb_list);
- fs->stride = fs->super->s_raid_stride = fs_stride;
+ fs->stride = fs_stride = fs->super->s_raid_stride;
retval = ext2fs_allocate_tables(fs);
if (retval) {
com_err(program_name, retval,