Skip to content

Commit

Permalink
revert changes to mfs
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Zimmermann committed Jan 19, 2025
1 parent 4f02835 commit 446ddcf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions elks/tools/mfs/genfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions elks/tools/mfs/mkfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <sys/stat.h>
#include <stdlib.h>

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 */

/**
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions elks/tools/mfs/protos.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 446ddcf

Please sign in to comment.