summaryrefslogtreecommitdiff
path: root/include/compress.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/compress.h')
-rw-r--r--include/compress.h87
1 files changed, 20 insertions, 67 deletions
diff --git a/include/compress.h b/include/compress.h
index a8542f2..4c1ec8b 100644
--- a/include/compress.h
+++ b/include/compress.h
@@ -11,86 +11,39 @@
typedef struct compressor_t compressor_t;
-/**
- * @struct compressor_t
- *
- * @brief Encapsultes a compressor with a simple interface to compress or
- * uncompress/extract blocks of data
- */
+/* Encapsultes a compressor with a simple interface to compress or
+ uncompress/extract blocks of data. */
struct compressor_t {
- /**
- * @brief Write compressor options to the output file if necessary
- *
- * @param cmp A pointer to the compressor object
- * @param fd The file descriptor to write to
- *
- * @return The number of bytes written or -1 on failure
- */
+ /* 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);
- /**
- * @brief Read compressor options to the input file
- *
- * @param cmp A pointer to the compressor object
- * @param fd The file descriptor to write to
- *
- * @return Zero on success, -1 on failure
- */
+ /* 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);
- /**
- * @brief Compress or uncompress a chunk of data
- *
- * @param cmp A pointer to the compressor object
- * @param in A pointer to the input buffer
- * @param size The number of bytes in the input buffer to process
- * @param out A pointer to the output buffer
- * @param outsize The number of bytes available in the output buffer
- *
- * @return On success, the number of bytes written to the output
- * buffer, -1 on failure, 0 if the output buffer was too small.
- * The compressor also returns 0 if the compressed result ends
- * up larger than the original input.
- */
+ /*
+ Compress or uncompress a chunk of data.
+
+ Returns the number of bytes written to the output buffer, -1 on
+ failure or 0 if the output buffer was too small.
+ The compressor also returns 0 if the compressed result ends
+ up larger than the original input.
+
+ 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);
- /**
- * @brief Destroy a compressor object and free up all memory it uses
- *
- * @param cmp A pointer to the compressor object
- */
void (*destroy)(compressor_t *stream);
};
-/**
- * @brief Check if a given compressor is available
- *
- * @memberof compressor_t
- *
- * This function checks if a given compressor is available, since some
- * compressors may not be supported yet, or simply disabled in the
- * compile configuration.
- *
- * @param id A SquashFS compressor id
- *
- * @return true if the given compressor is available
- */
bool compressor_exists(E_SQFS_COMPRESSOR id);
-/**
- * @brief Create a compressor object
- *
- * @memberof compressor_t
- *
- * @param id A SquashFS compressor id
- * @param compress true if the resulting object should compress data, false
- * if it should actually extract already compressed blocks.
- * @param block_size The configured block size for the SquashFS image. May be
- * of interest to some compressors.
- *
- * @return A pointer to a new compressor object or NULL on failure.
- */
+/* block_size is the configured block size for the SquashFS image. Needed
+ by some compressors to set internal defaults. */
compressor_t *compressor_create(E_SQFS_COMPRESSOR id, bool compress,
size_t block_size);