~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/lib/xz/xz_private.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /lib/xz/xz_private.h (Version linux-6.11-rc3) and /lib/xz/xz_private.h (Version linux-4.10.17)


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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php