drm/modes: Fix drm_mode_vrefres() docs
[drm/drm-misc.git] / lib / xz / xz_stream.h
blob55f9f6f94b788d9b84c91dfe0b5675fce5ed1fc5
1 /* SPDX-License-Identifier: 0BSD */
3 /*
4 * Definitions for handling the .xz file format
6 * Author: Lasse Collin <lasse.collin@tukaani.org>
7 */
9 #ifndef XZ_STREAM_H
10 #define XZ_STREAM_H
12 #if defined(__KERNEL__) && !XZ_INTERNAL_CRC32
13 # include <linux/crc32.h>
14 # undef crc32
15 # define xz_crc32(buf, size, crc) \
16 (~crc32_le(~(uint32_t)(crc), buf, size))
17 #endif
20 * See the .xz file format specification at
21 * https://tukaani.org/xz/xz-file-format.txt
22 * to understand the container format.
25 #define STREAM_HEADER_SIZE 12
27 #define HEADER_MAGIC "\3757zXZ"
28 #define HEADER_MAGIC_SIZE 6
30 #define FOOTER_MAGIC "YZ"
31 #define FOOTER_MAGIC_SIZE 2
34 * Variable-length integer can hold a 63-bit unsigned integer or a special
35 * value indicating that the value is unknown.
37 * Experimental: vli_type can be defined to uint32_t to save a few bytes
38 * in code size (no effect on speed). Doing so limits the uncompressed and
39 * compressed size of the file to less than 256 MiB and may also weaken
40 * error detection slightly.
42 typedef uint64_t vli_type;
44 #define VLI_MAX ((vli_type)-1 / 2)
45 #define VLI_UNKNOWN ((vli_type)-1)
47 /* Maximum encoded size of a VLI */
48 #define VLI_BYTES_MAX (sizeof(vli_type) * 8 / 7)
50 /* Integrity Check types */
51 enum xz_check {
52 XZ_CHECK_NONE = 0,
53 XZ_CHECK_CRC32 = 1,
54 XZ_CHECK_CRC64 = 4,
55 XZ_CHECK_SHA256 = 10
58 /* Maximum possible Check ID */
59 #define XZ_CHECK_MAX 15
61 #endif