aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2021-05-21 11:09:42 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2021-05-26 06:24:06 -0700
commit38e3115c7f244a94651dc64137d1cb57d2d4870a (patch)
treed5a8a2de136931b66406af5c28dd267d8246a218
parent6afd3e9df00aa3f90b54c8210bdcba7f7a190c30 (diff)
downloadf2fs-tools-38e3115c7f244a94651dc64137d1cb57d2d4870a.tar.gz
f2fs_io: add to show immutable bit
Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--tools/f2fs_io/f2fs_io.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/f2fs_io/f2fs_io.c b/tools/f2fs_io/f2fs_io.c
index fa7d3f5..aa1a7e4 100644
--- a/tools/f2fs_io/f2fs_io.c
+++ b/tools/f2fs_io/f2fs_io.c
@@ -213,7 +213,8 @@ static void do_set_verity(int argc, char **argv, const struct cmd_desc *cmd)
" verity\n" \
" casefold\n" \
" compression\n" \
-" nocompression\n"
+" nocompression\n" \
+" immutable\n"
static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd)
{
@@ -271,6 +272,12 @@ static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd)
printf("nocow(pinned)");
exist = 1;
}
+ if (flag & FS_IMMUTABLE_FL) {
+ if (exist)
+ printf(",");
+ printf("immutable");
+ exist = 1;
+ }
if (!exist)
printf("none");
printf("\n");
@@ -284,7 +291,8 @@ static void do_getflags(int argc, char **argv, const struct cmd_desc *cmd)
"flag can be\n" \
" casefold\n" \
" compression\n" \
-" nocompression\n"
+" nocompression\n" \
+" noimmutable\n"
static void do_setflags(int argc, char **argv, const struct cmd_desc *cmd)
{
@@ -310,6 +318,8 @@ static void do_setflags(int argc, char **argv, const struct cmd_desc *cmd)
flag |= FS_COMPR_FL;
else if (!strcmp(argv[1], "nocompression"))
flag |= FS_NOCOMP_FL;
+ else if (!strcmp(argv[1], "noimmutable"))
+ flag &= ~FS_IMMUTABLE_FL;
ret = ioctl(fd, F2FS_IOC_SETFLAGS, &flag);
printf("set a flag on %s ret=%d, flags=%s\n", argv[2], ret, argv[1]);