From 446ddcf93c54925beb626d797c68a42ae96d6e5c Mon Sep 17 00:00:00 2001 From: Florian Zimmermann Date: Sun, 19 Jan 2025 10:02:14 +0100 Subject: [PATCH] revert changes to mfs --- elks/tools/mfs/genfs.c | 7 +++++++ elks/tools/mfs/mkfs.c | 4 ++++ elks/tools/mfs/protos.h | 1 + 3 files changed, 12 insertions(+) diff --git a/elks/tools/mfs/genfs.c b/elks/tools/mfs/genfs.c index 9d79cd887..79eaba348 100644 --- a/elks/tools/mfs/genfs.c +++ b/elks/tools/mfs/genfs.c @@ -389,6 +389,13 @@ compile_fs(struct minix_fs_dat *fs) av[2] = 0; cmd_mkdir(fs, 2, av, sb.st_mode & 0777); } else if (flags == S_IFREG) { + if (opt_nocopyzero && !inode_build->blocks) { + char *p = strrchr(inode_build->path, '/'); + if (p && *++p == '.') { + if (opt_verbose) printf("Skipping %s\n", inode_build->path); + continue; + } + } if (opt_verbose) printf("cp %s %s\n", inode_build->path, prefix+inode_build->path); av[0] = "cp"; av[1] = inode_build->path; diff --git a/elks/tools/mfs/mkfs.c b/elks/tools/mfs/mkfs.c index 6709f79dc..6042badfb 100644 --- a/elks/tools/mfs/mkfs.c +++ b/elks/tools/mfs/mkfs.c @@ -28,6 +28,7 @@ #include #include +int opt_nocopyzero = 0; /* don't copy zero-length files starting with . */ int opt_appendifexists = 0; /* don't create new fs on genfs if exists */ /** @@ -75,6 +76,9 @@ void parse_mkfs(int argc,char **argv,int *magic_p,int *nblks_p,int *inodes_p) { case 's': *nblks_p = atoi(optarg); break; + case 'k': + opt_nocopyzero = 1; + break; case 'a': opt_appendifexists = 1; break; diff --git a/elks/tools/mfs/protos.h b/elks/tools/mfs/protos.h index 4d51f6ff8..c89e69288 100644 --- a/elks/tools/mfs/protos.h +++ b/elks/tools/mfs/protos.h @@ -74,6 +74,7 @@ extern int opt_keepuid; extern int opt_fsbad_fatal; extern char *toolname; +extern int opt_nocopyzero; extern int opt_appendifexists; extern char *optarg;