diff options
author | Daniel Rosenberg <drosen@google.com> | 2019-07-11 13:45:41 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2019-08-27 14:51:05 -0700 |
commit | ce64ea0815bfe953a1c94cc68e1b9e2bef547fc3 (patch) | |
tree | 85dc09a42aecb7a513c120b335ca19e66a6936ce /fsck/main.c | |
parent | db84e73777c2656095d37c768a89923b2bc8e3d6 (diff) | |
download | f2fs-tools-ce64ea0815bfe953a1c94cc68e1b9e2bef547fc3.tar.gz |
f2fs-tools: Add support for Casefolding
This adds support for f2fs casefolding. Similarly to ext4 casefolding,
this is controlled per-folder via the +F attribute. It can be toggled on
empty directories only. It is not currently compatible with encryption,
but that will likely change.
When enabling the casefold feature, use the -C flag. The format is:
-C encoding[:flag1,flag2,etc]
Signed-off-by: Daniel Rosenberg <drosen@google.com>
[Jaegeuk Kim: print "casefold" in sb->feature]
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fsck/main.c')
-rw-r--r-- | fsck/main.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/fsck/main.c b/fsck/main.c index 9aca024..8c62a14 100644 --- a/fsck/main.c +++ b/fsck/main.c @@ -54,6 +54,7 @@ void fsck_usage() MSG(0, "\nUsage: fsck.f2fs [options] device\n"); MSG(0, "[options]:\n"); MSG(0, " -a check/fix potential corruption, reported by f2fs\n"); + MSG(0, " -C encoding[:flag1,flag2] Set options for enabling casefolding\n"); MSG(0, " -d debug level [default:0]\n"); MSG(0, " -f check/fix entire partition\n"); MSG(0, " -g add default options\n"); @@ -186,8 +187,9 @@ void f2fs_parse_options(int argc, char *argv[]) } if (!strcmp("fsck.f2fs", prog)) { - const char *option_string = ":ad:fg:O:p:q:StyV"; - int opt = 0; + const char *option_string = ":aC:d:fg:O:p:q:StyV"; + int opt = 0, val; + char *token; struct option long_opt[] = { {"dry-run", no_argument, 0, 1}, {0, 0, 0, 0} @@ -278,6 +280,22 @@ void f2fs_parse_options(int argc, char *argv[]) break; } break; + case 'C': + token = strtok(optarg, ":"); + val = f2fs_str2encoding(token); + if (val < 0) { + MSG(0, "\tError: Unknown encoding %s\n", token); + fsck_usage(); + } + c.s_encoding = val; + token = strtok(NULL, ""); + val = f2fs_str2encoding_flags(&token, &c.s_encoding_flags); + if (val) { + MSG(0, "\tError: Unknown flag %s\n", token); + fsck_usage(); + } + c.feature |= cpu_to_le32(F2FS_FEATURE_CASEFOLD); + break; case 'V': show_version(prog); exit(0); |