diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-05 18:46:50 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-09-05 18:46:50 +0200 |
commit | 320ae4f8e752f6652c7b5c8201d7267cd4de17c1 (patch) | |
tree | 4423514c5433dc3b70e32fd5950a139827b94ac9 /lib/sqfs/comp/compressor.c | |
parent | f92cf3b98f51d355c92900f1d316b141b2b9d4fd (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/comp/compressor.c')
-rw-r--r-- | lib/sqfs/comp/compressor.c | 30 |
1 files changed, 16 insertions, 14 deletions
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)); |