From c2e01ed987e942005fa66f11d96b8edb1d930c99 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 20 May 2019 11:01:10 +0200 Subject: cleanup: internalize meta reader/writer implementations Signed-off-by: David Oberhollenzer --- lib/sqfs/meta_reader.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib/sqfs/meta_reader.c') 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 #include +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)); -- cgit v1.2.3