From 4f0283579ea33140d47c657d825b0780f579eb2a Mon Sep 17 00:00:00 2001 From: Florian Zimmermann Date: Sat, 18 Jan 2025 11:43:50 +0100 Subject: [PATCH 1/2] remove opt_nocopyzero setting globally, since unused --- elks/tools/mfs/genfs.c | 7 ------- elks/tools/mfs/mkfs.c | 10 +++------- elks/tools/mfs/protos.h | 1 - elkscmd/file_utils/cp.c | 9 --------- 4 files changed, 3 insertions(+), 24 deletions(-) diff --git a/elks/tools/mfs/genfs.c b/elks/tools/mfs/genfs.c index 79eaba348..9d79cd887 100644 --- a/elks/tools/mfs/genfs.c +++ b/elks/tools/mfs/genfs.c @@ -389,13 +389,6 @@ 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 5ffa55724..6709f79dc 100644 --- a/elks/tools/mfs/mkfs.c +++ b/elks/tools/mfs/mkfs.c @@ -28,7 +28,6 @@ #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 */ /** @@ -76,12 +75,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; + case 'a': + opt_appendifexists = 1; + break; default: usage(argv[0]); } diff --git a/elks/tools/mfs/protos.h b/elks/tools/mfs/protos.h index c89e69288..4d51f6ff8 100644 --- a/elks/tools/mfs/protos.h +++ b/elks/tools/mfs/protos.h @@ -74,7 +74,6 @@ extern int opt_keepuid; extern int opt_fsbad_fatal; extern char *toolname; -extern int opt_nocopyzero; extern int opt_appendifexists; extern char *optarg; diff --git a/elkscmd/file_utils/cp.c b/elkscmd/file_utils/cp.c index 2232c7747..c4558d8dd 100644 --- a/elkscmd/file_utils/cp.c +++ b/elkscmd/file_utils/cp.c @@ -27,7 +27,6 @@ int opt_recurse; /* implicitly initialized */ int opt_verbose; -int opt_nocopyzero; int opt_force; int whole_disk_copy; char *destination_dir; @@ -329,14 +328,6 @@ static int do_copies(void) err |= do_mkdir(inode_build->path, destdir(inode_build->path)); } 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 zero length %s\n", inode_build->path); - continue; - } - } err |= do_cp(inode_build->path, destdir(inode_build->path)); } else if (flags == S_IFCHR) { From 446ddcf93c54925beb626d797c68a42ae96d6e5c Mon Sep 17 00:00:00 2001 From: Florian Zimmermann Date: Sun, 19 Jan 2025 10:02:14 +0100 Subject: [PATCH 2/2] 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;