From 68591ef78ceefb9a37eb1744be73e646f63e450b Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Fri, 26 Jul 2019 13:16:38 +0200 Subject: Merge remaining code of fragment reader into data reader After the table read unification, there wasn't much left of the fragment reader and the remains could easily be moved over to the data reader. Signed-off-by: David Oberhollenzer --- include/data_reader.h | 3 --- include/frag_reader.h | 42 ------------------------------------------ 2 files changed, 45 deletions(-) delete mode 100644 include/frag_reader.h (limited to 'include') diff --git a/include/data_reader.h b/include/data_reader.h index e37584e..ecac517 100644 --- a/include/data_reader.h +++ b/include/data_reader.h @@ -4,7 +4,6 @@ #include "config.h" -#include "frag_reader.h" #include "squashfs.h" #include "compress.h" #include "fstree.h" @@ -37,6 +36,4 @@ void data_reader_destroy(data_reader_t *data); int data_reader_dump_file(data_reader_t *data, file_info_t *fi, int outfd, bool allow_sparse); -const frag_reader_t *data_reader_get_fragment_reader(const data_reader_t *data); - #endif /* DATA_READER_H */ diff --git a/include/frag_reader.h b/include/frag_reader.h deleted file mode 100644 index 1f4f271..0000000 --- a/include/frag_reader.h +++ /dev/null @@ -1,42 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -#ifndef FRAG_READER_H -#define FRAG_READER_H - -#include "config.h" - -#include "squashfs.h" -#include "compress.h" - -#include -#include - -typedef struct frag_reader_t frag_reader_t; - -/* Reads and decodes the fragment table from the image. Cleans up after itself - and prints error messages to stderr on the way if it fails. */ -frag_reader_t *frag_reader_create(sqfs_super_t *super, int fd, - compressor_t *cmp); - -void frag_reader_destroy(frag_reader_t *f); - -/* - Read data from a fragment. - - The function takes care of loading and uncompressing the fragment block - (which is skipped if it has already been loaded earlier). - - `index` is a fragment index from an inode, `offset` is a byte offset into - the fragment block and `size` is the number of bytes to copy into the - destination buffer. - - Returns 0 on success. Prints error messages to stderr on failure (including - index out of bounds). -*/ -int frag_reader_read(frag_reader_t *f, size_t index, size_t offset, - void *buffer, size_t size); - -const sqfs_fragment_t *frag_reader_get_table(const frag_reader_t *f); - -size_t frag_reader_get_fragment_count(const frag_reader_t *f); - -#endif /* FRAG_READER_H */ -- cgit v1.2.3