diff options
Diffstat (limited to 'linux/lib')
-rw-r--r-- | linux/lib/decompress_unxz.c | 44 | ||||
-rw-r--r-- | linux/lib/xz/xz_crc32.c | 5 | ||||
-rw-r--r-- | linux/lib/xz/xz_dec_bcj.c | 22 | ||||
-rw-r--r-- | linux/lib/xz/xz_dec_lzma2.c | 62 | ||||
-rw-r--r-- | linux/lib/xz/xz_dec_stream.c | 31 | ||||
-rw-r--r-- | linux/lib/xz/xz_lzma2.h | 12 | ||||
-rw-r--r-- | linux/lib/xz/xz_private.h | 14 |
7 files changed, 88 insertions, 102 deletions
diff --git a/linux/lib/decompress_unxz.c b/linux/lib/decompress_unxz.c index 35fb5e1..076ed98 100644 --- a/linux/lib/decompress_unxz.c +++ b/linux/lib/decompress_unxz.c @@ -95,36 +95,22 @@ /* * STATIC is defined to "static" if we are being built for kernel - * decompression (pre-boot code). <linux/decompress/mm.h> below will - * define STATIC to empty if it wasn't already defined. Since we will - * need to know if we are being used for kernel decompression, we define + * decompression (pre-boot code). <linux/decompress/mm.h> will define + * STATIC to empty if it wasn't already defined. Since we will need to + * know later if we are being used for kernel decompression, we define * XZ_PREBOOT here. */ #ifdef STATIC # define XZ_PREBOOT #endif - #ifdef __KERNEL__ # include <linux/decompress/mm.h> -#else -# define STATIC static -#endif - -/* - * Set the linkage of normally extern functions to static. The only - * function that we might make extern is unxz(), and even that will - * depend on the STATIC macro. - */ -#define XZ_EXTERN static - -/* - * Use INIT defined in <linux/decompress/mm.h> to possibly add __init - * to every function. - */ -#ifdef INIT -# define XZ_FUNC INIT #endif +#define XZ_EXTERN STATIC +#ifndef XZ_PREBOOT +# include <linux/xz.h> +#else /* * Use the internal CRC32 code instead of kernel's CRC32 module, which * is not available in early phase of booting. @@ -153,9 +139,12 @@ # define XZ_DEC_SPARC #endif +/* + * This will get the basic headers so that memeq() and others + * can be defined. + */ #include "xz/xz_private.h" -#ifdef XZ_PREBOOT /* * Replace the normal allocation functions with the versions * from <linux/decompress/mm.h>. @@ -184,7 +173,7 @@ */ #ifndef memeq -static bool XZ_FUNC memeq(const void *a, const void *b, size_t size) +static bool memeq(const void *a, const void *b, size_t size) { const uint8_t *x = a; const uint8_t *y = b; @@ -199,7 +188,7 @@ static bool XZ_FUNC memeq(const void *a, const void *b, size_t size) #endif #ifndef memzero -static void XZ_FUNC memzero(void *buf, size_t size) +static void memzero(void *buf, size_t size) { uint8_t *b = buf; uint8_t *e = b + size; @@ -210,7 +199,7 @@ static void XZ_FUNC memzero(void *buf, size_t size) #ifndef memmove /* Not static to avoid a conflict with the prototype in the Linux headers. */ -void * XZ_FUNC memmove(void *dest, const void *src, size_t size) +void *memmove(void *dest, const void *src, size_t size) { uint8_t *d = dest; const uint8_t *s = src; @@ -238,13 +227,14 @@ void * XZ_FUNC memmove(void *dest, const void *src, size_t size) # define memcpy memmove #endif */ -#endif /* XZ_PREBOOT */ #include "xz/xz_crc32.c" #include "xz/xz_dec_stream.c" #include "xz/xz_dec_lzma2.c" #include "xz/xz_dec_bcj.c" +#endif /* XZ_PREBOOT */ + /* Size of the input and output buffers in multi-call mode */ #define XZ_IOBUF_SIZE 4096 @@ -256,7 +246,7 @@ void * XZ_FUNC memmove(void *dest, const void *src, size_t size) * both input and output buffers are available as a single chunk, i.e. when * fill() and flush() won't be used. */ -STATIC int XZ_FUNC unxz(/*const*/ unsigned char *in, int in_size, +STATIC int INIT unxz(/*const*/ unsigned char *in, int in_size, int (*fill)(void *dest, unsigned int size), int (*flush)(/*const*/ void *src, unsigned int size), unsigned char *out, int *in_used, diff --git a/linux/lib/xz/xz_crc32.c b/linux/lib/xz/xz_crc32.c index eea7b33..eb37d19 100644 --- a/linux/lib/xz/xz_crc32.c +++ b/linux/lib/xz/xz_crc32.c @@ -19,7 +19,7 @@ static uint32_t xz_crc32_table[256]; -XZ_EXTERN void XZ_FUNC xz_crc32_init(void) +XZ_EXTERN void xz_crc32_init(void) { const uint32_t poly = 0xEDB88320; @@ -38,8 +38,7 @@ XZ_EXTERN void XZ_FUNC xz_crc32_init(void) return; } -XZ_EXTERN uint32_t XZ_FUNC xz_crc32( - const uint8_t *buf, size_t size, uint32_t crc) +XZ_EXTERN uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc) { crc = ~crc; diff --git a/linux/lib/xz/xz_dec_bcj.c b/linux/lib/xz/xz_dec_bcj.c index 09162b5..f104b20 100644 --- a/linux/lib/xz/xz_dec_bcj.c +++ b/linux/lib/xz/xz_dec_bcj.c @@ -82,7 +82,7 @@ struct xz_dec_bcj { */ #define bcj_x86_test_msbyte(b) ((b) == 0x00 || (b) == 0xFF) -static noinline_for_stack size_t XZ_FUNC bcj_x86( +static noinline_for_stack size_t bcj_x86( struct xz_dec_bcj *s, uint8_t *buf, size_t size) { static const bool mask_to_allowed_status[8] @@ -155,7 +155,7 @@ static noinline_for_stack size_t XZ_FUNC bcj_x86( #endif #ifdef XZ_DEC_POWERPC -static noinline_for_stack size_t XZ_FUNC bcj_powerpc( +static noinline_for_stack size_t bcj_powerpc( struct xz_dec_bcj *s, uint8_t *buf, size_t size) { size_t i; @@ -177,7 +177,7 @@ static noinline_for_stack size_t XZ_FUNC bcj_powerpc( #endif #ifdef XZ_DEC_IA64 -static noinline_for_stack size_t XZ_FUNC bcj_ia64( +static noinline_for_stack size_t bcj_ia64( struct xz_dec_bcj *s, uint8_t *buf, size_t size) { static const uint8_t branch_table[32] = { @@ -262,7 +262,7 @@ static noinline_for_stack size_t XZ_FUNC bcj_ia64( #endif #ifdef XZ_DEC_ARM -static noinline_for_stack size_t XZ_FUNC bcj_arm( +static noinline_for_stack size_t bcj_arm( struct xz_dec_bcj *s, uint8_t *buf, size_t size) { size_t i; @@ -286,7 +286,7 @@ static noinline_for_stack size_t XZ_FUNC bcj_arm( #endif #ifdef XZ_DEC_ARMTHUMB -static noinline_for_stack size_t XZ_FUNC bcj_armthumb( +static noinline_for_stack size_t bcj_armthumb( struct xz_dec_bcj *s, uint8_t *buf, size_t size) { size_t i; @@ -315,7 +315,7 @@ static noinline_for_stack size_t XZ_FUNC bcj_armthumb( #endif #ifdef XZ_DEC_SPARC -static noinline_for_stack size_t XZ_FUNC bcj_sparc( +static noinline_for_stack size_t bcj_sparc( struct xz_dec_bcj *s, uint8_t *buf, size_t size) { size_t i; @@ -345,7 +345,7 @@ static noinline_for_stack size_t XZ_FUNC bcj_sparc( * pointers, which could be problematic in the kernel boot code, which must * avoid pointers to static data (at least on x86). */ -static void XZ_FUNC bcj_apply(struct xz_dec_bcj *s, +static void bcj_apply(struct xz_dec_bcj *s, uint8_t *buf, size_t *pos, size_t size) { size_t filtered; @@ -399,7 +399,7 @@ static void XZ_FUNC bcj_apply(struct xz_dec_bcj *s, * Move the remaining mixture of possibly filtered and unfiltered * data to the beginning of temp. */ -static void XZ_FUNC bcj_flush(struct xz_dec_bcj *s, struct xz_buf *b) +static void bcj_flush(struct xz_dec_bcj *s, struct xz_buf *b) { size_t copy_size; @@ -417,7 +417,7 @@ static void XZ_FUNC bcj_flush(struct xz_dec_bcj *s, struct xz_buf *b) * data in chunks of 1-16 bytes. To hide this issue, this function does * some buffering. */ -XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_bcj_run(struct xz_dec_bcj *s, +XZ_EXTERN enum xz_ret xz_dec_bcj_run(struct xz_dec_bcj *s, struct xz_dec_lzma2 *lzma2, struct xz_buf *b) { size_t out_start; @@ -513,7 +513,7 @@ XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_bcj_run(struct xz_dec_bcj *s, return s->ret; } -XZ_EXTERN struct xz_dec_bcj * XZ_FUNC xz_dec_bcj_create(bool single_call) +XZ_EXTERN struct xz_dec_bcj *xz_dec_bcj_create(bool single_call) { struct xz_dec_bcj *s = kmalloc(sizeof(*s), GFP_KERNEL); if (s != NULL) @@ -522,7 +522,7 @@ XZ_EXTERN struct xz_dec_bcj * XZ_FUNC xz_dec_bcj_create(bool single_call) return s; } -XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_bcj_reset( +XZ_EXTERN enum xz_ret xz_dec_bcj_reset( struct xz_dec_bcj *s, uint8_t id) { switch (id) { diff --git a/linux/lib/xz/xz_dec_lzma2.c b/linux/lib/xz/xz_dec_lzma2.c index ad36e29..3b8ccfc 100644 --- a/linux/lib/xz/xz_dec_lzma2.c +++ b/linux/lib/xz/xz_dec_lzma2.c @@ -283,7 +283,7 @@ struct xz_dec_lzma2 { * Reset the dictionary state. When in single-call mode, set up the beginning * of the dictionary to point to the actual output buffer. */ -static void XZ_FUNC dict_reset(struct dictionary *dict, struct xz_buf *b) +static void dict_reset(struct dictionary *dict, struct xz_buf *b) { if (DEC_IS_SINGLE(dict->mode)) { dict->buf = b->out + b->out_pos; @@ -297,7 +297,7 @@ static void XZ_FUNC dict_reset(struct dictionary *dict, struct xz_buf *b) } /* Set dictionary write limit */ -static void XZ_FUNC dict_limit(struct dictionary *dict, size_t out_max) +static void dict_limit(struct dictionary *dict, size_t out_max) { if (dict->end - dict->pos <= out_max) dict->limit = dict->end; @@ -306,7 +306,7 @@ static void XZ_FUNC dict_limit(struct dictionary *dict, size_t out_max) } /* Return true if at least one byte can be written into the dictionary. */ -static inline bool XZ_FUNC dict_has_space(const struct dictionary *dict) +static inline bool dict_has_space(const struct dictionary *dict) { return dict->pos < dict->limit; } @@ -317,8 +317,7 @@ static inline bool XZ_FUNC dict_has_space(const struct dictionary *dict) * still empty. This special case is needed for single-call decoding to * avoid writing a '\0' to the end of the destination buffer. */ -static inline uint32_t XZ_FUNC dict_get( - const struct dictionary *dict, uint32_t dist) +static inline uint32_t dict_get(const struct dictionary *dict, uint32_t dist) { size_t offset = dict->pos - dist - 1; @@ -331,7 +330,7 @@ static inline uint32_t XZ_FUNC dict_get( /* * Put one byte into the dictionary. It is assumed that there is space for it. */ -static inline void XZ_FUNC dict_put(struct dictionary *dict, uint8_t byte) +static inline void dict_put(struct dictionary *dict, uint8_t byte) { dict->buf[dict->pos++] = byte; @@ -344,8 +343,7 @@ static inline void XZ_FUNC dict_put(struct dictionary *dict, uint8_t byte) * invalid, false is returned. On success, true is returned and *len is * updated to indicate how many bytes were left to be repeated. */ -static bool XZ_FUNC dict_repeat( - struct dictionary *dict, uint32_t *len, uint32_t dist) +static bool dict_repeat(struct dictionary *dict, uint32_t *len, uint32_t dist) { size_t back; uint32_t left; @@ -373,7 +371,7 @@ static bool XZ_FUNC dict_repeat( } /* Copy uncompressed data as is from input to dictionary and output buffers. */ -static void XZ_FUNC dict_uncompressed( +static void dict_uncompressed( struct dictionary *dict, struct xz_buf *b, uint32_t *left) { size_t copy_size; @@ -416,7 +414,7 @@ static void XZ_FUNC dict_uncompressed( * enough space in b->out. This is guaranteed because caller uses dict_limit() * before decoding data into the dictionary. */ -static uint32_t XZ_FUNC dict_flush(struct dictionary *dict, struct xz_buf *b) +static uint32_t dict_flush(struct dictionary *dict, struct xz_buf *b) { size_t copy_size = dict->pos - dict->start; @@ -438,7 +436,7 @@ static uint32_t XZ_FUNC dict_flush(struct dictionary *dict, struct xz_buf *b) *****************/ /* Reset the range decoder. */ -static void XZ_FUNC rc_reset(struct rc_dec *rc) +static void rc_reset(struct rc_dec *rc) { rc->range = (uint32_t)-1; rc->code = 0; @@ -449,7 +447,7 @@ static void XZ_FUNC rc_reset(struct rc_dec *rc) * Read the first five initial bytes into rc->code if they haven't been * read already. (Yes, the first byte gets completely ignored.) */ -static bool XZ_FUNC rc_read_init(struct rc_dec *rc, struct xz_buf *b) +static bool rc_read_init(struct rc_dec *rc, struct xz_buf *b) { while (rc->init_bytes_left > 0) { if (b->in_pos == b->in_size) @@ -463,7 +461,7 @@ static bool XZ_FUNC rc_read_init(struct rc_dec *rc, struct xz_buf *b) } /* Return true if there may not be enough input for the next decoding loop. */ -static inline bool XZ_FUNC rc_limit_exceeded(const struct rc_dec *rc) +static inline bool rc_limit_exceeded(const struct rc_dec *rc) { return rc->in_pos > rc->in_limit; } @@ -472,13 +470,13 @@ static inline bool XZ_FUNC rc_limit_exceeded(const struct rc_dec *rc) * Return true if it is possible (from point of view of range decoder) that * we have reached the end of the LZMA chunk. */ -static inline bool XZ_FUNC rc_is_finished(const struct rc_dec *rc) +static inline bool rc_is_finished(const struct rc_dec *rc) { return rc->code == 0; } /* Read the next input byte if needed. */ -static __always_inline void XZ_FUNC rc_normalize(struct rc_dec *rc) +static __always_inline void rc_normalize(struct rc_dec *rc) { if (rc->range < RC_TOP_VALUE) { rc->range <<= RC_SHIFT_BITS; @@ -497,7 +495,7 @@ static __always_inline void XZ_FUNC rc_normalize(struct rc_dec *rc) * of the code generated by GCC 3.x decreases 10-15 %. (GCC 4.3 doesn't care, * and it generates 10-20 % faster code than GCC 3.x from this file anyway.) */ -static __always_inline int XZ_FUNC rc_bit(struct rc_dec *rc, uint16_t *prob) +static __always_inline int rc_bit(struct rc_dec *rc, uint16_t *prob) { uint32_t bound; int bit; @@ -519,7 +517,7 @@ static __always_inline int XZ_FUNC rc_bit(struct rc_dec *rc, uint16_t *prob) } /* Decode a bittree starting from the most significant bit. */ -static __always_inline uint32_t XZ_FUNC rc_bittree( +static __always_inline uint32_t rc_bittree( struct rc_dec *rc, uint16_t *probs, uint32_t limit) { uint32_t symbol = 1; @@ -535,7 +533,7 @@ static __always_inline uint32_t XZ_FUNC rc_bittree( } /* Decode a bittree starting from the least significant bit. */ -static __always_inline void XZ_FUNC rc_bittree_reverse(struct rc_dec *rc, +static __always_inline void rc_bittree_reverse(struct rc_dec *rc, uint16_t *probs, uint32_t *dest, uint32_t limit) { uint32_t symbol = 1; @@ -552,7 +550,7 @@ static __always_inline void XZ_FUNC rc_bittree_reverse(struct rc_dec *rc, } /* Decode direct bits (fixed fifty-fifty probability) */ -static inline void XZ_FUNC rc_direct( +static inline void rc_direct( struct rc_dec *rc, uint32_t *dest, uint32_t limit) { uint32_t mask; @@ -572,7 +570,7 @@ static inline void XZ_FUNC rc_direct( ********/ /* Get pointer to literal coder probability array. */ -static uint16_t * XZ_FUNC lzma_literal_probs(struct xz_dec_lzma2 *s) +static uint16_t *lzma_literal_probs(struct xz_dec_lzma2 *s) { uint32_t prev_byte = dict_get(&s->dict, 0); uint32_t low = prev_byte >> (8 - s->lzma.lc); @@ -581,7 +579,7 @@ static uint16_t * XZ_FUNC lzma_literal_probs(struct xz_dec_lzma2 *s) } /* Decode a literal (one 8-bit byte) */ -static void XZ_FUNC lzma_literal(struct xz_dec_lzma2 *s) +static void lzma_literal(struct xz_dec_lzma2 *s) { uint16_t *probs; uint32_t symbol; @@ -619,7 +617,7 @@ static void XZ_FUNC lzma_literal(struct xz_dec_lzma2 *s) } /* Decode the length of the match into s->lzma.len. */ -static void XZ_FUNC lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l, +static void lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l, uint32_t pos_state) { uint16_t *probs; @@ -646,7 +644,7 @@ static void XZ_FUNC lzma_len(struct xz_dec_lzma2 *s, struct lzma_len_dec *l, } /* Decode a match. The distance will be stored in s->lzma.rep0. */ -static void XZ_FUNC lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state) +static void lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state) { uint16_t *probs; uint32_t dist_slot; @@ -688,7 +686,7 @@ static void XZ_FUNC lzma_match(struct xz_dec_lzma2 *s, uint32_t pos_state) * Decode a repeated match. The distance is one of the four most recently * seen matches. The distance will be stored in s->lzma.rep0. */ -static void XZ_FUNC lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state) +static void lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state) { uint32_t tmp; @@ -722,7 +720,7 @@ static void XZ_FUNC lzma_rep_match(struct xz_dec_lzma2 *s, uint32_t pos_state) } /* LZMA decoder core */ -static bool XZ_FUNC lzma_main(struct xz_dec_lzma2 *s) +static bool lzma_main(struct xz_dec_lzma2 *s) { uint32_t pos_state; @@ -767,7 +765,7 @@ static bool XZ_FUNC lzma_main(struct xz_dec_lzma2 *s) * Reset the LZMA decoder and range decoder state. Dictionary is nore reset * here, because LZMA state may be reset without resetting the dictionary. */ -static void XZ_FUNC lzma_reset(struct xz_dec_lzma2 *s) +static void lzma_reset(struct xz_dec_lzma2 *s) { uint16_t *probs; size_t i; @@ -799,7 +797,7 @@ static void XZ_FUNC lzma_reset(struct xz_dec_lzma2 *s) * from the decoded lp and pb values. On success, the LZMA decoder state is * reset and true is returned. */ -static bool XZ_FUNC lzma_props(struct xz_dec_lzma2 *s, uint8_t props) +static bool lzma_props(struct xz_dec_lzma2 *s, uint8_t props) { if (props > (4 * 5 + 4) * 9 + 8) return false; @@ -846,7 +844,7 @@ static bool XZ_FUNC lzma_props(struct xz_dec_lzma2 *s, uint8_t props) * function. We decode a few bytes from the temporary buffer so that we can * continue decoding from the caller-supplied input buffer again. */ -static bool XZ_FUNC lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b) +static bool lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b) { size_t in_avail; uint32_t tmp; @@ -931,7 +929,7 @@ static bool XZ_FUNC lzma2_lzma(struct xz_dec_lzma2 *s, struct xz_buf *b) * Take care of the LZMA2 control layer, and forward the job of actual LZMA * decoding or copying of uncompressed chunks to other functions. */ -XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_run( +XZ_EXTERN enum xz_ret xz_dec_lzma2_run( struct xz_dec_lzma2 *s, struct xz_buf *b) { uint32_t tmp; @@ -1104,7 +1102,7 @@ XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_run( return XZ_OK; } -XZ_EXTERN struct xz_dec_lzma2 * XZ_FUNC xz_dec_lzma2_create( +XZ_EXTERN struct xz_dec_lzma2 *xz_dec_lzma2_create( enum xz_mode mode, uint32_t dict_max) { struct xz_dec_lzma2 *s = kmalloc(sizeof(*s), GFP_KERNEL); @@ -1128,7 +1126,7 @@ XZ_EXTERN struct xz_dec_lzma2 * XZ_FUNC xz_dec_lzma2_create( return s; } -XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_reset( +XZ_EXTERN enum xz_ret xz_dec_lzma2_reset( struct xz_dec_lzma2 *s, uint8_t props) { /* This limits dictionary size to 3 GiB to keep parsing simpler. */ @@ -1166,7 +1164,7 @@ XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_reset( return XZ_OK; } -XZ_EXTERN void XZ_FUNC xz_dec_lzma2_end(struct xz_dec_lzma2 *s) +XZ_EXTERN void xz_dec_lzma2_end(struct xz_dec_lzma2 *s) { if (DEC_IS_MULTI(s->dict.mode)) vfree(s->dict.buf); diff --git a/linux/lib/xz/xz_dec_stream.c b/linux/lib/xz/xz_dec_stream.c index bdcbf1b..144a2b8 100644 --- a/linux/lib/xz/xz_dec_stream.c +++ b/linux/lib/xz/xz_dec_stream.c @@ -154,7 +154,7 @@ static const uint8_t check_sizes[16] = { * to copy into s->temp.buf. Return true once s->temp.pos has reached * s->temp.size. */ -static bool XZ_FUNC fill_temp(struct xz_dec *s, struct xz_buf *b) +static bool fill_temp(struct xz_dec *s, struct xz_buf *b) { size_t copy_size = min_t(size_t, b->in_size - b->in_pos, s->temp.size - s->temp.pos); @@ -172,7 +172,7 @@ static bool XZ_FUNC fill_temp(struct xz_dec *s, struct xz_buf *b) } /* Decode a variable-length integer (little-endian base-128 encoding) */ -static enum xz_ret XZ_FUNC dec_vli(struct xz_dec *s, +static enum xz_ret dec_vli(struct xz_dec *s, const uint8_t *in, size_t *in_pos, size_t in_size) { uint8_t byte; @@ -215,7 +215,7 @@ static enum xz_ret XZ_FUNC dec_vli(struct xz_dec *s, * the sizes possibly stored in the Block Header. Update the hash and * Block count, which are later used to validate the Index field. */ -static enum xz_ret XZ_FUNC dec_block(struct xz_dec *s, struct xz_buf *b) +static enum xz_ret dec_block(struct xz_dec *s, struct xz_buf *b) { enum xz_ret ret; @@ -278,7 +278,7 @@ static enum xz_ret XZ_FUNC dec_block(struct xz_dec *s, struct xz_buf *b) } /* Update the Index size and the CRC32 value. */ -static void XZ_FUNC index_update(struct xz_dec *s, const struct xz_buf *b) +static void index_update(struct xz_dec *s, const struct xz_buf *b) { size_t in_used = b->in_pos - s->in_start; s->index.size += in_used; @@ -293,7 +293,7 @@ static void XZ_FUNC index_update(struct xz_dec *s, const struct xz_buf *b) * This can return XZ_OK (more input needed), XZ_STREAM_END (everything * successfully decoded), or XZ_DATA_ERROR (input is corrupt). */ -static enum xz_ret XZ_FUNC dec_index(struct xz_dec *s, struct xz_buf *b) +static enum xz_ret dec_index(struct xz_dec *s, struct xz_buf *b) { enum xz_ret ret; @@ -343,7 +343,7 @@ static enum xz_ret XZ_FUNC dec_index(struct xz_dec *s, struct xz_buf *b) * Validate that the next four input bytes match the value of s->crc32. * s->pos must be zero when starting to validate the first byte. */ -static enum xz_ret XZ_FUNC crc32_validate(struct xz_dec *s, struct xz_buf *b) +static enum xz_ret crc32_validate(struct xz_dec *s, struct xz_buf *b) { do { if (b->in_pos == b->in_size) @@ -367,7 +367,7 @@ static enum xz_ret XZ_FUNC crc32_validate(struct xz_dec *s, struct xz_buf *b) * Skip over the Check field when the Check ID is not supported. * Returns true once the whole Check field has been skipped over. */ -static bool XZ_FUNC check_skip(struct xz_dec *s, struct xz_buf *b) +static bool check_skip(struct xz_dec *s, struct xz_buf *b) { while (s->pos < check_sizes[s->check_type]) { if (b->in_pos == b->in_size) @@ -384,7 +384,7 @@ static bool XZ_FUNC check_skip(struct xz_dec *s, struct xz_buf *b) #endif /* Decode the Stream Header field (the first 12 bytes of the .xz Stream). */ -static enum xz_ret XZ_FUNC dec_stream_header(struct xz_dec *s) +static enum xz_ret dec_stream_header(struct xz_dec *s) { if (!memeq(s->temp.buf, HEADER_MAGIC, HEADER_MAGIC_SIZE)) return XZ_FORMAT_ERROR; @@ -419,7 +419,7 @@ static enum xz_ret XZ_FUNC dec_stream_header(struct xz_dec *s) } /* Decode the Stream Footer field (the last 12 bytes of the .xz Stream) */ -static enum xz_ret XZ_FUNC dec_stream_footer(struct xz_dec *s) +static enum xz_ret dec_stream_footer(struct xz_dec *s) { if (!memeq(s->temp.buf + 10, FOOTER_MAGIC, FOOTER_MAGIC_SIZE)) return XZ_DATA_ERROR; @@ -446,7 +446,7 @@ static enum xz_ret XZ_FUNC dec_stream_footer(struct xz_dec *s) } /* Decode the Block Header and initialize the filter chain. */ -static enum xz_ret XZ_FUNC dec_block_header(struct xz_dec *s) +static enum xz_ret dec_block_header(struct xz_dec *s) { enum xz_ret ret; @@ -546,7 +546,7 @@ static enum xz_ret XZ_FUNC dec_block_header(struct xz_dec *s) return XZ_OK; } -static enum xz_ret XZ_FUNC dec_main(struct xz_dec *s, struct xz_buf *b) +static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b) { enum xz_ret ret; @@ -731,7 +731,7 @@ static enum xz_ret XZ_FUNC dec_main(struct xz_dec *s, struct xz_buf *b) * actually succeeds (that's the price to pay of using the output buffer as * the workspace). */ -XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_run(struct xz_dec *s, struct xz_buf *b) +XZ_EXTERN enum xz_ret xz_dec_run(struct xz_dec *s, struct xz_buf *b) { size_t in_start; size_t out_start; @@ -767,8 +767,7 @@ XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_run(struct xz_dec *s, struct xz_buf *b) return ret; } -XZ_EXTERN struct xz_dec * XZ_FUNC xz_dec_init( - enum xz_mode mode, uint32_t dict_max) +XZ_EXTERN struct xz_dec *xz_dec_init(enum xz_mode mode, uint32_t dict_max) { struct xz_dec *s = kmalloc(sizeof(*s), GFP_KERNEL); if (s == NULL) @@ -798,7 +797,7 @@ error_bcj: return NULL; } -XZ_EXTERN void XZ_FUNC xz_dec_reset(struct xz_dec *s) +XZ_EXTERN void xz_dec_reset(struct xz_dec *s) { s->sequence = SEQ_STREAM_HEADER; s->allow_buf_error = false; @@ -810,7 +809,7 @@ XZ_EXTERN void XZ_FUNC xz_dec_reset(struct xz_dec *s) s->temp.size = STREAM_HEADER_SIZE; } -XZ_EXTERN void XZ_FUNC xz_dec_end(struct xz_dec *s) +XZ_EXTERN void xz_dec_end(struct xz_dec *s) { if (s != NULL) { xz_dec_lzma2_end(s->lzma2); diff --git a/linux/lib/xz/xz_lzma2.h b/linux/lib/xz/xz_lzma2.h index 47f21af..071d67b 100644 --- a/linux/lib/xz/xz_lzma2.h +++ b/linux/lib/xz/xz_lzma2.h @@ -61,7 +61,7 @@ enum lzma_state { #define LIT_STATES 7 /* Indicate that the latest symbol was a literal. */ -static inline void XZ_FUNC lzma_state_literal(enum lzma_state *state) +static inline void lzma_state_literal(enum lzma_state *state) { if (*state <= STATE_SHORTREP_LIT_LIT) *state = STATE_LIT_LIT; @@ -72,25 +72,25 @@ static inline void XZ_FUNC lzma_state_literal(enum lzma_state *state) } /* Indicate that the latest symbol was a match. */ -static inline void XZ_FUNC lzma_state_match(enum lzma_state *state) +static inline void lzma_state_match(enum lzma_state *state) { *state = *state < LIT_STATES ? STATE_LIT_MATCH : STATE_NONLIT_MATCH; } /* Indicate that the latest state was a long repeated match. */ -static inline void XZ_FUNC lzma_state_long_rep(enum lzma_state *state) +static inline void lzma_state_long_rep(enum lzma_state *state) { *state = *state < LIT_STATES ? STATE_LIT_LONGREP : STATE_NONLIT_REP; } /* Indicate that the latest symbol was a short match. */ -static inline void XZ_FUNC lzma_state_short_rep(enum lzma_state *state) +static inline void lzma_state_short_rep(enum lzma_state *state) { *state = *state < LIT_STATES ? STATE_LIT_SHORTREP : STATE_NONLIT_REP; } /* Test if the previous symbol was a literal. */ -static inline bool XZ_FUNC lzma_state_is_literal(enum lzma_state state) +static inline bool lzma_state_is_literal(enum lzma_state state) { return state < LIT_STATES; } @@ -144,7 +144,7 @@ static inline bool XZ_FUNC lzma_state_is_literal(enum lzma_state state) * Get the index of the appropriate probability array for decoding * the distance slot. */ -static inline uint32_t XZ_FUNC lzma_get_dist_state(uint32_t len) +static inline uint32_t lzma_get_dist_state(uint32_t len) { return len < DIST_STATES + MATCH_LEN_MIN ? len - MATCH_LEN_MIN : DIST_STATES - 1; diff --git a/linux/lib/xz/xz_private.h b/linux/lib/xz/xz_private.h index 145649a..213d026 100644 --- a/linux/lib/xz/xz_private.h +++ b/linux/lib/xz/xz_private.h @@ -109,7 +109,7 @@ * Allocate memory for LZMA2 decoder. xz_dec_lzma2_reset() must be used * before calling xz_dec_lzma2_run(). */ -XZ_EXTERN struct xz_dec_lzma2 * XZ_FUNC xz_dec_lzma2_create( +XZ_EXTERN struct xz_dec_lzma2 *xz_dec_lzma2_create( enum xz_mode mode, uint32_t dict_max); /* @@ -118,22 +118,22 @@ XZ_EXTERN struct xz_dec_lzma2 * XZ_FUNC xz_dec_lzma2_create( * big enough, and XZ_OPTIONS_ERROR if props indicates something that this * decoder doesn't support. */ -XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_reset( +XZ_EXTERN enum xz_ret xz_dec_lzma2_reset( struct xz_dec_lzma2 *s, uint8_t props); /* Decode raw LZMA2 stream from b->in to b->out. */ -XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_lzma2_run( +XZ_EXTERN enum xz_ret xz_dec_lzma2_run( struct xz_dec_lzma2 *s, struct xz_buf *b); /* Free the memory allocated for the LZMA2 decoder. */ -XZ_EXTERN void XZ_FUNC xz_dec_lzma2_end(struct xz_dec_lzma2 *s); +XZ_EXTERN void xz_dec_lzma2_end(struct xz_dec_lzma2 *s); #ifdef XZ_DEC_BCJ /* * Allocate memory for BCJ decoders. xz_dec_bcj_reset() must be used before * calling xz_dec_bcj_run(). */ -XZ_EXTERN struct xz_dec_bcj * XZ_FUNC xz_dec_bcj_create(bool single_call); +XZ_EXTERN struct xz_dec_bcj *xz_dec_bcj_create(bool single_call); /* * Decode the Filter ID of a BCJ filter. This implementation doesn't @@ -141,7 +141,7 @@ XZ_EXTERN struct xz_dec_bcj * XZ_FUNC xz_dec_bcj_create(bool single_call); * is needed. Returns XZ_OK if the given Filter ID is supported. * Otherwise XZ_OPTIONS_ERROR is returned. */ -XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_bcj_reset( +XZ_EXTERN enum xz_ret xz_dec_bcj_reset( struct xz_dec_bcj *s, uint8_t id); /* @@ -149,7 +149,7 @@ XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_bcj_reset( * a BCJ filter in the chain. If the chain has only LZMA2, xz_dec_lzma2_run() * must be called directly. */ -XZ_EXTERN enum xz_ret XZ_FUNC xz_dec_bcj_run(struct xz_dec_bcj *s, +XZ_EXTERN enum xz_ret xz_dec_bcj_run(struct xz_dec_bcj *s, struct xz_dec_lzma2 *lzma2, struct xz_buf *b); /* Free the memory allocated for the BCJ filters. */ |