summaryrefslogtreecommitdiff
path: root/include/sqfs/compress.h
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 /include/sqfs/compress.h
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 'include/sqfs/compress.h')
-rw-r--r--include/sqfs/compress.h39
1 files changed, 20 insertions, 19 deletions
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 */