summaryrefslogtreecommitdiff
path: root/mkfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-21 20:22:04 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-21 20:22:04 +0200
commit2a05bf5bc660bfebb35e42f1f8a0c0ac56e0f9d9 (patch)
tree07492d6744db580ba487503a7a4572d4a92ae0c1 /mkfs
parent80cc3970e97ec71b5e645ca5132bebf115423fb2 (diff)
Implement generating an inode table for NFS export
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'mkfs')
-rw-r--r--mkfs/mkfs.c5
-rw-r--r--mkfs/mkfs.h1
-rw-r--r--mkfs/options.c10
3 files changed, 14 insertions, 2 deletions
diff --git a/mkfs/mkfs.c b/mkfs/mkfs.c
index f1c1f1b..91cb9bd 100644
--- a/mkfs/mkfs.c
+++ b/mkfs/mkfs.c
@@ -185,6 +185,11 @@ int main(int argc, char **argv)
if (data_writer_write_fragment_table(data))
goto out_data;
+ if (opt.exportable) {
+ if (write_export_table(outfd, &fs, &super, cmp))
+ goto out_data;
+ }
+
if (id_table_write(&idtbl, outfd, &super, cmp))
goto out_data;
diff --git a/mkfs/mkfs.h b/mkfs/mkfs.h
index 4031c74..70a2ed6 100644
--- a/mkfs/mkfs.h
+++ b/mkfs/mkfs.h
@@ -29,6 +29,7 @@ typedef struct {
int outmode;
int blksz;
int devblksz;
+ bool exportable;
bool quiet;
const char *infile;
const char *packdir;
diff --git a/mkfs/options.c b/mkfs/options.c
index 2dab6b8..fe2bc69 100644
--- a/mkfs/options.c
+++ b/mkfs/options.c
@@ -9,6 +9,7 @@ static struct option long_opts[] = {
{ "comp-extra", required_argument, NULL, 'X' },
{ "pack-file", required_argument, NULL, 'F' },
{ "pack-dir", required_argument, NULL, 'D' },
+ { "exportable", no_argument, NULL, 'e' },
{ "force", no_argument, NULL, 'f' },
{ "quiet", no_argument, NULL, 'q' },
#ifdef WITH_SELINUX
@@ -19,9 +20,9 @@ static struct option long_opts[] = {
};
#ifdef WITH_SELINUX
-static const char *short_opts = "s:F:D:X:c:b:B:d:fqhV";
+static const char *short_opts = "s:F:D:X:c:b:B:d:efqhV";
#else
-static const char *short_opts = "F:D:X:c:b:B:d:fqhV";
+static const char *short_opts = "F:D:X:c:b:B:d:efqhV";
#endif
extern char *__progname;
@@ -66,6 +67,7 @@ static const char *help_string =
" --selinux, -s <file> Specify an SELinux label file to get context\n"
" attributes from.\n"
#endif
+" --exportable, -e Generate an export table for NFS support.\n"
" --force, -f Overwrite the output file if it exists.\n"
" --quiet, -q Do not print out progress reports.\n"
" --help, -h Print help text and exit.\n"
@@ -123,6 +125,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->exportable = false;
opt->quiet = false;
opt->infile = NULL;
opt->packdir = NULL;
@@ -166,6 +169,9 @@ void process_command_line(options_t *opt, int argc, char **argv)
case 'd':
opt->fs_defaults = optarg;
break;
+ case 'e':
+ opt->exportable = true;
+ break;
case 'f':
opt->outmode = O_WRONLY | O_CREAT | O_TRUNC;
break;