aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs/meta_reader.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-05-20 11:01:10 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-05-20 11:01:10 +0200
commitc2e01ed987e942005fa66f11d96b8edb1d930c99 (patch)
tree856042ae5b3b1928a8ca7275c996f68972a5f680 /lib/sqfs/meta_reader.c
parent93f5a822b208b7df1c9a3f15685f397e0ce344aa (diff)
cleanup: internalize meta reader/writer implementations
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/meta_reader.c')
-rw-r--r--lib/sqfs/meta_reader.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/sqfs/meta_reader.c b/lib/sqfs/meta_reader.c
index 1a70238..e9b599f 100644
--- a/lib/sqfs/meta_reader.c
+++ b/lib/sqfs/meta_reader.c
@@ -7,6 +7,29 @@
#include <string.h>
#include <stdio.h>
+struct meta_reader_t {
+ /* The location of the current block in the image */
+ uint64_t block_offset;
+
+ /* The location of the next block after the current one */
+ uint64_t next_block;
+
+ /* A byte offset into the uncompressed data of the current block */
+ size_t offset;
+
+ /* The underlying file descriptor to read from */
+ int fd;
+
+ /* A pointer to the compressor to use for extracting data */
+ compressor_t *cmp;
+
+ /* The raw data read from the input file */
+ uint8_t data[SQFS_META_BLOCK_SIZE];
+
+ /* The uncompressed data read from the input file */
+ uint8_t scratch[SQFS_META_BLOCK_SIZE];
+};
+
meta_reader_t *meta_reader_create(int fd, compressor_t *cmp)
{
meta_reader_t *m = calloc(1, sizeof(*m));