Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: linux-erofs@lists.ozlabs.org, hsiangkao@linux.alibaba.com
Subject: [PATCH 6/6] erofs-utils: mkfs.erofs: introduce --xattr-prefix option
Date: Tue,  4 Apr 2023 16:02:23 +0800	[thread overview]
Message-ID: <20230404080224.77577-7-jefflexu@linux.alibaba.com> (raw)
In-Reply-To: <20230404080224.77577-1-jefflexu@linux.alibaba.com>

Introduce --xattr-prefix option to make user capable of specifying
customised extra xattr name prefix.

Signed-off-by: Jingbo Xu <jefflexu@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


  parent reply	other threads:[~2023-04-04  8:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04  8:02 [PATCH 0/6] erofs-utils: introduce extra xattr name prefix Jingbo Xu
2023-04-04  8:02 ` [PATCH 1/6] erofs-utils: declare prefix_len as u8 Jingbo Xu
2023-04-04  8:02 ` [PATCH 2/6] erofs-utils: extract packedfile API Jingbo Xu
2023-04-04  8:02 ` [PATCH 3/6] erofs-utils: introduce on-disk format for extra xattr name prefix Jingbo Xu
2023-04-04  8:19   ` Gao Xiang
2023-04-04  8:02 ` [PATCH 4/6] erofs-utils: introduce init/cleanup routine " Jingbo Xu
2023-04-04  8:02 ` [PATCH 5/6] erofs-utils: build erofs_xattr_entry upon " Jingbo Xu
2023-04-04  8:02 ` Jingbo Xu [this message]
2023-04-04  8:02 ` [PATCH] tmp debug Jingbo Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230404080224.77577-7-jefflexu@linux.alibaba.com \
    --to=jefflexu@linux.alibaba.com \
    --cc=hsiangkao@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox