From 61c822900e8907e28ef6dca326835692ae6d18ca Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 26 Aug 2015 12:53:41 +0200 Subject: cbfstool: add decompression wrappers ... and document the interface. Change-Id: I86a071a61fd6c1ef842f8ffe51f12f0cefdaf2fe Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/11362 Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) --- util/cbfstool/common.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'util/cbfstool/common.h') diff --git a/util/cbfstool/common.h b/util/cbfstool/common.h index 5fb19065df..4a97fed6cb 100644 --- a/util/cbfstool/common.h +++ b/util/cbfstool/common.h @@ -146,10 +146,24 @@ void buffer_delete(struct buffer *buffer); const char *arch_to_string(uint32_t a); uint32_t string_to_arch(const char *arch_string); -typedef int (*comp_func_ptr) (char *, int, char *, int *); +/* Compress in_len bytes from in, storing the result at out, returning the + * resulting length in out_len. + * Returns 0 on error, + * != 0 otherwise, depending on the compressing function. + */ +typedef int (*comp_func_ptr) (char *in, int in_len, char *out, int *out_len); + +/* Decompress in_len bytes from in, storing the result at out, up to out_len + * bytes. + * Returns 0 on error, + * != 0 otherwise, depending on the decompressing function. + */ +typedef int (*decomp_func_ptr) (char *in, int in_len, char *out, int out_len); + enum comp_algo { CBFS_COMPRESS_NONE = 0, CBFS_COMPRESS_LZMA = 1 }; comp_func_ptr compression_function(enum comp_algo algo); +decomp_func_ptr decompression_function(enum comp_algo algo); uint64_t intfiletype(const char *name); -- cgit v1.2.3