fputs("Filesystem flags: ", f);
if (s->s_flags & EXT2_FLAGS_SIGNED_HASH) {
- fputs("signed directory hash ", f);
+ fputs("signed_directory_hash ", f);
flags_found++;
}
if (s->s_flags & EXT2_FLAGS_UNSIGNED_HASH) {
- fputs("unsigned directory hash ", f);
+ fputs("unsigned_directory_hash ", f);
+ flags_found++;
+ }
+ if (s->s_flags & EXT2_FLAGS_TEST_FILESYS) {
+ fputs("test_filesystem ", f);
flags_found++;
}
if (flags_found)
param->s_reserved_gdt_blocks = rsv_gdb;
}
+ } else if (!strcmp(token, "test_fs")) {
+ param->s_flags |= EXT2_FLAGS_TEST_FILESYS;
} else
r_usage++;
}
"\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"));
+ "\tresize=<resize maximum size in blocks>\n"
+ "\ttest_fs\n"));
free(buf);
exit(1);
}
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
*/
.I mount-count
]
[
+.B \-E
+.I extended-options
+]
+[
.B \-L
.I volume-name
]
Cause a kernel panic.
.RE
.TP
+.BI \-E " extended-options"
+Set extended options for the filesystem. Extended options are comma
+separated, and may take an argument using the equals ('=') sign. The
+following extended options are supported:
+.RS 1.2i
+.TP
+.B test_fs
+Set a flag in the filesystem superblock indicating that it may be
+mounted using experimental kernel code, such as the ext4dev filesystem.
+.TP
+.B ^test_fs
+Clear the test_fs flag, indicating the filesystem should only be mounted
+using production-level filesystem code.
+.RE
+.TP
.B \-f
Force the tune2fs operation to complete even in the face of errors. This
option is useful when removing the
static int open_flag;
static char *features_cmd;
static char *mntopts_cmd;
+static char *extended_cmd;
int journal_size, journal_flags;
char *journal_device;
"\t[-i interval[d|m|w]] [-j] [-J journal_options]\n"
"\t[-l] [-s sparse_flag] [-m reserved_blocks_percent]\n"
"\t[-o [^]mount_options[,...]] [-r reserved_blocks_count]\n"
- "\t[-u user] [-C mount_count] [-L volume_label] "
- "[-M last_mounted_dir]\n"
- "\t[-O [^]feature[,...]] [-T last_check_time] [-U UUID]"
- " device\n"), program_name);
+ "\t[-u user] [-C mount_count] [-L volume_label]\n"
+ "\t[-M last_mounted_dir] [-O [^]feature[,...]]\n"
+ "\t[-E extended-option[,...]] [-T last_check_time] "
+ "[-U UUID] device\n"), program_name);
exit (1);
}
struct passwd * pw;
printf("tune2fs %s (%s)\n", E2FSPROGS_VERSION, E2FSPROGS_DATE);
- while ((c = getopt(argc, argv, "c:e:fg:i:jlm:o:r:s:u:C:J:L:M:O:T:U:")) != EOF)
+ while ((c = getopt(argc, argv, "c:e:fg:i:jlm:o:r:s:u:C:E:J:L:M:O:T:U:")) != EOF)
switch (c)
{
case 'c':
e_flag = 1;
open_flag = EXT2_FLAG_RW;
break;
+ case 'E':
+ extended_cmd = optarg;
+ open_flag = EXT2_FLAG_RW;
+ break;
case 'f': /* Force */
f_flag = 1;
break;
exit(0);
}
+static void parse_extended_opts(ext2_filsys fs, const char *opts)
+{
+ char *buf, *token, *next, *p, *arg;
+ int len;
+ int r_usage = 0;
+
+ len = strlen(opts);
+ buf = malloc(len+1);
+ if (!buf) {
+ fprintf(stderr,
+ _("Couldn't allocate memory to parse options!\n"));
+ exit(1);
+ }
+ strcpy(buf, opts);
+ for (token = buf; token && *token; token = next) {
+ p = strchr(token, ',');
+ next = 0;
+ if (p) {
+ *p = 0;
+ next = p+1;
+ }
+ arg = strchr(token, '=');
+ if (arg) {
+ *arg = 0;
+ arg++;
+ }
+ if (!strcmp(token, "test_fs")) {
+ fs->super->s_flags |= EXT2_FLAGS_TEST_FILESYS;
+ printf("Setting test filesystem flag\n");
+ ext2fs_mark_super_dirty(fs);
+ } else if (!strcmp(token, "^test_fs")) {
+ fs->super->s_flags &= ~EXT2_FLAGS_TEST_FILESYS;
+ printf("Clearing test filesystem flag\n");
+ ext2fs_mark_super_dirty(fs);
+ } else
+ r_usage++;
+ }
+ if (r_usage) {
+ fprintf(stderr, _("\nBad options specified.\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"
+ "\ttest_fs\n"
+ "\t^test_fs\n"));
+ free(buf);
+ exit(1);
+ }
+ free(buf);
+}
+
int main (int argc, char ** argv)
{
update_mntopts(fs, mntopts_cmd);
if (features_cmd)
update_feature_set(fs, features_cmd);
+ if (extended_cmd)
+ parse_extended_opts(fs, extended_cmd);
if (journal_size || journal_device)
add_journal(fs);