public inbox for linux-erofs@ozlabs.org
 help / color / mirror / Atom feed
* [PATCH 0/2] erofs-utils: minor cleanups and enhancements
@ 2026-03-06  8:57 Nithurshen
  2026-03-06  8:57 ` [PATCH 1/2] erofs-utils: dump: remove redundant conditional branch in filesize distribution Nithurshen
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Nithurshen @ 2026-03-06  8:57 UTC (permalink / raw)
  To: linux-erofs; +Cc: xiang, hsiangkao, Nithurshen

Hi,

This patch series introduces two minor improvements to the erofs-utils tools:

1. dump.erofs: Removes a redundant conditional branch in the filesize distribution output logic to clean up the code.
2. fsck.erofs: Adds a warning message when encountering an unsupported file type during extraction, rather than silently skipping it.

Thanks,
Nithurshen

Nithurshen (2):
  erofs-utils: dump: remove redundant conditional branch in filesize
    distribution
  erofs-utils: fsck: add warning for unsupported file types during
    extraction

 dump/main.c | 3 ---
 fsck/main.c | 3 ++-
 2 files changed, 2 insertions(+), 4 deletions(-)

-- 
2.51.0



^ permalink raw reply	[flat|nested] 14+ messages in thread
* [PATCH] erofs-utils: mkfs: add --exclude-from option
@ 2026-03-08  3:47 Nithurshen
  2026-03-09 12:47 ` [PATCH v2] erofs-utils: mkfs: add --exclude-path-from and --exclude-regex-from Nithurshen
  2026-03-09 12:50 ` Nithurshen
  0 siblings, 2 replies; 14+ messages in thread
From: Nithurshen @ 2026-03-08  3:47 UTC (permalink / raw)
  To: linux-erofs; +Cc: xiang, hsiangkao, Nithurshen

Currently, users who want to exclude multiple specific files or paths must pass them one-by-one using --exclude-path or --exclude-regex via the command line. This becomes cumbersome for complex build systems with dozens of exclusions.

This patch introduces an \`--exclude-from=FILE\` flag to mkfs.erofs.

Similar to standard archiving tools, it allows users to supply a text file containing a list of paths or regexes to exclude, which are read line-by-line and applied to the EROFS build process.

Signed-off-by: Nithurshen <nithurshen.dev@gmail.com>
---
 mkfs/main.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/mkfs/main.c b/mkfs/main.c
index 07ef086..a6cd251 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -39,6 +39,7 @@ static struct option long_options[] = {
 	{"help", no_argument, 0, 'h'},
 	{"exclude-path", required_argument, NULL, 2},
 	{"exclude-regex", required_argument, NULL, 3},
+	{"exclude-from", required_argument, NULL, 540},
 #ifdef HAVE_LIBSELINUX
 	{"file-contexts", required_argument, NULL, 4},
 #endif
@@ -199,6 +200,7 @@ static void usage(int argc, char **argv)
 		" --dsunit=#             align all data block addresses to multiples of #\n"
 		" --exclude-path=X       avoid including file X (X = exact literal path)\n"
 		" --exclude-regex=X      avoid including files that match X (X = regular expression)\n"
+		" --exclude-from=X       avoid including files listed in file X\n"
 #ifdef HAVE_LIBSELINUX
 		" --file-contexts=X      specify a file contexts file to setup selinux labels\n"
 #endif
@@ -1246,6 +1248,39 @@ static int mkfs_parse_options_cfg(struct erofs_importer_params *params,
 		case 7:
 			params->fixed_uid = params->fixed_gid = 0;
 			break;
+		case 540: {
+			FILE *f = fopen(optarg, "r");
+			if (!f) {
+				erofs_err("failed to open exclude file: %s", optarg);
+				return -errno;
+			}
+
+			char *line = NULL;
+			size_t len = 0;
+			ssize_t read;
+
+			while ((read = getline(&line, &len, f)) != -1) {
+				if (read > 0 && line[read - 1] == '\n') {
+					line[read - 1] = '\0';
+					read--;
+				}
+
+				if (read == 0) continue;
+
+				opt = erofs_parse_exclude_path(line, false);
+				if (opt) {
+					erofs_err("failed to parse exclude path from file: %s",
+						  erofs_strerror(opt));
+					free(line);
+					fclose(f);
+					return opt;
+				}
+			}
+			free(line);
+			fclose(f);
+			break;
+			}
+
 #ifndef NDEBUG
 		case 8:
 			cfg.c_random_pclusterblks = true;
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-03-16 10:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06  8:57 [PATCH 0/2] erofs-utils: minor cleanups and enhancements Nithurshen
2026-03-06  8:57 ` [PATCH 1/2] erofs-utils: dump: remove redundant conditional branch in filesize distribution Nithurshen
2026-03-06  8:57 ` [PATCH 2/2] erofs-utils: fsck: add warning for unsupported file types during extraction Nithurshen
2026-03-16 10:05 ` [PATCH 0/2] erofs-utils: minor cleanups and enhancements Gao Xiang
2026-03-16 10:52 ` [PATCH v2 " Nithurshen
2026-03-16 10:52   ` [PATCH v2 1/2] erofs-utils: dump: remove redundant conditional branch in filesize distribution Nithurshen
2026-03-16 10:52   ` [PATCH v2] erofs-utils: mkfs: add --exclude-path-from and --exclude-regex-from Nithurshen
2026-03-16 10:52   ` [PATCH v2] mkfs: support block map for blob devices Nithurshen
2026-03-16 10:52   ` [PATCH v2 2/2] erofs-utils: fsck: add warning for unsupported file types during extraction Nithurshen
2026-03-16 10:59 ` [PATCH v3 0/2] erofs-utils: minor cleanups and enhancements Nithurshen
2026-03-16 10:59   ` [PATCH v3 1/2] erofs-utils: dump: remove redundant conditional branch in filesize distribution Nithurshen
2026-03-16 10:59   ` [PATCH v3 2/2] erofs-utils: fsck: add warning for unsupported file types during extraction Nithurshen
  -- strict thread matches above, loose matches on Subject: below --
2026-03-08  3:47 [PATCH] erofs-utils: mkfs: add --exclude-from option Nithurshen
2026-03-09 12:47 ` [PATCH v2] erofs-utils: mkfs: add --exclude-path-from and --exclude-regex-from Nithurshen
2026-03-09 12:50 ` Nithurshen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox