summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--difftool/super.c4
-rw-r--r--include/data_reader.h2
-rw-r--r--include/data_writer.h2
-rw-r--r--include/highlevel.h15
-rw-r--r--include/sqfs/block_processor.h4
-rw-r--r--include/sqfs/compress.h39
-rw-r--r--include/sqfs/id_table.h4
-rw-r--r--include/sqfs/meta_reader.h2
-rw-r--r--include/sqfs/meta_writer.h2
-rw-r--r--include/sqfs/table.h4
-rw-r--r--include/sqfs/xattr.h2
-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
-rw-r--r--lib/sqfshelper/comp_opt.c9
-rw-r--r--lib/sqfshelper/compress.c10
-rw-r--r--lib/sqfshelper/data_reader.c4
-rw-r--r--lib/sqfshelper/data_writer.c4
-rw-r--r--lib/sqfshelper/deserialize_fstree.c4
-rw-r--r--lib/sqfshelper/serialize_fstree.c2
-rw-r--r--lib/sqfshelper/sqfs_reader.c12
-rw-r--r--lib/sqfshelper/write_export_table.c2
-rw-r--r--lib/sqfshelper/write_xattr.c2
-rw-r--r--mkfs/mkfs.c6
-rw-r--r--mkfs/options.c6
-rw-r--r--tar/tar2sqfs.c10
39 files changed, 181 insertions, 174 deletions
diff --git a/difftool/super.c b/difftool/super.c
index 85c4a1f..14609dc 100644
--- a/difftool/super.c
+++ b/difftool/super.c
@@ -100,8 +100,8 @@ int compare_super_blocks(const sqfs_super_t *a, const sqfs_super_t *b)
if (a->compression_id != b->compression_id) {
fprintf(stdout, "compressor: %s vs %s\n",
- compressor_name_from_id(a->compression_id),
- compressor_name_from_id(b->compression_id));
+ sqfs_compressor_name_from_id(a->compression_id),
+ sqfs_compressor_name_from_id(b->compression_id));
}
print_flag_diff(a->flags, b->flags);
diff --git a/include/data_reader.h b/include/data_reader.h
index feba7a1..a45c3e2 100644
--- a/include/data_reader.h
+++ b/include/data_reader.h
@@ -24,7 +24,7 @@ typedef struct data_reader_t data_reader_t;
Prints error messsages to stderr on failure.
*/
data_reader_t *data_reader_create(int fd, sqfs_super_t *super,
- compressor_t *cmp);
+ sqfs_compressor_t *cmp);
void data_reader_destroy(data_reader_t *data);
diff --git a/include/data_writer.h b/include/data_writer.h
index 081c468..89eb2c8 100644
--- a/include/data_writer.h
+++ b/include/data_writer.h
@@ -35,7 +35,7 @@ enum {
Returns NULL on failure and prints errors to stderr.
*/
-data_writer_t *data_writer_create(sqfs_super_t *super, compressor_t *cmp,
+data_writer_t *data_writer_create(sqfs_super_t *super, sqfs_compressor_t *cmp,
int outfd, size_t devblksize,
unsigned int num_jobs);
diff --git a/include/highlevel.h b/include/highlevel.h
index 701754a..ffcc44c 100644
--- a/include/highlevel.h
+++ b/include/highlevel.h
@@ -24,7 +24,7 @@
#include <stddef.h>
typedef struct {
- compressor_t *cmp;
+ sqfs_compressor_t *cmp;
data_reader_t *data;
sqfs_super_t super;
fstree_t fs;
@@ -53,7 +53,7 @@ enum RDTREE_FLAGS {
Returns 0 on success. Prints error messages to stderr on failure.
*/
int sqfs_serialize_fstree(int outfd, sqfs_super_t *super, fstree_t *fs,
- compressor_t *cmp, sqfs_id_table_t *idtbl);
+ sqfs_compressor_t *cmp, sqfs_id_table_t *idtbl);
/*
Convert a generic squashfs tree node to an fstree_t node.
@@ -71,8 +71,8 @@ tree_node_t *tree_node_from_inode(sqfs_inode_generic_t *inode,
Returns 0 on success. Prints error messages to stderr on failure.
*/
-int deserialize_fstree(fstree_t *out, sqfs_super_t *super, compressor_t *cmp,
- int fd, int flags);
+int deserialize_fstree(fstree_t *out, sqfs_super_t *super,
+ sqfs_compressor_t *cmp, int fd, int flags);
/*
Generate a squahfs xattr table from a file system tree.
@@ -80,7 +80,7 @@ int deserialize_fstree(fstree_t *out, sqfs_super_t *super, compressor_t *cmp,
Returns 0 on success. Prints error messages to stderr on failure.
*/
int write_xattr(int outfd, fstree_t *fs, sqfs_super_t *super,
- compressor_t *cmp);
+ sqfs_compressor_t *cmp);
/*
Generate an NFS export table.
@@ -88,7 +88,7 @@ int write_xattr(int outfd, fstree_t *fs, sqfs_super_t *super,
Returns 0 on success. Prints error messages to stderr on failure.
*/
int write_export_table(int outfd, fstree_t *fs, sqfs_super_t *super,
- compressor_t *cmp);
+ sqfs_compressor_t *cmp);
/* Print out fancy statistics for squashfs packing tools */
void sqfs_print_statistics(fstree_t *fs, sqfs_super_t *super);
@@ -107,7 +107,8 @@ void compressor_print_available(void);
E_SQFS_COMPRESSOR compressor_get_default(void);
-int compressor_cfg_init_options(compressor_config_t *cfg, E_SQFS_COMPRESSOR id,
+int compressor_cfg_init_options(sqfs_compressor_config_t *cfg,
+ E_SQFS_COMPRESSOR id,
size_t block_size, char *options);
void compressor_print_help(E_SQFS_COMPRESSOR id);
diff --git a/include/sqfs/block_processor.h b/include/sqfs/block_processor.h
index 552bd89..bde0a2e 100644
--- a/include/sqfs/block_processor.h
+++ b/include/sqfs/block_processor.h
@@ -68,7 +68,7 @@ extern "C" {
#endif
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);
@@ -99,7 +99,7 @@ int sqfs_block_processor_finish(sqfs_block_processor_t *proc);
Convenience function to process a data block. Returns 0 on success,
prints to stderr on failure.
*/
-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);
#ifdef __cplusplus
diff --git a/include/sqfs/compress.h b/include/sqfs/compress.h
index cb3994f..c826c84 100644
--- a/include/sqfs/compress.h
+++ b/include/sqfs/compress.h
@@ -4,8 +4,8 @@
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#ifndef COMPRESS_H
-#define COMPRESS_H
+#ifndef SQFS_COMPRESS_H
+#define SQFS_COMPRESS_H
#include "config.h"
@@ -16,20 +16,22 @@
#include "sqfs/super.h"
-typedef struct compressor_t compressor_t;
+typedef struct sqfs_compressor_t sqfs_compressor_t;
/* Encapsultes a compressor with a simple interface to compress or
uncompress/extract blocks of data. */
-struct compressor_t {
+struct sqfs_compressor_t {
+ void (*destroy)(sqfs_compressor_t *cmp);
+
/* Write compressor options to the output file if necessary.
Returns the number of bytes written or -1 on failure.
Internally prints error messages to stderr. */
- int (*write_options)(compressor_t *cmp, int fd);
+ int (*write_options)(sqfs_compressor_t *cmp, int fd);
/* Read compressor options to the input file.
Returns zero on success, -1 on failure.
Internally prints error messages to stderr. */
- int (*read_options)(compressor_t *cmp, int fd);
+ int (*read_options)(sqfs_compressor_t *cmp, int fd);
/*
Compress or uncompress a chunk of data.
@@ -41,14 +43,12 @@ struct compressor_t {
Internally prints compressor specific error messages to stderr.
*/
- ssize_t (*do_block)(compressor_t *cmp, const uint8_t *in, size_t size,
- uint8_t *out, size_t outsize);
+ ssize_t (*do_block)(sqfs_compressor_t *cmp, const uint8_t *in,
+ size_t size, uint8_t *out, size_t outsize);
/* create another compressor just like this one, i.e.
with the exact same settings */
- compressor_t *(*create_copy)(compressor_t *cmp);
-
- void (*destroy)(compressor_t *stream);
+ sqfs_compressor_t *(*create_copy)(sqfs_compressor_t *cmp);
};
typedef struct {
@@ -75,7 +75,7 @@ typedef struct {
uint32_t dict_size;
} xz;
} opt;
-} compressor_config_t;
+} sqfs_compressor_config_t;
typedef enum {
SQFS_COMP_FLAG_LZ4_HC = 0x0001,
@@ -132,19 +132,20 @@ typedef enum {
extern "C" {
#endif
-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);
-bool compressor_exists(E_SQFS_COMPRESSOR id);
+bool sqfs_compressor_exists(E_SQFS_COMPRESSOR id);
-compressor_t *compressor_create(const compressor_config_t *cfg);
+sqfs_compressor_t *sqfs_compressor_create(const sqfs_compressor_config_t *cfg);
-const char *compressor_name_from_id(E_SQFS_COMPRESSOR id);
+const char *sqfs_compressor_name_from_id(E_SQFS_COMPRESSOR 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);
#ifdef __cplusplus
}
#endif
-#endif /* COMPRESS_H */
+#endif /* SQFS_COMPRESS_H */
diff --git a/include/sqfs/id_table.h b/include/sqfs/id_table.h
index 65e77bc..0e652ec 100644
--- a/include/sqfs/id_table.h
+++ b/include/sqfs/id_table.h
@@ -32,12 +32,12 @@ int sqfs_id_table_id_to_index(sqfs_id_table_t *tbl, uint32_t id, uint16_t *out);
/* Write an ID table to a SquashFS image.
Returns 0 on success. Internally prints error message to stderr. */
int sqfs_id_table_write(sqfs_id_table_t *tbl, int outfd, sqfs_super_t *super,
- compressor_t *cmp);
+ sqfs_compressor_t *cmp);
/* Read an ID table from a SquashFS image.
Returns 0 on success. Internally prints error messages to stderr. */
int sqfs_id_table_read(sqfs_id_table_t *tbl, int fd, sqfs_super_t *super,
- compressor_t *cmp);
+ sqfs_compressor_t *cmp);
int sqfs_id_table_index_to_id(const sqfs_id_table_t *tbl, uint16_t index,
uint32_t *out);
diff --git a/include/sqfs/meta_reader.h b/include/sqfs/meta_reader.h
index 1517e67..6f0d184 100644
--- a/include/sqfs/meta_reader.h
+++ b/include/sqfs/meta_reader.h
@@ -24,7 +24,7 @@ extern "C" {
Start offset and limit can be specified to do bounds checking against
a subregion of the filesystem image.
*/
-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);
void sqfs_meta_reader_destroy(sqfs_meta_reader_t *m);
diff --git a/include/sqfs/meta_writer.h b/include/sqfs/meta_writer.h
index a155f3e..bb14993 100644
--- a/include/sqfs/meta_writer.h
+++ b/include/sqfs/meta_writer.h
@@ -24,7 +24,7 @@ extern "C" {
If keep_in_mem is true, the blocks are collected in memory and must
be explicitly flushed to disk using meta_write_write_to_file.
*/
-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);
void sqfs_meta_writer_destroy(sqfs_meta_writer_t *m);
diff --git a/include/sqfs/table.h b/include/sqfs/table.h
index bc4c7e8..b5eeb54 100644
--- a/include/sqfs/table.h
+++ b/include/sqfs/table.h
@@ -28,10 +28,10 @@ extern "C" {
Returns 0 on success. Internally prints error messages to stderr.
*/
-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);
-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/include/sqfs/xattr.h b/include/sqfs/xattr.h
index fb855f5..5350534 100644
--- a/include/sqfs/xattr.h
+++ b/include/sqfs/xattr.h
@@ -65,7 +65,7 @@ bool sqfs_has_xattr(const char *key);
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);
int sqfs_xattr_reader_get_desc(sqfs_xattr_reader_t *xr, uint32_t idx,
sqfs_xattr_id_t *desc);
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));
diff --git a/lib/sqfshelper/comp_opt.c b/lib/sqfshelper/comp_opt.c
index 1f3fabf..c942d23 100644
--- a/lib/sqfshelper/comp_opt.c
+++ b/lib/sqfshelper/comp_opt.c
@@ -47,7 +47,7 @@ static const char *lzo_algs[] = {
[SQFS_LZO1X_999] = "lzo1x_999",
};
-static int set_flag(compressor_config_t *cfg, const char *name,
+static int set_flag(sqfs_compressor_config_t *cfg, const char *name,
const flag_t *flags, size_t num_flags)
{
size_t i;
@@ -62,7 +62,7 @@ static int set_flag(compressor_config_t *cfg, const char *name,
return -1;
}
-static int find_lzo_alg(compressor_config_t *cfg, const char *name)
+static int find_lzo_alg(sqfs_compressor_config_t *cfg, const char *name)
{
size_t i;
@@ -123,7 +123,8 @@ static char *const token[] = {
NULL
};
-int compressor_cfg_init_options(compressor_config_t *cfg, E_SQFS_COMPRESSOR id,
+int compressor_cfg_init_options(sqfs_compressor_config_t *cfg,
+ E_SQFS_COMPRESSOR id,
size_t block_size, char *options)
{
size_t num_flags = 0, min_level = 0, max_level = 0, level;
@@ -131,7 +132,7 @@ int compressor_cfg_init_options(compressor_config_t *cfg, E_SQFS_COMPRESSOR id,
char *subopts, *value;
int i, opt;
- if (compressor_config_init(cfg, id, block_size, 0))
+ if (sqfs_compressor_config_init(cfg, id, block_size, 0))
return -1;
if (options == NULL)
diff --git a/lib/sqfshelper/compress.c b/lib/sqfshelper/compress.c
index 3d53e9e..9f89e45 100644
--- a/lib/sqfshelper/compress.c
+++ b/lib/sqfshelper/compress.c
@@ -8,10 +8,10 @@
E_SQFS_COMPRESSOR compressor_get_default(void)
{
- if (compressor_exists(SQFS_COMP_XZ))
+ if (sqfs_compressor_exists(SQFS_COMP_XZ))
return SQFS_COMP_XZ;
- if (compressor_exists(SQFS_COMP_ZSTD))
+ if (sqfs_compressor_exists(SQFS_COMP_ZSTD))
return SQFS_COMP_ZSTD;
return SQFS_COMP_GZIP;
@@ -24,10 +24,10 @@ void compressor_print_available(void)
fputs("Available compressors:\n", stdout);
for (i = SQFS_COMP_MIN; i <= SQFS_COMP_MAX; ++i) {
- if (compressor_exists(i))
- printf("\t%s\n", compressor_name_from_id(i));
+ if (sqfs_compressor_exists(i))
+ printf("\t%s\n", sqfs_compressor_name_from_id(i));
}
printf("\nDefault compressor: %s\n",
- compressor_name_from_id(compressor_get_default()));
+ sqfs_compressor_name_from_id(compressor_get_default()));
}
diff --git a/lib/sqfshelper/data_reader.c b/lib/sqfshelper/data_reader.c
index 4ad6266..f7984b8 100644
--- a/lib/sqfshelper/data_reader.c
+++ b/lib/sqfshelper/data_reader.c
@@ -23,7 +23,7 @@ struct data_reader_t {
off_t current_block;
- compressor_t *cmp;
+ sqfs_compressor_t *cmp;
size_t block_size;
int sqfsfd;
@@ -105,7 +105,7 @@ static int precache_fragment_block(data_reader_t *data, size_t idx)
}
data_reader_t *data_reader_create(int fd, sqfs_super_t *super,
- compressor_t *cmp)
+ sqfs_compressor_t *cmp)
{
data_reader_t *data = alloc_flex(sizeof(*data), super->block_size, 3);
size_t i, size;
diff --git a/lib/sqfshelper/data_writer.c b/lib/sqfshelper/data_writer.c
index c41088a..62e3e2a 100644
--- a/lib/sqfshelper/data_writer.c
+++ b/lib/sqfshelper/data_writer.c
@@ -29,7 +29,7 @@ struct data_writer_t {
off_t start;
sqfs_block_processor_t *proc;
- compressor_t *cmp;
+ sqfs_compressor_t *cmp;
file_info_t *list;
sqfs_super_t *super;
int outfd;
@@ -488,7 +488,7 @@ int write_data_from_fd_condensed(data_writer_t *data, file_info_t *fi,
return 0;
}
-data_writer_t *data_writer_create(sqfs_super_t *super, compressor_t *cmp,
+data_writer_t *data_writer_create(sqfs_super_t *super, sqfs_compressor_t *cmp,
int outfd, size_t devblksize,
unsigned int num_jobs)
{
diff --git a/lib/sqfshelper/deserialize_fstree.c b/lib/sqfshelper/deserialize_fstree.c
index 8d3c916..a3cf44d 100644
--- a/lib/sqfshelper/deserialize_fstree.c
+++ b/lib/sqfshelper/deserialize_fstree.c
@@ -202,8 +202,8 @@ static int fill_dir(sqfs_meta_reader_t *ir, sqfs_meta_reader_t *dr,
return 0;
}
-int deserialize_fstree(fstree_t *out, sqfs_super_t *super, compressor_t *cmp,
- int fd, int flags)
+int deserialize_fstree(fstree_t *out, sqfs_super_t *super,
+ sqfs_compressor_t *cmp, int fd, int flags)
{
uint64_t block_start, limit;
sqfs_meta_reader_t *ir, *dr;
diff --git a/lib/sqfshelper/serialize_fstree.c b/lib/sqfshelper/serialize_fstree.c
index f400a53..dfadedd 100644
--- a/lib/sqfshelper/serialize_fstree.c
+++ b/lib/sqfshelper/serialize_fstree.c
@@ -42,7 +42,7 @@ static int write_dir_entries(sqfs_dir_writer_t *dirw, tree_node_t *node)
}
int sqfs_serialize_fstree(int outfd, sqfs_super_t *super, fstree_t *fs,
- compressor_t *cmp, sqfs_id_table_t *idtbl)
+ sqfs_compressor_t *cmp, sqfs_id_table_t *idtbl)
{
sqfs_inode_generic_t *inode;
sqfs_meta_writer_t *im, *dm;
diff --git a/lib/sqfshelper/sqfs_reader.c b/lib/sqfshelper/sqfs_reader.c
index 49e91f5..598b3c4 100644
--- a/lib/sqfshelper/sqfs_reader.c
+++ b/lib/sqfshelper/sqfs_reader.c
@@ -14,7 +14,7 @@
int sqfs_reader_open(sqfs_reader_t *rd, const char *filename, int rdtree_flags)
{
- compressor_config_t cfg;
+ sqfs_compressor_config_t cfg;
memset(rd, 0, sizeof(*rd));
@@ -27,16 +27,16 @@ int sqfs_reader_open(sqfs_reader_t *rd, const char *filename, int rdtree_flags)
if (sqfs_super_read(&rd->super, rd->sqfsfd))
goto fail_fd;
- if (!compressor_exists(rd->super.compression_id)) {
+ if (!sqfs_compressor_exists(rd->super.compression_id)) {
fprintf(stderr, "%s: unknown compressor used.\n", filename);
goto fail_fd;
}
- compressor_config_init(&cfg, rd->super.compression_id,
- rd->super.block_size,
- SQFS_COMP_FLAG_UNCOMPRESS);
+ sqfs_compressor_config_init(&cfg, rd->super.compression_id,
+ rd->super.block_size,
+ SQFS_COMP_FLAG_UNCOMPRESS);
- rd->cmp = compressor_create(&cfg);
+ rd->cmp = sqfs_compressor_create(&cfg);
if (rd->cmp == NULL)
goto fail_fd;
diff --git a/lib/sqfshelper/write_export_table.c b/lib/sqfshelper/write_export_table.c
index e42df15..b0ad4ce 100644
--- a/lib/sqfshelper/write_export_table.c
+++ b/lib/sqfshelper/write_export_table.c
@@ -13,7 +13,7 @@
#include <stdio.h>
int write_export_table(int outfd, fstree_t *fs, sqfs_super_t *super,
- compressor_t *cmp)
+ sqfs_compressor_t *cmp)
{
uint64_t *table, start;
size_t i, size;
diff --git a/lib/sqfshelper/write_xattr.c b/lib/sqfshelper/write_xattr.c
index 349b41d..6f71eeb 100644
--- a/lib/sqfshelper/write_xattr.c
+++ b/lib/sqfshelper/write_xattr.c
@@ -168,7 +168,7 @@ static uint64_t *create_ool_locations_table(fstree_t *fs)
}
int write_xattr(int outfd, fstree_t *fs, sqfs_super_t *super,
- compressor_t *cmp)
+ sqfs_compressor_t *cmp)
{
uint64_t kv_start, id_start, block, *tbl, *ool_locations;
size_t i = 0, count = 0, blocks;
diff --git a/mkfs/mkfs.c b/mkfs/mkfs.c
index abd7422..540dbea 100644
--- a/mkfs/mkfs.c
+++ b/mkfs/mkfs.c
@@ -93,11 +93,11 @@ static int read_fstree(fstree_t *fs, options_t *opt)
int main(int argc, char **argv)
{
int status = EXIT_FAILURE, ret;
- compressor_config_t cfg;
+ sqfs_compressor_config_t cfg;
+ sqfs_compressor_t *cmp;
sqfs_id_table_t *idtbl;
data_writer_t *data;
sqfs_super_t super;
- compressor_t *cmp;
options_t opt;
fstree_t fs;
int outfd;
@@ -151,7 +151,7 @@ int main(int argc, char **argv)
fstree_xattr_deduplicate(&fs);
- cmp = compressor_create(&cfg);
+ cmp = sqfs_compressor_create(&cfg);
if (cmp == NULL) {
fputs("Error creating compressor\n", stderr);
goto out_outfd;
diff --git a/mkfs/options.c b/mkfs/options.c
index fb50d7b..9e747d8 100644
--- a/mkfs/options.c
+++ b/mkfs/options.c
@@ -161,10 +161,12 @@ void process_command_line(options_t *opt, int argc, char **argv)
case 'c':
have_compressor = true;
- if (compressor_id_from_name(optarg, &opt->compressor))
+ if (sqfs_compressor_id_from_name(optarg,
+ &opt->compressor)) {
have_compressor = false;
+ }
- if (!compressor_exists(opt->compressor))
+ if (!sqfs_compressor_exists(opt->compressor))
have_compressor = false;
if (!have_compressor) {
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c
index 22b7cda..d2772e6 100644
--- a/tar/tar2sqfs.c
+++ b/tar/tar2sqfs.c
@@ -131,10 +131,10 @@ static void process_args(int argc, char **argv)
case 'c':
have_compressor = true;
- if (compressor_id_from_name(optarg, &comp_id))
+ if (sqfs_compressor_id_from_name(optarg, &comp_id))
have_compressor = false;
- if (!compressor_exists(comp_id))
+ if (!sqfs_compressor_exists(comp_id))
have_compressor = false;
if (!have_compressor) {
@@ -355,11 +355,11 @@ fail:
int main(int argc, char **argv)
{
int outfd, status = EXIT_SUCCESS;
- compressor_config_t cfg;
+ sqfs_compressor_config_t cfg;
+ sqfs_compressor_t *cmp;
sqfs_id_table_t *idtbl;
data_writer_t *data;
sqfs_super_t super;
- compressor_t *cmp;
fstree_t fs;
int ret;
@@ -379,7 +379,7 @@ int main(int argc, char **argv)
if (fstree_init(&fs, block_size, fs_defaults))
goto out_fd;
- cmp = compressor_create(&cfg);
+ cmp = sqfs_compressor_create(&cfg);
if (cmp == NULL) {
fputs("Error creating compressor\n", stderr);
goto out_fs;