]> code.delx.au - refind/blob - filesystems/lzoconf.h
Previous commit broke loading of EFI drivers with SB active; fix it.
[refind] / filesystems / lzoconf.h
1 /*
2 * this file take from grub 2.0
3 * for btrfs UEFI driver
4 */
5
6 /* lzoconf.h -- configuration of the LZO data compression library
7
8 This file is part of the LZO real-time data compression library.
9
10 Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
11 Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
12 Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
13 Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
14 Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
15 Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
16 Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
17 Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
18 Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
19 Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
20 Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
21 Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
22 Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
23 Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
24 Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
25 Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
26 All Rights Reserved.
27
28 The LZO library is free software; you can redistribute it and/or
29 modify it under the terms of the GNU General Public License as
30 published by the Free Software Foundation; either version 2 of
31 the License, or (at your option) any later version.
32
33 The LZO library is distributed in the hope that it will be useful,
34 but WITHOUT ANY WARRANTY; without even the implied warranty of
35 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 GNU General Public License for more details.
37
38 You should have received a copy of the GNU General Public License
39 along with the LZO library; see the file COPYING.
40 If not, write to the Free Software Foundation, Inc.,
41 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
42
43 Markus F.X.J. Oberhumer
44 <markus@oberhumer.com>
45 http://www.oberhumer.com/opensource/lzo/
46 */
47
48
49 #ifndef __LZOCONF_H_INCLUDED
50 #define __LZOCONF_H_INCLUDED 1
51
52 #define LZO_VERSION 0x2050
53 #define LZO_VERSION_STRING "2.05"
54 #define LZO_VERSION_DATE "Apr 23 2011"
55
56 /* internal Autoconf configuration file - only used when building LZO */
57 #if defined(LZO_HAVE_CONFIG_H)
58 # include <config.h>
59 #endif
60 #include <limits.h>
61 #include <stddef.h>
62
63
64 /***********************************************************************
65 // LZO requires a conforming <limits.h>
66 ************************************************************************/
67
68 #if !defined(CHAR_BIT) || (CHAR_BIT != 8)
69 # error "invalid CHAR_BIT"
70 #endif
71 #if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
72 # error "check your compiler installation"
73 #endif
74 #if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
75 # error "your limits.h macros are broken"
76 #endif
77
78 /* get OS and architecture defines */
79 #ifndef __LZODEFS_H_INCLUDED
80 #include "lzodefs.h"
81 #endif
82
83
84 #ifdef __cplusplus
85 extern "C" {
86 #endif
87
88
89 /***********************************************************************
90 // some core defines
91 ************************************************************************/
92
93 #if !defined(LZO_UINT32_C)
94 # if (UINT_MAX < LZO_0xffffffffL)
95 # define LZO_UINT32_C(c) c ## UL
96 # else
97 # define LZO_UINT32_C(c) ((c) + 0U)
98 # endif
99 #endif
100
101 /* memory checkers */
102 #if !defined(__LZO_CHECKER)
103 # if defined(__BOUNDS_CHECKING_ON)
104 # define __LZO_CHECKER 1
105 # elif defined(__CHECKER__)
106 # define __LZO_CHECKER 1
107 # elif defined(__INSURE__)
108 # define __LZO_CHECKER 1
109 # elif defined(__PURIFY__)
110 # define __LZO_CHECKER 1
111 # endif
112 #endif
113
114
115 /***********************************************************************
116 // integral and pointer types
117 ************************************************************************/
118
119 /* lzo_uint should match size_t */
120 #if !defined(LZO_UINT_MAX)
121 # if defined(LZO_ABI_LLP64) /* WIN64 */
122 # if defined(LZO_OS_WIN64)
123 typedef unsigned __int64 lzo_uint;
124 typedef __int64 lzo_int;
125 # else
126 typedef unsigned long long lzo_uint;
127 typedef long long lzo_int;
128 # endif
129 # define LZO_UINT_MAX 0xffffffffffffffffull
130 # define LZO_INT_MAX 9223372036854775807LL
131 # define LZO_INT_MIN (-1LL - LZO_INT_MAX)
132 # elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
133 typedef unsigned int lzo_uint;
134 typedef int lzo_int;
135 # define LZO_UINT_MAX UINT_MAX
136 # define LZO_INT_MAX INT_MAX
137 # define LZO_INT_MIN INT_MIN
138 # elif (ULONG_MAX >= LZO_0xffffffffL)
139 typedef unsigned long lzo_uint;
140 typedef long lzo_int;
141 # define LZO_UINT_MAX ULONG_MAX
142 # define LZO_INT_MAX LONG_MAX
143 # define LZO_INT_MIN LONG_MIN
144 # else
145 # error "lzo_uint"
146 # endif
147 #endif
148
149 /* Integral types with 32 bits or more. */
150 #if !defined(LZO_UINT32_MAX)
151 # if (UINT_MAX >= LZO_0xffffffffL)
152 typedef unsigned int lzo_uint32;
153 typedef int lzo_int32;
154 # define LZO_UINT32_MAX UINT_MAX
155 # define LZO_INT32_MAX INT_MAX
156 # define LZO_INT32_MIN INT_MIN
157 # elif (ULONG_MAX >= LZO_0xffffffffL)
158 typedef unsigned long lzo_uint32;
159 typedef long lzo_int32;
160 # define LZO_UINT32_MAX ULONG_MAX
161 # define LZO_INT32_MAX LONG_MAX
162 # define LZO_INT32_MIN LONG_MIN
163 # else
164 # error "lzo_uint32"
165 # endif
166 #endif
167
168 /* Integral types with exactly 64 bits. */
169 #if !defined(LZO_UINT64_MAX)
170 # if (LZO_UINT_MAX >= LZO_0xffffffffL)
171 # if ((((LZO_UINT_MAX) >> 31) >> 31) == 3)
172 # define lzo_uint64 lzo_uint
173 # define lzo_int64 lzo_int
174 # define LZO_UINT64_MAX LZO_UINT_MAX
175 # define LZO_INT64_MAX LZO_INT_MAX
176 # define LZO_INT64_MIN LZO_INT_MIN
177 # endif
178 # elif (ULONG_MAX >= LZO_0xffffffffL)
179 # if ((((ULONG_MAX) >> 31) >> 31) == 3)
180 typedef unsigned long lzo_uint64;
181 typedef long lzo_int64;
182 # define LZO_UINT64_MAX ULONG_MAX
183 # define LZO_INT64_MAX LONG_MAX
184 # define LZO_INT64_MIN LONG_MIN
185 # endif
186 # endif
187 #endif
188
189 /* The larger type of lzo_uint and lzo_uint32. */
190 #if (LZO_UINT_MAX >= LZO_UINT32_MAX)
191 # define lzo_xint lzo_uint
192 #else
193 # define lzo_xint lzo_uint32
194 #endif
195
196 /* Memory model that allows to access memory at offsets of lzo_uint. */
197 #if !defined(__LZO_MMODEL)
198 # if (LZO_UINT_MAX <= UINT_MAX)
199 # define __LZO_MMODEL /*empty*/
200 # elif defined(LZO_HAVE_MM_HUGE_PTR)
201 # define __LZO_MMODEL_HUGE 1
202 # define __LZO_MMODEL __huge
203 # else
204 # define __LZO_MMODEL /*empty*/
205 # endif
206 #endif
207
208 /* no typedef here because of const-pointer issues */
209 #define lzo_bytep unsigned char __LZO_MMODEL *
210 #define lzo_charp char __LZO_MMODEL *
211 #define lzo_voidp void __LZO_MMODEL *
212 #define lzo_shortp short __LZO_MMODEL *
213 #define lzo_ushortp unsigned short __LZO_MMODEL *
214 #define lzo_uint32p lzo_uint32 __LZO_MMODEL *
215 #define lzo_int32p lzo_int32 __LZO_MMODEL *
216 #if defined(LZO_UINT64_MAX)
217 #define lzo_uint64p lzo_uint64 __LZO_MMODEL *
218 #define lzo_int64p lzo_int64 __LZO_MMODEL *
219 #endif
220 #define lzo_uintp lzo_uint __LZO_MMODEL *
221 #define lzo_intp lzo_int __LZO_MMODEL *
222 #define lzo_xintp lzo_xint __LZO_MMODEL *
223 #define lzo_voidpp lzo_voidp __LZO_MMODEL *
224 #define lzo_bytepp lzo_bytep __LZO_MMODEL *
225 /* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */
226 #define lzo_byte unsigned char __LZO_MMODEL
227
228 typedef int lzo_bool;
229
230
231 /***********************************************************************
232 // function types
233 ************************************************************************/
234
235 /* name mangling */
236 #if !defined(__LZO_EXTERN_C)
237 # ifdef __cplusplus
238 # define __LZO_EXTERN_C extern "C"
239 # else
240 # define __LZO_EXTERN_C extern
241 # endif
242 #endif
243
244 /* calling convention */
245 #if !defined(__LZO_CDECL)
246 # define __LZO_CDECL __lzo_cdecl
247 #endif
248
249 /* DLL export information */
250 #if !defined(__LZO_EXPORT1)
251 # define __LZO_EXPORT1 /*empty*/
252 #endif
253 #if !defined(__LZO_EXPORT2)
254 # define __LZO_EXPORT2 /*empty*/
255 #endif
256
257 /* __cdecl calling convention for public C and assembly functions */
258 #if !defined(LZO_PUBLIC)
259 # define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
260 #endif
261 #if !defined(LZO_EXTERN)
262 # define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
263 #endif
264 #if !defined(LZO_PRIVATE)
265 # define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
266 #endif
267
268 /* function types */
269 typedef int
270 (__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
271 lzo_bytep dst, lzo_uintp dst_len,
272 lzo_voidp wrkmem );
273
274 typedef int
275 (__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
276 lzo_bytep dst, lzo_uintp dst_len,
277 lzo_voidp wrkmem );
278
279 typedef int
280 (__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
281 lzo_bytep dst, lzo_uintp dst_len,
282 lzo_voidp wrkmem );
283
284 typedef int
285 (__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
286 lzo_bytep dst, lzo_uintp dst_len,
287 lzo_voidp wrkmem,
288 const lzo_bytep dict, lzo_uint dict_len );
289
290 typedef int
291 (__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
292 lzo_bytep dst, lzo_uintp dst_len,
293 lzo_voidp wrkmem,
294 const lzo_bytep dict, lzo_uint dict_len );
295
296
297 /* Callback interface. Currently only the progress indicator ("nprogress")
298 * is used, but this may change in a future release. */
299
300 struct lzo_callback_t;
301 typedef struct lzo_callback_t lzo_callback_t;
302 #define lzo_callback_p lzo_callback_t __LZO_MMODEL *
303
304 /* malloc & free function types */
305 typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
306 (lzo_callback_p self, lzo_uint items, lzo_uint size);
307 typedef void (__LZO_CDECL *lzo_free_func_t)
308 (lzo_callback_p self, lzo_voidp ptr);
309
310 /* a progress indicator callback function */
311 typedef void (__LZO_CDECL *lzo_progress_func_t)
312 (lzo_callback_p, lzo_uint, lzo_uint, int);
313
314 struct lzo_callback_t
315 {
316 /* custom allocators (set to 0 to disable) */
317 lzo_alloc_func_t nalloc; /* [not used right now] */
318 lzo_free_func_t nfree; /* [not used right now] */
319
320 /* a progress indicator callback function (set to 0 to disable) */
321 lzo_progress_func_t nprogress;
322
323 /* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
324 * callbacks points back to this struct, so you are free to store
325 * some extra info in the following variables. */
326 lzo_voidp user1;
327 lzo_xint user2;
328 lzo_xint user3;
329 };
330
331
332 /***********************************************************************
333 // error codes and prototypes
334 ************************************************************************/
335
336 /* Error codes for the compression/decompression functions. Negative
337 * values are errors, positive values will be used for special but
338 * normal events.
339 */
340 #define LZO_E_OK 0
341 #define LZO_E_ERROR (-1)
342 #define LZO_E_OUT_OF_MEMORY (-2) /* [lzo_alloc_func_t failure] */
343 #define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
344 #define LZO_E_INPUT_OVERRUN (-4)
345 #define LZO_E_OUTPUT_OVERRUN (-5)
346 #define LZO_E_LOOKBEHIND_OVERRUN (-6)
347 #define LZO_E_EOF_NOT_FOUND (-7)
348 #define LZO_E_INPUT_NOT_CONSUMED (-8)
349 #define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
350 #define LZO_E_INVALID_ARGUMENT (-10)
351
352
353 #ifndef lzo_sizeof_dict_t
354 # define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
355 #endif
356
357 /* lzo_init() should be the first function you call.
358 * Check the return code !
359 *
360 * lzo_init() is a macro to allow checking that the library and the
361 * compiler's view of various types are consistent.
362 */
363 #define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
364 (int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
365 (int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
366 (int)sizeof(lzo_callback_t))
367 LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
368
369 /* version functions (useful for shared libraries) */
370 LZO_EXTERN(unsigned) lzo_version(void);
371 LZO_EXTERN(const char *) lzo_version_string(void);
372 LZO_EXTERN(const char *) lzo_version_date(void);
373 LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
374 LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
375
376 /* string functions */
377 LZO_EXTERN(int)
378 lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len);
379 LZO_EXTERN(lzo_voidp)
380 lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
381 LZO_EXTERN(lzo_voidp)
382 lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
383 LZO_EXTERN(lzo_voidp)
384 lzo_memset(lzo_voidp buf, int c, lzo_uint len);
385
386 /* checksum functions */
387 LZO_EXTERN(lzo_uint32)
388 lzo_adler32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len);
389 LZO_EXTERN(lzo_uint32)
390 lzo_crc32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len);
391 LZO_EXTERN(const lzo_uint32p)
392 lzo_get_crc32_table(void);
393
394 /* misc. */
395 LZO_EXTERN(int) _lzo_config_check(void);
396 typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
397 typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
398 typedef union { void *vp; lzo_bytep bp; lzo_uint u; lzo_uint32 u32; unsigned long l; } lzo_align_t;
399
400 /* align a char pointer on a boundary that is a multiple of 'size' */
401 LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size);
402 #define LZO_PTR_ALIGN_UP(p,size) \
403 ((p) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(p),(lzo_uint)(size)))
404
405
406 /***********************************************************************
407 // deprecated macros - only for backward compatibility with LZO v1.xx
408 ************************************************************************/
409
410 #if defined(LZO_CFG_COMPAT)
411
412 #define __LZOCONF_H 1
413
414 #if defined(LZO_ARCH_I086)
415 # define __LZO_i386 1
416 #elif defined(LZO_ARCH_I386)
417 # define __LZO_i386 1
418 #endif
419
420 #if defined(LZO_OS_DOS16)
421 # define __LZO_DOS 1
422 # define __LZO_DOS16 1
423 #elif defined(LZO_OS_DOS32)
424 # define __LZO_DOS 1
425 #elif defined(LZO_OS_WIN16)
426 # define __LZO_WIN 1
427 # define __LZO_WIN16 1
428 #elif defined(LZO_OS_WIN32)
429 # define __LZO_WIN 1
430 #endif
431
432 #define __LZO_CMODEL /*empty*/
433 #define __LZO_DMODEL /*empty*/
434 #define __LZO_ENTRY __LZO_CDECL
435 #define LZO_EXTERN_CDECL LZO_EXTERN
436 #define LZO_ALIGN LZO_PTR_ALIGN_UP
437
438 #define lzo_compress_asm_t lzo_compress_t
439 #define lzo_decompress_asm_t lzo_decompress_t
440
441 #endif /* LZO_CFG_COMPAT */
442
443
444 #ifdef __cplusplus
445 } /* extern "C" */
446 #endif
447
448 #endif /* already included */
449
450
451 /* vim:set ts=4 et: */