summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-20 22:26:56 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-20 22:26:56 +0200
commit012a83c9466e8668fc08acb6a80fa4dd5c82997c (patch)
tree4cd6cb483db184e2fd560a48c3650431cb1fd5d3 /lib
parent1a6b70f3702d3bdb0f1cb8e4669ec5ed21ea923b (diff)
Add sqfs_ prefix to data_reader_t & functions
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/sqfshelper/data_reader.c39
-rw-r--r--lib/sqfshelper/data_reader_dump.c9
2 files changed, 25 insertions, 23 deletions
diff --git a/lib/sqfshelper/data_reader.c b/lib/sqfshelper/data_reader.c
index d054069..bf808ba 100644
--- a/lib/sqfshelper/data_reader.c
+++ b/lib/sqfshelper/data_reader.c
@@ -18,7 +18,7 @@
#include <string.h>
#include <stdio.h>
-struct data_reader_t {
+struct sqfs_data_reader_t {
sqfs_fragment_t *frag;
sqfs_compressor_t *cmp;
sqfs_block_t *data_block;
@@ -35,7 +35,7 @@ struct data_reader_t {
uint8_t scratch[];
};
-static int get_block(data_reader_t *data, uint64_t off, uint32_t size,
+static int get_block(sqfs_data_reader_t *data, uint64_t off, uint32_t size,
size_t unpacked_size, sqfs_block_t **out)
{
sqfs_block_t *blk = alloc_flex(sizeof(*blk), 1, unpacked_size);
@@ -84,7 +84,7 @@ static int get_block(data_reader_t *data, uint64_t off, uint32_t size,
return 0;
}
-static int precache_data_block(data_reader_t *data, uint64_t location,
+static int precache_data_block(sqfs_data_reader_t *data, uint64_t location,
uint32_t size)
{
int ret;
@@ -106,7 +106,7 @@ static int precache_data_block(data_reader_t *data, uint64_t location,
return 0;
}
-static int precache_fragment_block(data_reader_t *data, size_t idx)
+static int precache_fragment_block(sqfs_data_reader_t *data, size_t idx)
{
int ret;
@@ -130,10 +130,11 @@ static int precache_fragment_block(data_reader_t *data, size_t idx)
return 0;
}
-data_reader_t *data_reader_create(sqfs_file_t *file, size_t block_size,
- sqfs_compressor_t *cmp)
+sqfs_data_reader_t *sqfs_data_reader_create(sqfs_file_t *file,
+ size_t block_size,
+ sqfs_compressor_t *cmp)
{
- data_reader_t *data = alloc_flex(sizeof(*data), 1, block_size);
+ sqfs_data_reader_t *data = alloc_flex(sizeof(*data), 1, block_size);
if (data != NULL) {
data->file = file;
@@ -144,8 +145,8 @@ data_reader_t *data_reader_create(sqfs_file_t *file, size_t block_size,
return data;
}
-int data_reader_load_fragment_table(data_reader_t *data,
- const sqfs_super_t *super)
+int sqfs_data_reader_load_fragment_table(sqfs_data_reader_t *data,
+ const sqfs_super_t *super)
{
void *raw_frag;
size_t size;
@@ -193,7 +194,7 @@ int data_reader_load_fragment_table(data_reader_t *data,
return 0;
}
-void data_reader_destroy(data_reader_t *data)
+void sqfs_data_reader_destroy(sqfs_data_reader_t *data)
{
free(data->data_block);
free(data->frag_block);
@@ -201,9 +202,9 @@ void data_reader_destroy(data_reader_t *data)
free(data);
}
-int data_reader_get_block(data_reader_t *data,
- const sqfs_inode_generic_t *inode,
- size_t index, sqfs_block_t **out)
+int sqfs_data_reader_get_block(sqfs_data_reader_t *data,
+ const sqfs_inode_generic_t *inode,
+ size_t index, sqfs_block_t **out)
{
size_t i, unpacked_size;
uint64_t off, filesz;
@@ -232,9 +233,9 @@ int data_reader_get_block(data_reader_t *data,
unpacked_size, out);
}
-int data_reader_get_fragment(data_reader_t *data,
- const sqfs_inode_generic_t *inode,
- sqfs_block_t **out)
+int sqfs_data_reader_get_fragment(sqfs_data_reader_t *data,
+ const sqfs_inode_generic_t *inode,
+ sqfs_block_t **out)
{
uint32_t frag_idx, frag_off, frag_sz;
sqfs_block_t *blk;
@@ -276,9 +277,9 @@ int data_reader_get_fragment(data_reader_t *data,
return 0;
}
-ssize_t data_reader_read(data_reader_t *data,
- const sqfs_inode_generic_t *inode,
- uint64_t offset, void *buffer, size_t size)
+ssize_t sqfs_data_reader_read(sqfs_data_reader_t *data,
+ const sqfs_inode_generic_t *inode,
+ uint64_t offset, void *buffer, size_t size)
{
uint32_t frag_idx, frag_off;
size_t i, diff, total = 0;
diff --git a/lib/sqfshelper/data_reader_dump.c b/lib/sqfshelper/data_reader_dump.c
index 23cd482..0c7a0cc 100644
--- a/lib/sqfshelper/data_reader_dump.c
+++ b/lib/sqfshelper/data_reader_dump.c
@@ -16,8 +16,9 @@
#include <string.h>
#include <stdio.h>
-int data_reader_dump(data_reader_t *data, const sqfs_inode_generic_t *inode,
- int outfd, size_t block_size, bool allow_sparse)
+int sqfs_data_reader_dump(sqfs_data_reader_t *data,
+ const sqfs_inode_generic_t *inode,
+ int outfd, size_t block_size, bool allow_sparse)
{
sqfs_block_t *blk;
uint64_t filesz;
@@ -47,7 +48,7 @@ int data_reader_dump(data_reader_t *data, const sqfs_inode_generic_t *inode,
if (lseek(outfd, diff, SEEK_CUR) == (off_t)-1)
goto fail_sparse;
} else {
- err = data_reader_get_block(data, inode, i, &blk);
+ err = sqfs_data_reader_get_block(data, inode, i, &blk);
if (err) {
fprintf(stderr, "error reading "
"data block: %d\n", err);
@@ -66,7 +67,7 @@ int data_reader_dump(data_reader_t *data, const sqfs_inode_generic_t *inode,
}
if (filesz > 0) {
- if (data_reader_get_fragment(data, inode, &blk)) {
+ if (sqfs_data_reader_get_fragment(data, inode, &blk)) {
fputs("error reading fragment block", stderr);
return -1;
}