aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-11 17:45:44 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-06-11 17:45:44 +0200
commit578fc9124db4c50ca8c5fac865296139be8c8dfd (patch)
treecdf75b58a0a43d1eb12f561b78bae96041795e5d /include
parenta3a47476c5ceed1688e37a5af8a5a988b504832e (diff)
Move file extraction code to generic data_reader_t in libsquashfs.a
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/data_reader.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/data_reader.h b/include/data_reader.h
new file mode 100644
index 0000000..68788b4
--- /dev/null
+++ b/include/data_reader.h
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+#ifndef DATA_READER_H
+#define DATA_READER_H
+
+#include "squashfs.h"
+#include "compress.h"
+#include "fstree.h"
+
+typedef struct data_reader_t data_reader_t;
+
+/*
+ Create a data reader for accessing data blocks in a squashfs image.
+
+ Internally creates a fragment_reader_t (if applicable) to resolve
+ fragment indices.
+
+ Prints error messsages to stderr on failure.
+ */
+data_reader_t *data_reader_create(int fd, sqfs_super_t *super,
+ compressor_t *cmp);
+
+void data_reader_destroy(data_reader_t *data);
+
+/*
+ Use a file_info_t to locate and extract all blocks of the coresponding
+ file and its fragment, if it has one. The entire data is dumped to the
+ given file descriptor.
+
+ Returns 0 on success, prints error messages to stderr on failure.
+ */
+int data_reader_dump_file(data_reader_t *data, file_info_t *fi, int outfd);
+
+#endif /* DATA_READER_H */