From 2a05bf5bc660bfebb35e42f1f8a0c0ac56e0f9d9 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 21 Jul 2019 20:22:04 +0200 Subject: Implement generating an inode table for NFS export Signed-off-by: David Oberhollenzer --- tar/tar2sqfs.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tar') diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c index 3417fd0..8394b7f 100644 --- a/tar/tar2sqfs.c +++ b/tar/tar2sqfs.c @@ -26,13 +26,14 @@ static struct option long_opts[] = { { "comp-extra", required_argument, NULL, 'X' }, { "no-skip", no_argument, NULL, 's' }, { "no-xattr", no_argument, NULL, 'x' }, + { "exportable", no_argument, NULL, 'e' }, { "force", no_argument, NULL, 'f' }, { "quiet", no_argument, NULL, 'q' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, }; -static const char *short_opts = "c:b:B:d:X:sxfqhV"; +static const char *short_opts = "c:b:B:d:X:sxefqhV"; static const char *usagestr = "Usage: tar2sqfs [OPTIONS...] \n" @@ -63,6 +64,7 @@ static const char *usagestr = " --no-skip, -s Abort if a tar record cannot be read instead\n" " of skipping it.\n" " --no-xattr, -x Do not copy extended attributes from archive.\n" +" --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" @@ -85,6 +87,7 @@ static char *comp_extra = NULL; static char *fs_defaults = NULL; static bool dont_skip = false; static bool no_xattr = false; +static bool exportable = false; static void process_args(int argc, char **argv) { @@ -137,6 +140,9 @@ static void process_args(int argc, char **argv) case 's': dont_skip = true; break; + case 'e': + exportable = true; + break; case 'f': outmode = O_WRONLY | O_CREAT | O_TRUNC; break; @@ -388,6 +394,11 @@ int main(int argc, char **argv) if (data_writer_write_fragment_table(data)) goto out; + if (exportable) { + if (write_export_table(outfd, &fs, &super, cmp)) + goto out; + } + if (id_table_write(&idtbl, outfd, &super, cmp)) goto out; -- cgit v1.2.3