summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-11 17:22:02 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-11 17:22:30 +0200
commitc472d86a770e896339b1ac200ca913676bf38526 (patch)
treebc7b75efdaf2aa5a75e439656d071bc2567bf6c4
parent33d5e09ccbf2bafe3d06f615b11bf29d07f47784 (diff)
cleanup: replace gensquashfs bool options for dir scan with flags
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--mkfs/mkfs.c17
-rw-r--r--mkfs/mkfs.h4
-rw-r--r--mkfs/options.c10
3 files changed, 7 insertions, 24 deletions
diff --git a/mkfs/mkfs.c b/mkfs/mkfs.c
index b11dce0..8ee2268 100644
--- a/mkfs/mkfs.c
+++ b/mkfs/mkfs.c
@@ -68,24 +68,11 @@ static int pack_files(data_writer_t *data, fstree_t *fs, options_t *opt)
static int read_fstree(fstree_t *fs, options_t *opt)
{
- unsigned int flags;
FILE *fp;
int ret;
- if (opt->infile == NULL) {
- flags = 0;
-
- if (opt->keep_time)
- flags |= DIR_SCAN_KEEP_TIME;
-
- if (opt->one_filesystem)
- flags |= DIR_SCAN_ONE_FILESYSTEM;
-
- if (opt->keep_xattr)
- flags |= DIR_SCAN_READ_XATTR;
-
- return fstree_from_dir(fs, opt->packdir, flags);
- }
+ if (opt->infile == NULL)
+ return fstree_from_dir(fs, opt->packdir, opt->dirscan_flags);
fp = fopen(opt->infile, "rb");
if (fp == NULL) {
diff --git a/mkfs/mkfs.h b/mkfs/mkfs.h
index e02c248..16ab887 100644
--- a/mkfs/mkfs.h
+++ b/mkfs/mkfs.h
@@ -35,9 +35,7 @@ typedef struct {
int outmode;
int blksz;
int devblksz;
- bool keep_time;
- bool keep_xattr;
- bool one_filesystem;
+ unsigned int dirscan_flags;
bool exportable;
bool quiet;
const char *infile;
diff --git a/mkfs/options.c b/mkfs/options.c
index 2778a9e..6fe5e55 100644
--- a/mkfs/options.c
+++ b/mkfs/options.c
@@ -147,9 +147,7 @@ void process_command_line(options_t *opt, int argc, char **argv)
opt->compressor = compressor_get_default();
opt->blksz = SQFS_DEFAULT_BLOCK_SIZE;
opt->devblksz = SQFS_DEVBLK_SIZE;
- opt->keep_xattr = false;
- opt->keep_time = false;
- opt->one_filesystem = false;
+ opt->dirscan_flags = 0;
opt->exportable = false;
opt->quiet = false;
opt->infile = NULL;
@@ -195,15 +193,15 @@ void process_command_line(options_t *opt, int argc, char **argv)
opt->fs_defaults = optarg;
break;
case 'k':
- opt->keep_time = true;
+ opt->dirscan_flags |= DIR_SCAN_KEEP_TIME;
break;
#ifdef HAVE_SYS_XATTR_H
case 'x':
- opt->keep_xattr = true;
+ opt->dirscan_flags |= DIR_SCAN_READ_XATTR;
break;
#endif
case 'o':
- opt->one_filesystem = true;
+ opt->dirscan_flags |= DIR_SCAN_ONE_FILESYSTEM;
break;
case 'e':
opt->exportable = true;