1 /* 1 2 * Private includes and definitions 3 * 4 * Author: Lasse Collin <lasse.collin@tukaani. 5 * 6 * This file has been put into the public doma 7 * You can do whatever you want with this file 8 */ 9 10 #ifndef XZ_PRIVATE_H 11 #define XZ_PRIVATE_H 12 13 #ifdef __KERNEL__ 14 # include <linux/xz.h> 15 # include <linux/kernel.h> 16 # include <asm/unaligned.h> 17 /* XZ_PREBOOT may be defined only via 18 # ifndef XZ_PREBOOT 19 # include <linux/slab.h> 20 # include <linux/vmalloc.h> 21 # include <linux/string.h> 22 # ifdef CONFIG_XZ_DEC_X86 23 # define XZ_DEC_X86 24 # endif 25 # ifdef CONFIG_XZ_DEC_POWERPC 26 # define XZ_DEC_POWERPC 27 # endif 28 # ifdef CONFIG_XZ_DEC_IA64 29 # define XZ_DEC_IA64 30 # endif 31 # ifdef CONFIG_XZ_DEC_ARM 32 # define XZ_DEC_ARM 33 # endif 34 # ifdef CONFIG_XZ_DEC_ARMTHUMB 35 # define XZ_DEC_ARMTHUMB 36 # endif 37 # ifdef CONFIG_XZ_DEC_SPARC 38 # define XZ_DEC_SPARC 39 # endif 40 # ifdef CONFIG_XZ_DEC_MICROLZMA 41 # define XZ_DEC_MICROLZM 42 # endif 43 # define memeq(a, b, size) (memc 44 # define memzero(buf, size) mems 45 # endif 46 # define get_le32(p) le32_to_cpup((const 47 #else 48 /* 49 * For userspace builds, use a separat 50 * macros and functions. This makes it 51 * different environments and avoids c 52 */ 53 # include "xz_config.h" 54 #endif 55 56 /* If no specific decoding mode is requested, 57 #if !defined(XZ_DEC_SINGLE) && !defined(XZ_DEC 58 && !defined(XZ_DEC_DYNALLOC) 59 # define XZ_DEC_SINGLE 60 # define XZ_DEC_PREALLOC 61 # define XZ_DEC_DYNALLOC 62 #endif 63 64 /* 65 * The DEC_IS_foo(mode) macros are used in "if 66 * of the supported modes are enabled, these m 67 * false at compile time and thus allow the co 68 */ 69 #ifdef XZ_DEC_SINGLE 70 # define DEC_IS_SINGLE(mode) ((mode) == 71 #else 72 # define DEC_IS_SINGLE(mode) (false) 73 #endif 74 75 #ifdef XZ_DEC_PREALLOC 76 # define DEC_IS_PREALLOC(mode) ((mode) = 77 #else 78 # define DEC_IS_PREALLOC(mode) (false) 79 #endif 80 81 #ifdef XZ_DEC_DYNALLOC 82 # define DEC_IS_DYNALLOC(mode) ((mode) = 83 #else 84 # define DEC_IS_DYNALLOC(mode) (false) 85 #endif 86 87 #if !defined(XZ_DEC_SINGLE) 88 # define DEC_IS_MULTI(mode) (true) 89 #elif defined(XZ_DEC_PREALLOC) || defined(XZ_D 90 # define DEC_IS_MULTI(mode) ((mode) != X 91 #else 92 # define DEC_IS_MULTI(mode) (false) 93 #endif 94 95 /* 96 * If any of the BCJ filter decoders are wante 97 * XZ_DEC_BCJ is used to enable generic suppor 98 */ 99 #ifndef XZ_DEC_BCJ 100 # if defined(XZ_DEC_X86) || defined(XZ_D 101 || defined(XZ_DEC_IA64 102 || defined(XZ_DEC_ARM) 103 || defined(XZ_DEC_SPAR 104 # define XZ_DEC_BCJ 105 # endif 106 #endif 107 108 /* 109 * Allocate memory for LZMA2 decoder. xz_dec_l 110 * before calling xz_dec_lzma2_run(). 111 */ 112 XZ_EXTERN struct xz_dec_lzma2 *xz_dec_lzma2_cr 113 114 115 /* 116 * Decode the LZMA2 properties (one byte) and 117 * XZ_OK on success, XZ_MEMLIMIT_ERROR if the 118 * big enough, and XZ_OPTIONS_ERROR if props i 119 * decoder doesn't support. 120 */ 121 XZ_EXTERN enum xz_ret xz_dec_lzma2_reset(struc 122 uint8 123 124 /* Decode raw LZMA2 stream from b->in to b->ou 125 XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct 126 struct 127 128 /* Free the memory allocated for the LZMA2 dec 129 XZ_EXTERN void xz_dec_lzma2_end(struct xz_dec_ 130 131 #ifdef XZ_DEC_BCJ 132 /* 133 * Allocate memory for BCJ decoders. xz_dec_bc 134 * calling xz_dec_bcj_run(). 135 */ 136 XZ_EXTERN struct xz_dec_bcj *xz_dec_bcj_create 137 138 /* 139 * Decode the Filter ID of a BCJ filter. This 140 * support custom start offsets, so no decodin 141 * is needed. Returns XZ_OK if the given Filte 142 * Otherwise XZ_OPTIONS_ERROR is returned. 143 */ 144 XZ_EXTERN enum xz_ret xz_dec_bcj_reset(struct 145 146 /* 147 * Decode raw BCJ + LZMA2 stream. This must be 148 * a BCJ filter in the chain. If the chain has 149 * must be called directly. 150 */ 151 XZ_EXTERN enum xz_ret xz_dec_bcj_run(struct xz 152 struct xz 153 struct xz 154 155 /* Free the memory allocated for the BCJ filte 156 #define xz_dec_bcj_end(s) kfree(s) 157 #endif 158 159 #endif 160
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.