mkfs.f2fs: add casefolding and project quota config

This can be used for Android build support.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Jaegeuk Kim 2020-07-17 20:10:21 -07:00
parent ec0f3c910e
commit 3aef9bc820
3 changed files with 26 additions and 0 deletions

View File

@ -1527,6 +1527,7 @@ extern const struct f2fs_nls_table *f2fs_load_nls_table(int encoding);
#define F2FS_ENC_UTF8_12_0 1
extern int f2fs_str2encoding(const char *string);
extern char *f2fs_encoding2str(const int encoding);
extern int f2fs_get_encoding_flags(int encoding);
extern int f2fs_str2encoding_flags(char **param, __u16 *flags);

View File

@ -1306,6 +1306,17 @@ int f2fs_str2encoding(const char *string)
return -EINVAL;
}
char *f2fs_encoding2str(const int encoding)
{
int i;
for (i = 0 ; i < ARRAY_SIZE(f2fs_encoding_map); i++)
if (f2fs_encoding_map[i].encoding_magic == encoding)
return f2fs_encoding_map[i].name;
return NULL;
}
int f2fs_get_encoding_flags(int encoding)
{
int i;

View File

@ -89,6 +89,12 @@ static void f2fs_show_info()
if (c.defset == CONF_ANDROID)
MSG(0, "Info: Set conf for android\n");
if (c.feature & le32_to_cpu(F2FS_FEATURE_CASEFOLD))
MSG(0, "Info: Enable %s with casefolding\n",
f2fs_encoding2str(c.s_encoding));
if (c.feature & le32_to_cpu(F2FS_FEATURE_PRJQUOTA))
MSG(0, "Info: Enable Project quota\n");
}
static void add_default_options(void)
@ -105,6 +111,14 @@ static void add_default_options(void)
c.root_uid = c.root_gid = 0;
break;
}
#ifdef CONF_CASEFOLD
c.s_encoding = F2FS_ENC_UTF8_12_1;
c.feature |= cpu_to_le32(F2FS_FEATURE_CASEFOLD);
#endif
#ifdef CONF_PROJID
c.feature |= cpu_to_le32(F2FS_FEATURE_PRJQUOTA);
c.feature |= cpu_to_le32(F2FS_FEATURE_EXTRA_ATTR);
#endif
}
static void f2fs_parse_options(int argc, char *argv[])