From: Ralph Siemsen <ralph.siemsen@linaro.org>
To: linux-ext4@vger.kernel.org
Cc: Ralph Siemsen <ralph.siemsen@linaro.org>
Subject: [PATCH v2 2/4] mke2fs: support multiple '-E' options
Date: Wed, 10 Sep 2025 09:51:46 -0400 [thread overview]
Message-ID: <20250910-mke2fs-small-fixes-v2-2-55c9842494e0@linaro.org> (raw)
In-Reply-To: <20250910-mke2fs-small-fixes-v2-0-55c9842494e0@linaro.org>
The '-E' option for specifying extended attributes can now be used
multiple times. The existing support for multiple attributes encoded
as comma-separated string is maintained for each '-E' option.
Prior to this change, if multiple '-E' options were specified, then
only the last one was used. Earlier ones were silently ignored.
Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
---
misc/mke2fs.8.in | 4 +++-
misc/mke2fs.c | 16 ++++++++++++----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 14bae326..99ecc64b 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -268,7 +268,9 @@ Cause a kernel panic.
.TP
.BI \-E " extended-options"
Set extended options for the file system. Extended options are comma
-separated, and may take an argument using the equals ('=') sign. The
+separated, and may take an argument using the equals ('=') sign. Multiple
+.B \-E
+options may also be used. The
.B \-E
option used to be
.B \-R
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 3a8ff5b1..a54f83ad 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1653,7 +1653,7 @@ static void PRS(int argc, char *argv[])
int default_csum_seed = 0;
errcode_t retval;
char * oldpath = getenv("PATH");
- char * extended_opts = 0;
+ struct str_list extended_opts;
char * fs_type = 0;
char * usage_types = 0;
/*
@@ -1751,6 +1751,13 @@ profile_error:
journal_size = -1;
}
+ retval = init_list(&extended_opts);
+ if (retval) {
+ com_err(program_name, retval, "%s",
+ _("in malloc for extended_opts"));
+ exit(1);
+ }
+
while ((c = getopt (argc, argv,
"b:cd:e:g:i:jl:m:no:qr:s:t:vC:DE:FG:I:J:KL:M:N:O:R:ST:U:Vz:")) != EOF) {
switch (c) {
@@ -1796,7 +1803,7 @@ profile_error:
_("'-R' is deprecated, use '-E' instead"));
/* fallthrough */
case 'E':
- extended_opts = optarg;
+ push_string(&extended_opts, optarg);
break;
case 'e':
if (strcmp(optarg, "continue") == 0)
@@ -2615,8 +2622,9 @@ profile_error:
free(tmp);
}
- if (extended_opts)
- parse_extended_opts(&fs_param, extended_opts);
+ /* Get options from commandline */
+ for (cpp = extended_opts.list; *cpp; cpp++)
+ parse_extended_opts(&fs_param, *cpp);
if (fs_param.s_rev_level == EXT2_GOOD_OLD_REV) {
if (fs_features) {
--
2.45.2.121.gc2b3f2b3cd
next prev parent reply other threads:[~2025-09-10 13:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-10 13:51 [PATCH v2 0/4] mke2fs: small doc and features Ralph Siemsen
2025-09-10 13:51 ` [PATCH v2 1/4] mke2fs: document the hash_seed option Ralph Siemsen
2025-09-20 18:52 ` Andreas Dilger
2025-09-10 13:51 ` Ralph Siemsen [this message]
2025-09-20 18:53 ` [PATCH v2 2/4] mke2fs: support multiple '-E' options Andreas Dilger
2025-09-10 13:51 ` [PATCH v2 3/4] mke2fs: add root_selinux option for root inode label Ralph Siemsen
2025-09-20 22:39 ` Andreas Dilger
2025-09-22 14:31 ` Ralph Siemsen
2025-09-10 13:51 ` [PATCH v2 4/4] mke2fs: fix missing .TP in man page Ralph Siemsen
2025-09-20 22:59 ` Andreas Dilger
2025-09-22 14:46 ` Ralph Siemsen
2025-11-11 20:09 ` [PATCH v2 0/4] mke2fs: small doc and features Theodore Ts'o
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=20250910-mke2fs-small-fixes-v2-2-55c9842494e0@linaro.org \
--to=ralph.siemsen@linaro.org \
--cc=linux-ext4@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).