summaryrefslogtreecommitdiff
path: root/tar
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 /tar
parent80cc3970e97ec71b5e645ca5132bebf115423fb2 (diff)
Implement generating an inode table for NFS export
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tar')
-rw-r--r--tar/tar2sqfs.c13
1 files changed, 12 insertions, 1 deletions
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...] <sqfsfile>\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;