MSG(0, " -a check/fix potential corruption, reported by f2fs\n");
MSG(0, " -d debug level [default:0]\n");
MSG(0, " -f check/fix entire partition\n");
+ MSG(0, " -g add default options\n");
MSG(0, " -p preen mode [default:0 the same as -a [0|1]]\n");
MSG(0, " -S sparse_mode\n");
MSG(0, " -t show directory tree\n");
MSG(0, "\nWrong program.\n");
}
+static void __add_fsck_options(void)
+{
+ /* -a */
+ c.auto_fix = 1;
+}
+
+static void add_default_options(void)
+{
+ switch (c.defset) {
+ case CONF_ANDROID:
+ __add_fsck_options();
+ }
+}
+
void f2fs_parse_options(int argc, char *argv[])
{
int option = 0;
}
if (!strcmp("fsck.f2fs", prog)) {
- const char *option_string = ":ad:fp:q:StyV";
+ const char *option_string = ":ad:fg:p:q:StyV";
int opt = 0;
struct option long_opt[] = {
{"dry-run", no_argument, 0, 1},
c.auto_fix = 1;
MSG(0, "Info: Fix the reported corruption.\n");
break;
+ case 'g':
+ if (!strcmp(optarg, "android"))
+ c.defset = CONF_ANDROID;
+ break;
case 'p':
/* preen mode has different levels:
* 0: default level, the same as -a
MSG(0, "Info: Debug level = %d\n",
c.dbg_lv);
break;
+ case 'g':
+ if (!strcmp(optarg, "android")) {
+ c.defset = CONF_ANDROID;
+ MSG(0, "Info: Set conf for android\n");
+ break;
+ }
+ err = EWRONG_OPT;
+ break;
case 'i':
if (strncmp(optarg, "0x", 2))
ret = sscanf(optarg, "%d",
}
}
+ add_default_options();
+
if (optind >= argc) {
MSG(0, "\tError: Device not specified\n");
error_out(prog);
MSG(0, " -e [cold file ext list] e.g. \"mp3,gif,mov\"\n");
MSG(0, " -E [hot file ext list] e.g. \"db\"\n");
MSG(0, " -f force overwrite the exist filesystem\n");
+ MSG(0, " -g add default options\n");
MSG(0, " -i extended node bitmap, node ratio is 20%% by default\n");
MSG(0, " -l label\n");
MSG(0, " -m support zoned block device [default:0]\n");
if (c.vol_label)
MSG(0, "Info: Label = %s\n", c.vol_label);
MSG(0, "Info: Trim is %s\n", c.trim ? "enabled": "disabled");
+
+ if (c.defset == CONF_ANDROID)
+ MSG(0, "Info: Set conf for android\n");
}
static inline u32 feature_map(char *feature)
free(buf);
}
+static void add_default_options(void)
+{
+ switch (c.defset) {
+ case CONF_ANDROID:
+ /* -d1 -f -O encrypt -O quota -w 4096 */
+ c.dbg_lv = 1;
+ force_overwrite = 1;
+ c.feature |= cpu_to_le32(F2FS_FEATURE_ENCRYPT);
+ c.feature |= cpu_to_le32(F2FS_FEATURE_QUOTA_INO);
+ c.wanted_sector_size = 4096;
+ break;
+ }
+}
+
static void f2fs_parse_options(int argc, char *argv[])
{
- static const char *option_string = "qa:c:d:e:E:il:mo:O:s:S:z:t:fw:V";
+ static const char *option_string = "qa:c:d:e:E:g:il:mo:O:s:S:z:t:fw:V";
int32_t option=0;
while ((option = getopt(argc,argv,option_string)) != EOF) {
case 'E':
c.extension_list[1] = strdup(optarg);
break;
+ case 'g':
+ if (!strcmp(optarg, "android"))
+ c.defset = CONF_ANDROID;
+ break;
case 'i':
c.large_nat_bitmap = 1;
break;
}
}
+ add_default_options();
+
if (!(c.feature & cpu_to_le32(F2FS_FEATURE_EXTRA_ATTR))) {
if (c.feature & cpu_to_le32(F2FS_FEATURE_PRJQUOTA)) {
MSG(0, "\tInfo: project quota feature should always been"