aboutsummaryrefslogtreecommitdiff
path: root/tar
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-15 17:56:07 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-15 17:59:00 +0200
commit8ee3ee9c71418dbdb73d4350c17056024fb7ec41 (patch)
tree28416eda2893ed28750c29b41b64d783a1aaa35d /tar
parentab2d7fd8bfb1eafc61953e74757e84ed407b1f21 (diff)
Replace file descriptor IO in data_writer with sqfs_file_t
First, this commit moves the create-blocks-from-fd function over to libsquashfs and ports it to work on an sqfs_file_t instead. Second, the function in the data_writer that reads from a file descriptor is adjusted to use an sqfs_file_t instead. Finally, the tools that use it have to be adjusted accordingly. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tar')
-rw-r--r--tar/tar2sqfs.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c
index 13276b8..d693aa1 100644
--- a/tar/tar2sqfs.c
+++ b/tar/tar2sqfs.c
@@ -225,6 +225,7 @@ fail_arg:
static int write_file(tar_header_decoded_t *hdr, file_info_t *fi,
data_writer_t *data)
{
+ sqfs_file_t *file;
int ret;
if (hdr->sparse != NULL) {
@@ -236,9 +237,16 @@ static int write_file(tar_header_decoded_t *hdr, file_info_t *fi,
return skip_padding(STDIN_FILENO, hdr->record_size);
}
- if (write_data_from_fd(data, fi, STDIN_FILENO, 0))
+ file = sqfs_get_stdin_file(fi->size);
+ if (file == NULL) {
+ perror("packing files");
+ return -1;
+ }
+
+ if (write_data_from_file(data, fi, file, 0))
return -1;
+ file->destroy(file);
return skip_padding(STDIN_FILENO, fi->size);
}