summaryrefslogtreecommitdiff
path: root/lib/sqfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 18:46:50 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 18:46:50 +0200
commit320ae4f8e752f6652c7b5c8201d7267cd4de17c1 (patch)
tree4423514c5433dc3b70e32fd5950a139827b94ac9 /lib/sqfs
parentf92cf3b98f51d355c92900f1d316b141b2b9d4fd (diff)
Cleanup naming scheme of compressor
Add sqfs_* prefix to compressor, move implementation prefix up front. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs')
-rw-r--r--lib/sqfs/block_processor.c4
-rw-r--r--lib/sqfs/block_processor_parallel.c4
-rw-r--r--lib/sqfs/comp/compressor.c30
-rw-r--r--lib/sqfs/comp/gzip.c24
-rw-r--r--lib/sqfs/comp/internal.h14
-rw-r--r--lib/sqfs/comp/lz4.c28
-rw-r--r--lib/sqfs/comp/lzo.c26
-rw-r--r--lib/sqfs/comp/xz.c28
-rw-r--r--lib/sqfs/comp/zstd.c26
-rw-r--r--lib/sqfs/id_table.c4
-rw-r--r--lib/sqfs/meta_reader.c4
-rw-r--r--lib/sqfs/meta_writer.c4
-rw-r--r--lib/sqfs/process_block.c2
-rw-r--r--lib/sqfs/read_table.c2
-rw-r--r--lib/sqfs/write_table.c2
-rw-r--r--lib/sqfs/xattr_reader.c2
16 files changed, 103 insertions, 101 deletions
diff --git a/lib/sqfs/block_processor.c b/lib/sqfs/block_processor.c
index 2bf307f..5579eb5 100644
--- a/lib/sqfs/block_processor.c
+++ b/lib/sqfs/block_processor.c
@@ -15,7 +15,7 @@
struct sqfs_block_processor_t {
size_t max_block_size;
- compressor_t *cmp;
+ sqfs_compressor_t *cmp;
sqfs_block_cb cb;
void *user;
int status;
@@ -24,7 +24,7 @@ struct sqfs_block_processor_t {
};
sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size,
- compressor_t *cmp,
+ sqfs_compressor_t *cmp,
unsigned int num_workers,
void *user,
sqfs_block_cb callback)
diff --git a/lib/sqfs/block_processor_parallel.c b/lib/sqfs/block_processor_parallel.c
index 6fca018..5d505e1 100644
--- a/lib/sqfs/block_processor_parallel.c
+++ b/lib/sqfs/block_processor_parallel.c
@@ -18,7 +18,7 @@
typedef struct {
sqfs_block_processor_t *shared;
- compressor_t *cmp;
+ sqfs_compressor_t *cmp;
pthread_t thread;
uint8_t scratch[];
} compress_worker_t;
@@ -113,7 +113,7 @@ static void *worker_proc(void *arg)
}
sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size,
- compressor_t *cmp,
+ sqfs_compressor_t *cmp,
unsigned int num_workers,
void *user,
sqfs_block_cb callback)
diff --git a/lib/sqfs/comp/compressor.c b/lib/sqfs/comp/compressor.c
index d436100..fef238a 100644
--- a/lib/sqfs/comp/compressor.c
+++ b/lib/sqfs/comp/compressor.c
@@ -13,23 +13,24 @@
#include "internal.h"
#include "util.h"
-typedef compressor_t *(*compressor_fun_t)(const compressor_config_t *cfg);
+typedef sqfs_compressor_t *(*compressor_fun_t)
+ (const sqfs_compressor_config_t *cfg);
static compressor_fun_t compressors[SQFS_COMP_MAX + 1] = {
#ifdef WITH_GZIP
- [SQFS_COMP_GZIP] = create_gzip_compressor,
+ [SQFS_COMP_GZIP] = gzip_compressor_create,
#endif
#ifdef WITH_XZ
- [SQFS_COMP_XZ] = create_xz_compressor,
+ [SQFS_COMP_XZ] = xz_compressor_create,
#endif
#ifdef WITH_LZO
- [SQFS_COMP_LZO] = create_lzo_compressor,
+ [SQFS_COMP_LZO] = lzo_compressor_create,
#endif
#ifdef WITH_LZ4
- [SQFS_COMP_LZ4] = create_lz4_compressor,
+ [SQFS_COMP_LZ4] = lz4_compressor_create,
#endif
#ifdef WITH_ZSTD
- [SQFS_COMP_ZSTD] = create_zstd_compressor,
+ [SQFS_COMP_ZSTD] = zstd_compressor_create,
#endif
};
@@ -42,7 +43,7 @@ static const char *names[] = {
[SQFS_COMP_ZSTD] = "zstd",
};
-int generic_write_options(int fd, const void *data, size_t size)
+int sqfs_generic_write_options(int fd, const void *data, size_t size)
{
uint8_t buffer[size + 2];
@@ -57,7 +58,7 @@ int generic_write_options(int fd, const void *data, size_t size)
return sizeof(buffer);
}
-int generic_read_options(int fd, void *data, size_t size)
+int sqfs_generic_read_options(int fd, void *data, size_t size)
{
uint8_t buffer[size + 2];
@@ -76,7 +77,7 @@ int generic_read_options(int fd, void *data, size_t size)
return 0;
}
-bool compressor_exists(E_SQFS_COMPRESSOR id)
+bool sqfs_compressor_exists(E_SQFS_COMPRESSOR id)
{
if (id < SQFS_COMP_MIN || id > SQFS_COMP_MAX)
return false;
@@ -84,7 +85,7 @@ bool compressor_exists(E_SQFS_COMPRESSOR id)
return (compressors[id] != NULL);
}
-compressor_t *compressor_create(const compressor_config_t *cfg)
+sqfs_compressor_t *sqfs_compressor_create(const sqfs_compressor_config_t *cfg)
{
if (cfg == NULL || cfg->id < SQFS_COMP_MIN || cfg->id > SQFS_COMP_MAX)
return NULL;
@@ -95,7 +96,7 @@ compressor_t *compressor_create(const compressor_config_t *cfg)
return compressors[cfg->id](cfg);
}
-const char *compressor_name_from_id(E_SQFS_COMPRESSOR id)
+const char *sqfs_compressor_name_from_id(E_SQFS_COMPRESSOR id)
{
if (id < 0 || (size_t)id >= sizeof(names) / sizeof(names[0]))
return NULL;
@@ -103,7 +104,7 @@ const char *compressor_name_from_id(E_SQFS_COMPRESSOR id)
return names[id];
}
-int compressor_id_from_name(const char *name, E_SQFS_COMPRESSOR *out)
+int sqfs_compressor_id_from_name(const char *name, E_SQFS_COMPRESSOR *out)
{
size_t i;
@@ -117,8 +118,9 @@ int compressor_id_from_name(const char *name, E_SQFS_COMPRESSOR *out)
return -1;
}
-int compressor_config_init(compressor_config_t *cfg, E_SQFS_COMPRESSOR id,
- size_t block_size, uint16_t flags)
+int sqfs_compressor_config_init(sqfs_compressor_config_t *cfg,
+ E_SQFS_COMPRESSOR id,
+ size_t block_size, uint16_t flags)
{
memset(cfg, 0, sizeof(*cfg));
diff --git a/lib/sqfs/comp/gzip.c b/lib/sqfs/comp/gzip.c
index bbe1e4f..39e101f 100644
--- a/lib/sqfs/comp/gzip.c
+++ b/lib/sqfs/comp/gzip.c
@@ -22,7 +22,7 @@ typedef struct {
} gzip_options_t;
typedef struct {
- compressor_t base;
+ sqfs_compressor_t base;
z_stream strm;
bool compress;
@@ -31,7 +31,7 @@ typedef struct {
gzip_options_t opt;
} gzip_compressor_t;
-static void gzip_destroy(compressor_t *base)
+static void gzip_destroy(sqfs_compressor_t *base)
{
gzip_compressor_t *gzip = (gzip_compressor_t *)base;
@@ -44,7 +44,7 @@ static void gzip_destroy(compressor_t *base)
free(gzip);
}
-static int gzip_write_options(compressor_t *base, int fd)
+static int gzip_write_options(sqfs_compressor_t *base, int fd)
{
gzip_compressor_t *gzip = (gzip_compressor_t *)base;
gzip_options_t opt;
@@ -59,15 +59,15 @@ static int gzip_write_options(compressor_t *base, int fd)
opt.window = htole16(gzip->opt.window);
opt.strategies = htole16(gzip->opt.strategies);
- return generic_write_options(fd, &opt, sizeof(opt));
+ return sqfs_generic_write_options(fd, &opt, sizeof(opt));
}
-static int gzip_read_options(compressor_t *base, int fd)
+static int gzip_read_options(sqfs_compressor_t *base, int fd)
{
gzip_compressor_t *gzip = (gzip_compressor_t *)base;
gzip_options_t opt;
- if (generic_read_options(fd, &opt, sizeof(opt)))
+ if (sqfs_generic_read_options(fd, &opt, sizeof(opt)))
return -1;
gzip->opt.level = le32toh(opt.level);
@@ -161,7 +161,7 @@ static int find_strategy(gzip_compressor_t *gzip, const uint8_t *in,
return selected;
}
-static ssize_t gzip_do_block(compressor_t *base, const uint8_t *in,
+static ssize_t gzip_do_block(sqfs_compressor_t *base, const uint8_t *in,
size_t size, uint8_t *out, size_t outsize)
{
gzip_compressor_t *gzip = (gzip_compressor_t *)base;
@@ -222,7 +222,7 @@ static ssize_t gzip_do_block(compressor_t *base, const uint8_t *in,
return 0;
}
-static compressor_t *gzip_create_copy(compressor_t *cmp)
+static sqfs_compressor_t *gzip_create_copy(sqfs_compressor_t *cmp)
{
gzip_compressor_t *gzip = malloc(sizeof(*gzip));
int ret;
@@ -249,13 +249,13 @@ static compressor_t *gzip_create_copy(compressor_t *cmp)
return NULL;
}
- return (compressor_t *)gzip;
+ return (sqfs_compressor_t *)gzip;
}
-compressor_t *create_gzip_compressor(const compressor_config_t *cfg)
+sqfs_compressor_t *gzip_compressor_create(const sqfs_compressor_config_t *cfg)
{
gzip_compressor_t *gzip;
- compressor_t *base;
+ sqfs_compressor_t *base;
int ret;
if (cfg->flags & ~(SQFS_COMP_FLAG_GZIP_ALL |
@@ -282,7 +282,7 @@ compressor_t *create_gzip_compressor(const compressor_config_t *cfg)
}
gzip = calloc(1, sizeof(*gzip));
- base = (compressor_t *)gzip;
+ base = (sqfs_compressor_t *)gzip;
if (gzip == NULL) {
perror("creating gzip compressor");
diff --git a/lib/sqfs/comp/internal.h b/lib/sqfs/comp/internal.h
index 229772f..1f76a45 100644
--- a/lib/sqfs/comp/internal.h
+++ b/lib/sqfs/comp/internal.h
@@ -12,18 +12,18 @@
#include "sqfs/compress.h"
#include "util.h"
-int generic_write_options(int fd, const void *data, size_t size);
+int sqfs_generic_write_options(int fd, const void *data, size_t size);
-int generic_read_options(int fd, void *data, size_t size);
+int sqfs_generic_read_options(int fd, void *data, size_t size);
-compressor_t *create_xz_compressor(const compressor_config_t *cfg);
+sqfs_compressor_t *xz_compressor_create(const sqfs_compressor_config_t *cfg);
-compressor_t *create_gzip_compressor(const compressor_config_t *cfg);
+sqfs_compressor_t *gzip_compressor_create(const sqfs_compressor_config_t *cfg);
-compressor_t *create_lzo_compressor(const compressor_config_t *cfg);
+sqfs_compressor_t *lzo_compressor_create(const sqfs_compressor_config_t *cfg);
-compressor_t *create_lz4_compressor(const compressor_config_t *cfg);
+sqfs_compressor_t *lz4_compressor_create(const sqfs_compressor_config_t *cfg);
-compressor_t *create_zstd_compressor(const compressor_config_t *cfg);
+sqfs_compressor_t *zstd_compressor_create(const sqfs_compressor_config_t *cfg);
#endif /* INTERNAL_H */
diff --git a/lib/sqfs/comp/lz4.c b/lib/sqfs/comp/lz4.c
index 4a15198..ddfab5c 100644
--- a/lib/sqfs/comp/lz4.c
+++ b/lib/sqfs/comp/lz4.c
@@ -17,7 +17,7 @@
#include "internal.h"
typedef struct {
- compressor_t base;
+ sqfs_compressor_t base;
bool high_compression;
} lz4_compressor_t;
@@ -28,7 +28,7 @@ typedef struct {
#define LZ4LEGACY 1
-static int lz4_write_options(compressor_t *base, int fd)
+static int lz4_write_options(sqfs_compressor_t *base, int fd)
{
lz4_compressor_t *lz4 = (lz4_compressor_t *)base;
lz4_options opt = {
@@ -37,15 +37,15 @@ static int lz4_write_options(compressor_t *base, int fd)
SQFS_COMP_FLAG_LZ4_HC : 0),
};
- return generic_write_options(fd, &opt, sizeof(opt));
+ return sqfs_generic_write_options(fd, &opt, sizeof(opt));
}
-static int lz4_read_options(compressor_t *base, int fd)
+static int lz4_read_options(sqfs_compressor_t *base, int fd)
{
lz4_options opt;
(void)base;
- if (generic_read_options(fd, &opt, sizeof(opt)))
+ if (sqfs_generic_read_options(fd, &opt, sizeof(opt)))
return -1;
opt.version = le32toh(opt.version);
@@ -59,7 +59,7 @@ static int lz4_read_options(compressor_t *base, int fd)
return 0;
}
-static ssize_t lz4_comp_block(compressor_t *base, const uint8_t *in,
+static ssize_t lz4_comp_block(sqfs_compressor_t *base, const uint8_t *in,
size_t size, uint8_t *out, size_t outsize)
{
lz4_compressor_t *lz4 = (lz4_compressor_t *)base;
@@ -81,7 +81,7 @@ static ssize_t lz4_comp_block(compressor_t *base, const uint8_t *in,
return ret;
}
-static ssize_t lz4_uncomp_block(compressor_t *base, const uint8_t *in,
+static ssize_t lz4_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
size_t size, uint8_t *out, size_t outsize)
{
int ret;
@@ -97,7 +97,7 @@ static ssize_t lz4_uncomp_block(compressor_t *base, const uint8_t *in,
return ret;
}
-static compressor_t *lz4_create_copy(compressor_t *cmp)
+static sqfs_compressor_t *lz4_create_copy(sqfs_compressor_t *cmp)
{
lz4_compressor_t *lz4 = malloc(sizeof(*lz4));
@@ -107,18 +107,18 @@ static compressor_t *lz4_create_copy(compressor_t *cmp)
}
memcpy(lz4, cmp, sizeof(*lz4));
- return (compressor_t *)lz4;
+ return (sqfs_compressor_t *)lz4;
}
-static void lz4_destroy(compressor_t *base)
+static void lz4_destroy(sqfs_compressor_t *base)
{
free(base);
}
-compressor_t *create_lz4_compressor(const compressor_config_t *cfg)
+sqfs_compressor_t *lz4_compressor_create(const sqfs_compressor_config_t *cfg)
{
- lz4_compressor_t *lz4 = calloc(1, sizeof(*lz4));
- compressor_t *base = (compressor_t *)lz4;
+ sqfs_compressor_t *base;
+ lz4_compressor_t *lz4;
if (cfg->flags & ~(SQFS_COMP_FLAG_LZ4_ALL |
SQFS_COMP_FLAG_GENERIC_ALL)) {
@@ -127,7 +127,7 @@ compressor_t *create_lz4_compressor(const compressor_config_t *cfg)
}
lz4 = calloc(1, sizeof(*lz4));
- base = (compressor_t *)lz4;
+ base = (sqfs_compressor_t *)lz4;
if (lz4 == NULL) {
perror("creating lz4 compressor");
return NULL;
diff --git a/lib/sqfs/comp/lzo.c b/lib/sqfs/comp/lzo.c
index 3293af1..8512dfa 100644
--- a/lib/sqfs/comp/lzo.c
+++ b/lib/sqfs/comp/lzo.c
@@ -48,7 +48,7 @@ static const struct {
};
typedef struct {
- compressor_t base;
+ sqfs_compressor_t base;
int algorithm;
int level;
@@ -60,7 +60,7 @@ typedef struct {
uint32_t level;
} lzo_options_t;
-static int lzo_write_options(compressor_t *base, int fd)
+static int lzo_write_options(sqfs_compressor_t *base, int fd)
{
lzo_compressor_t *lzo = (lzo_compressor_t *)base;
lzo_options_t opt;
@@ -78,15 +78,15 @@ static int lzo_write_options(compressor_t *base, int fd)
opt.level = 0;
}
- return generic_write_options(fd, &opt, sizeof(opt));
+ return sqfs_generic_write_options(fd, &opt, sizeof(opt));
}
-static int lzo_read_options(compressor_t *base, int fd)
+static int lzo_read_options(sqfs_compressor_t *base, int fd)
{
lzo_compressor_t *lzo = (lzo_compressor_t *)base;
lzo_options_t opt;
- if (generic_read_options(fd, &opt, sizeof(opt)))
+ if (sqfs_generic_read_options(fd, &opt, sizeof(opt)))
return -1;
lzo->algorithm = le32toh(opt.algorithm);
@@ -115,7 +115,7 @@ fail_level:
return -1;
}
-static ssize_t lzo_comp_block(compressor_t *base, const uint8_t *in,
+static ssize_t lzo_comp_block(sqfs_compressor_t *base, const uint8_t *in,
size_t size, uint8_t *out, size_t outsize)
{
lzo_compressor_t *lzo = (lzo_compressor_t *)base;
@@ -143,7 +143,7 @@ static ssize_t lzo_comp_block(compressor_t *base, const uint8_t *in,
return 0;
}
-static ssize_t lzo_uncomp_block(compressor_t *base, const uint8_t *in,
+static ssize_t lzo_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
size_t size, uint8_t *out, size_t outsize)
{
lzo_compressor_t *lzo = (lzo_compressor_t *)base;
@@ -160,7 +160,7 @@ static ssize_t lzo_uncomp_block(compressor_t *base, const uint8_t *in,
return len;
}
-static compressor_t *lzo_create_copy(compressor_t *cmp)
+static sqfs_compressor_t *lzo_create_copy(sqfs_compressor_t *cmp)
{
lzo_compressor_t *other = (lzo_compressor_t *)cmp;
lzo_compressor_t *lzo;
@@ -173,18 +173,18 @@ static compressor_t *lzo_create_copy(compressor_t *cmp)
}
memcpy(lzo, other, sizeof(*lzo));
- return (compressor_t *)lzo;
+ return (sqfs_compressor_t *)lzo;
}
-static void lzo_destroy(compressor_t *base)
+static void lzo_destroy(sqfs_compressor_t *base)
{
free(base);
}
-compressor_t *create_lzo_compressor(const compressor_config_t *cfg)
+sqfs_compressor_t *lzo_compressor_create(const sqfs_compressor_config_t *cfg)
{
+ sqfs_compressor_t *base;
lzo_compressor_t *lzo;
- compressor_t *base;
if (cfg->flags & ~SQFS_COMP_FLAG_GENERIC_ALL) {
fputs("creating lzo compressor: unknown compressor flags\n",
@@ -213,7 +213,7 @@ compressor_t *create_lzo_compressor(const compressor_config_t *cfg)
lzo = alloc_flex(sizeof(*lzo), 1,
lzo_algs[cfg->opt.lzo.algorithm].bufsize);
- base = (compressor_t *)lzo;
+ base = (sqfs_compressor_t *)lzo;
if (lzo == NULL) {
perror("creating lzo compressor");
diff --git a/lib/sqfs/comp/xz.c b/lib/sqfs/comp/xz.c
index 4f67b1c..6598de7 100644
--- a/lib/sqfs/comp/xz.c
+++ b/lib/sqfs/comp/xz.c
@@ -16,7 +16,7 @@
#include "internal.h"
typedef struct {
- compressor_t base;
+ sqfs_compressor_t base;
size_t block_size;
size_t dict_size;
int flags;
@@ -37,7 +37,7 @@ static bool is_dict_size_valid(size_t size)
return size == (x | (x >> 1));
}
-static int xz_write_options(compressor_t *base, int fd)
+static int xz_write_options(sqfs_compressor_t *base, int fd)
{
xz_compressor_t *xz = (xz_compressor_t *)base;
xz_options_t opt;
@@ -48,15 +48,15 @@ static int xz_write_options(compressor_t *base, int fd)
opt.dict_size = htole32(xz->dict_size);
opt.flags = htole32(xz->flags);
- return generic_write_options(fd, &opt, sizeof(opt));
+ return sqfs_generic_write_options(fd, &opt, sizeof(opt));
}
-static int xz_read_options(compressor_t *base, int fd)
+static int xz_read_options(sqfs_compressor_t *base, int fd)
{
xz_compressor_t *xz = (xz_compressor_t *)base;
xz_options_t opt;
- if (generic_read_options(fd, &opt, sizeof(opt)))
+ if (sqfs_generic_read_options(fd, &opt, sizeof(opt)))
return -1;
opt.dict_size = le32toh(opt.dict_size);
@@ -142,8 +142,8 @@ static lzma_vli flag_to_vli(int flag)
return LZMA_VLI_UNKNOWN;
}
-static ssize_t xz_comp_block(compressor_t *base, const uint8_t *in,
- size_t size, uint8_t *out, size_t outsize)
+static ssize_t xz_comp_block(sqfs_compressor_t *base, const uint8_t *in,
+ size_t size, uint8_t *out, size_t outsize)
{
xz_compressor_t *xz = (xz_compressor_t *)base;
lzma_vli filter, selected = LZMA_VLI_UNKNOWN;
@@ -178,7 +178,7 @@ static ssize_t xz_comp_block(compressor_t *base, const uint8_t *in,
return compress(xz, selected, in, size, out, outsize);
}
-static ssize_t xz_uncomp_block(compressor_t *base, const uint8_t *in,
+static ssize_t xz_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
size_t size, uint8_t *out, size_t outsize)
{
uint64_t memlimit = 32 * 1024 * 1024;
@@ -198,7 +198,7 @@ static ssize_t xz_uncomp_block(compressor_t *base, const uint8_t *in,
return -1;
}
-static compressor_t *xz_create_copy(compressor_t *cmp)
+static sqfs_compressor_t *xz_create_copy(sqfs_compressor_t *cmp)
{
xz_compressor_t *xz = malloc(sizeof(*xz));
@@ -208,18 +208,18 @@ static compressor_t *xz_create_copy(compressor_t *cmp)
}
memcpy(xz, cmp, sizeof(*xz));
- return (compressor_t *)xz;
+ return (sqfs_compressor_t *)xz;
}
-static void xz_destroy(compressor_t *base)
+static void xz_destroy(sqfs_compressor_t *base)
{
free(base);
}
-compressor_t *create_xz_compressor(const compressor_config_t *cfg)
+sqfs_compressor_t *xz_compressor_create(const sqfs_compressor_config_t *cfg)
{
+ sqfs_compressor_t *base;
xz_compressor_t *xz;
- compressor_t *base;
if (cfg->flags & ~(SQFS_COMP_FLAG_GENERIC_ALL |
SQFS_COMP_FLAG_XZ_ALL)) {
@@ -235,7 +235,7 @@ compressor_t *create_xz_compressor(const compressor_config_t *cfg)
}
xz = calloc(1, sizeof(*xz));
- base = (compressor_t *)xz;
+ base = (sqfs_compressor_t *)xz;
if (xz == NULL) {
perror("creating xz compressor");
return NULL;
diff --git a/lib/sqfs/comp/zstd.c b/lib/sqfs/comp/zstd.c
index c805524..bd90207 100644
--- a/lib/sqfs/comp/zstd.c
+++ b/lib/sqfs/comp/zstd.c
@@ -17,7 +17,7 @@
#include "internal.h"
typedef struct {
- compressor_t base;
+ sqfs_compressor_t base;
ZSTD_CCtx *zctx;
int level;
} zstd_compressor_t;
@@ -26,7 +26,7 @@ typedef struct {
uint32_t level;
} zstd_options_t;
-static int zstd_write_options(compressor_t *base, int fd)
+static int zstd_write_options(sqfs_compressor_t *base, int fd)
{
zstd_compressor_t *zstd = (zstd_compressor_t *)base;
zstd_options_t opt;
@@ -36,22 +36,22 @@ static int zstd_write_options(compressor_t *base, int fd)
return 0;
opt.level = htole32(zstd->level);
- return generic_write_options(fd, &opt, sizeof(opt));
+ return sqfs_generic_write_options(fd, &opt, sizeof(opt));
}
-static int zstd_read_options(compressor_t *base, int fd)
+static int zstd_read_options(sqfs_compressor_t *base, int fd)
{
zstd_options_t opt;
(void)base;
- if (generic_read_options(fd, &opt, sizeof(opt)))
+ if (sqfs_generic_read_options(fd, &opt, sizeof(opt)))
return -1;
opt.level = le32toh(opt.level);
return 0;
}
-static ssize_t zstd_comp_block(compressor_t *base, const uint8_t *in,
+static ssize_t zstd_comp_block(sqfs_compressor_t *base, const uint8_t *in,
size_t size, uint8_t *out, size_t outsize)
{
zstd_compressor_t *zstd = (zstd_compressor_t *)base;
@@ -69,7 +69,7 @@ static ssize_t zstd_comp_block(compressor_t *base, const uint8_t *in,
return ret < size ? ret : 0;
}
-static ssize_t zstd_uncomp_block(compressor_t *base, const uint8_t *in,
+static ssize_t zstd_uncomp_block(sqfs_compressor_t *base, const uint8_t *in,
size_t size, uint8_t *out, size_t outsize)
{
size_t ret;
@@ -86,7 +86,7 @@ static ssize_t zstd_uncomp_block(compressor_t *base, const uint8_t *in,
return ret;
}
-static compressor_t *zstd_create_copy(compressor_t *cmp)
+static sqfs_compressor_t *zstd_create_copy(sqfs_compressor_t *cmp)
{
zstd_compressor_t *zstd = malloc(sizeof(*zstd));
@@ -106,10 +106,10 @@ static compressor_t *zstd_create_copy(compressor_t *cmp)
return NULL;
}
- return (compressor_t *)zstd;
+ return (sqfs_compressor_t *)zstd;
}
-static void zstd_destroy(compressor_t *base)
+static void zstd_destroy(sqfs_compressor_t *base)
{
zstd_compressor_t *zstd = (zstd_compressor_t *)base;
@@ -117,10 +117,10 @@ static void zstd_destroy(compressor_t *base)
free(zstd);
}
-compressor_t *create_zstd_compressor(const compressor_config_t *cfg)
+sqfs_compressor_t *zstd_compressor_create(const sqfs_compressor_config_t *cfg)
{
zstd_compressor_t *zstd;
- compressor_t *base;
+ sqfs_compressor_t *base;
if (cfg->flags & ~SQFS_COMP_FLAG_GENERIC_ALL) {
fputs("creating zstd compressor: unknown compressor flags\n",
@@ -133,7 +133,7 @@ compressor_t *create_zstd_compressor(const compressor_config_t *cfg)
}
zstd = calloc(1, sizeof(*zstd));
- base = (compressor_t *)zstd;
+ base = (sqfs_compressor_t *)zstd;
if (zstd == NULL) {
perror("creating zstd compressor");
return NULL;
diff --git a/lib/sqfs/id_table.c b/lib/sqfs/id_table.c
index 2b8044c..6d76f52 100644
--- a/lib/sqfs/id_table.c
+++ b/lib/sqfs/id_table.c
@@ -83,7 +83,7 @@ int sqfs_id_table_index_to_id(const sqfs_id_table_t *tbl, uint16_t index,
}
int sqfs_id_table_read(sqfs_id_table_t *tbl, int fd, sqfs_super_t *super,
- compressor_t *cmp)
+ sqfs_compressor_t *cmp)
{
uint64_t upper_limit, lower_limit;
size_t i;
@@ -128,7 +128,7 @@ int sqfs_id_table_read(sqfs_id_table_t *tbl, int fd, sqfs_super_t *super,
}
int sqfs_id_table_write(sqfs_id_table_t *tbl, int outfd, sqfs_super_t *super,
- compressor_t *cmp)
+ sqfs_compressor_t *cmp)
{
uint64_t start;
size_t i;
diff --git a/lib/sqfs/meta_reader.c b/lib/sqfs/meta_reader.c
index 0fd892e..ac71d1c 100644
--- a/lib/sqfs/meta_reader.c
+++ b/lib/sqfs/meta_reader.c
@@ -32,7 +32,7 @@ struct sqfs_meta_reader_t {
int fd;
/* A pointer to the compressor to use for extracting data */
- compressor_t *cmp;
+ sqfs_compressor_t *cmp;
/* The raw data read from the input file */
uint8_t data[SQFS_META_BLOCK_SIZE];
@@ -41,7 +41,7 @@ struct sqfs_meta_reader_t {
uint8_t scratch[SQFS_META_BLOCK_SIZE];
};
-sqfs_meta_reader_t *sqfs_meta_reader_create(int fd, compressor_t *cmp,
+sqfs_meta_reader_t *sqfs_meta_reader_create(int fd, sqfs_compressor_t *cmp,
uint64_t start, uint64_t limit)
{
sqfs_meta_reader_t *m = calloc(1, sizeof(*m));
diff --git a/lib/sqfs/meta_writer.c b/lib/sqfs/meta_writer.c
index c85a12e..af73de3 100644
--- a/lib/sqfs/meta_writer.c
+++ b/lib/sqfs/meta_writer.c
@@ -33,7 +33,7 @@ struct sqfs_meta_writer_t {
int outfd;
/* A pointer to the compressor to use for compressing the data */
- compressor_t *cmp;
+ sqfs_compressor_t *cmp;
/* The raw data chunk that data is appended to */
uint8_t data[SQFS_META_BLOCK_SIZE];
@@ -51,7 +51,7 @@ static int write_block(int fd, meta_block_t *outblk)
outblk->data, count + 2);
}
-sqfs_meta_writer_t *sqfs_meta_writer_create(int fd, compressor_t *cmp,
+sqfs_meta_writer_t *sqfs_meta_writer_create(int fd, sqfs_compressor_t *cmp,
bool keep_in_mem)
{
sqfs_meta_writer_t *m = calloc(1, sizeof(*m));
diff --git a/lib/sqfs/process_block.c b/lib/sqfs/process_block.c
index b0c8a91..5233ce1 100644
--- a/lib/sqfs/process_block.c
+++ b/lib/sqfs/process_block.c
@@ -12,7 +12,7 @@
#include <string.h>
#include <zlib.h>
-int sqfs_block_process(sqfs_block_t *block, compressor_t *cmp,
+int sqfs_block_process(sqfs_block_t *block, sqfs_compressor_t *cmp,
uint8_t *scratch, size_t scratch_size)
{
ssize_t ret;
diff --git a/lib/sqfs/read_table.c b/lib/sqfs/read_table.c
index 1470fac..fec71a5 100644
--- a/lib/sqfs/read_table.c
+++ b/lib/sqfs/read_table.c
@@ -14,7 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
-void *sqfs_read_table(int fd, compressor_t *cmp, size_t table_size,
+void *sqfs_read_table(int fd, sqfs_compressor_t *cmp, size_t table_size,
uint64_t location, uint64_t lower_limit,
uint64_t upper_limit)
{
diff --git a/lib/sqfs/write_table.c b/lib/sqfs/write_table.c
index 7c24087..513a38d 100644
--- a/lib/sqfs/write_table.c
+++ b/lib/sqfs/write_table.c
@@ -14,7 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
-int sqfs_write_table(int outfd, sqfs_super_t *super, compressor_t *cmp,
+int sqfs_write_table(int outfd, sqfs_super_t *super, sqfs_compressor_t *cmp,
const void *data, size_t table_size, uint64_t *start)
{
size_t block_count, list_size, diff, blkidx = 0;
diff --git a/lib/sqfs/xattr_reader.c b/lib/sqfs/xattr_reader.c
index d7bcbf7..60ffc58 100644
--- a/lib/sqfs/xattr_reader.c
+++ b/lib/sqfs/xattr_reader.c
@@ -256,7 +256,7 @@ void sqfs_xattr_reader_destroy(sqfs_xattr_reader_t *xr)
}
sqfs_xattr_reader_t *sqfs_xattr_reader_create(int sqfsfd, sqfs_super_t *super,
- compressor_t *cmp)
+ sqfs_compressor_t *cmp)
{
sqfs_xattr_reader_t *xr = calloc(1, sizeof(*xr));