[PATCH 6/6] erofs-utils: mkfs.erofs: introduce --xattr-prefix option
Jingbo Xu
jefflexu at linux.alibaba.com
Tue Apr 4 18:02:23 AEST 2023
Introduce --xattr-prefix option to make user capable of specifying
customised extra xattr name prefix.
Signed-off-by: Jingbo Xu <jefflexu at linux.alibaba.com>
---
include/erofs/config.h | 1 +
mkfs/main.c | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/include/erofs/config.h b/include/erofs/config.h
index e4d4130..bf3c5d2 100644
--- a/include/erofs/config.h
+++ b/include/erofs/config.h
@@ -53,6 +53,7 @@ struct erofs_configure {
bool c_ignore_mtime;
bool c_showprogress;
bool c_packedfile;
+ bool c_ea_prefix;
#ifdef HAVE_LIBSELINUX
struct selabel_handle *sehnd;
diff --git a/mkfs/main.c b/mkfs/main.c
index 56b100c..09b03fc 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -56,6 +56,7 @@ static struct option long_options[] = {
{"preserve-mtime", no_argument, NULL, 15},
{"uid-offset", required_argument, NULL, 16},
{"gid-offset", required_argument, NULL, 17},
+ {"xattr-prefix", required_argument, NULL, 19},
{"mount-point", required_argument, NULL, 512},
#ifdef WITH_ANDROID
{"product-out", required_argument, NULL, 513},
@@ -116,6 +117,7 @@ static void usage(void)
" --random-pclusterblks randomize pclusterblks for big pcluster (debugging only)\n"
" --random-algorithms randomize per-file algorithms (debugging only)\n"
#endif
+ " --xattr-prefix=X X=extra xattr name prefix\n"
" --mount-point=X X=prefix of target fs path (default: /)\n"
#ifdef WITH_ANDROID
"\nwith following android-specific options:\n"
@@ -475,6 +477,16 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
return -EINVAL;
}
break;
+ case 19:
+ errno = 0;
+ opt = erofs_insert_ea_type(optarg);
+ if (opt) {
+ erofs_err("failed to parse extra xattr prefix: %s",
+ erofs_strerror(opt));
+ return opt;
+ }
+ cfg.c_ea_prefix = true;
+ break;
case 1:
usage();
exit(0);
@@ -555,7 +567,7 @@ static int mkfs_parse_options_cfg(int argc, char *argv[])
}
cfg.c_pclusterblks_packed = pclustersize_packed >> sbi.blkszbits;
}
- if (cfg.c_fragments)
+ if (cfg.c_fragments || cfg.c_ea_prefix)
cfg.c_packedfile = true;
return 0;
}
@@ -935,6 +947,8 @@ exit:
erofs_fragments_exit();
if (cfg.c_packedfile)
erofs_packedfile_exit();
+ if (cfg.c_ea_prefix)
+ erofs_cleanup_ea_type();
erofs_exit_configure();
if (err) {
--
2.19.1.6.gb485710b
More information about the Linux-erofs
mailing list