diff options
Diffstat (limited to 'unpack')
-rw-r--r-- | unpack/options.c | 8 | ||||
-rw-r--r-- | unpack/rdsquashfs.c | 3 | ||||
-rw-r--r-- | unpack/rdsquashfs.h | 1 | ||||
-rw-r--r-- | unpack/restore_fstree.c | 3 |
4 files changed, 12 insertions, 3 deletions
diff --git a/unpack/options.c b/unpack/options.c index 84c17cf..c42f16a 100644 --- a/unpack/options.c +++ b/unpack/options.c @@ -11,6 +11,7 @@ static struct option long_opts[] = { { "no-fifo", no_argument, NULL, 'F' }, { "no-slink", no_argument, NULL, 'L' }, { "no-empty-dir", no_argument, NULL, 'E' }, + { "no-sparse", no_argument, NULL, 'Z' }, { "describe", no_argument, NULL, 'd' }, { "chmod", no_argument, NULL, 'C' }, { "chown", no_argument, NULL, 'O' }, @@ -19,7 +20,7 @@ static struct option long_opts[] = { { "version", no_argument, NULL, 'V' }, }; -static const char *short_opts = "l:c:u:p:DSFLCOEdqhV"; +static const char *short_opts = "l:c:u:p:DSFLCOEZdqhV"; static const char *help_string = "Usage: %s [OPTIONS] <squashfs-file>\n" @@ -47,6 +48,8 @@ static const char *help_string = " --no-slink, -L Do not unpack symbolic links.\n" " --no-empty-dir, -E Do not unpack directories that would end up\n" " empty after applying the above rules.\n" +" --no-sparse, -Z Do not create sparse files, always write zero\n" +" blocks to disk.\n" " --chmod, -C Change permission flags of unpacked files to\n" " those store in the squashfs image.\n" " --chown, -O Change ownership of unpacked files to the\n" @@ -118,6 +121,9 @@ void process_command_line(options_t *opt, int argc, char **argv) case 'O': opt->flags |= UNPACK_CHOWN; break; + case 'Z': + opt->flags |= UNPACK_NO_SPARSE; + break; case 'c': opt->op = OP_CAT; opt->cmdpath = get_path(opt->cmdpath, optarg); diff --git a/unpack/rdsquashfs.c b/unpack/rdsquashfs.c index fcfc9c9..42bddff 100644 --- a/unpack/rdsquashfs.c +++ b/unpack/rdsquashfs.c @@ -100,7 +100,8 @@ int main(int argc, char **argv) if (data == NULL) goto out_fs; - if (data_reader_dump_file(data, n->data.file, STDOUT_FILENO)) + if (data_reader_dump_file(data, n->data.file, + STDOUT_FILENO, false)) goto out_fs; break; case OP_UNPACK: diff --git a/unpack/rdsquashfs.h b/unpack/rdsquashfs.h index 9d1ab4f..0ee48fa 100644 --- a/unpack/rdsquashfs.h +++ b/unpack/rdsquashfs.h @@ -24,6 +24,7 @@ enum UNPACK_FLAGS { UNPACK_CHMOD = 0x01, UNPACK_CHOWN = 0x02, UNPACK_QUIET = 0x04, + UNPACK_NO_SPARSE = 0x08, }; enum { diff --git a/unpack/restore_fstree.c b/unpack/restore_fstree.c index 976b15c..ab10f5d 100644 --- a/unpack/restore_fstree.c +++ b/unpack/restore_fstree.c @@ -63,7 +63,8 @@ static int create_node(tree_node_t *n, data_reader_t *data, int flags) return -1; } - if (data_reader_dump_file(data, n->data.file, fd)) { + if (data_reader_dump_file(data, n->data.file, fd, + (flags & UNPACK_NO_SPARSE) == 0)) { close(fd); return -1; } |