Path: blob/main/sys/contrib/xz-embedded/linux/lib/xz/xz_stream.h
48521 views
/*1* Definitions for handling the .xz file format2*3* Author: Lasse Collin <[email protected]>4*5* This file has been put into the public domain.6* You can do whatever you want with this file.7*/89#ifndef XZ_STREAM_H10#define XZ_STREAM_H1112#if defined(__KERNEL__) && !XZ_INTERNAL_CRC3213# include <linux/crc32.h>14# undef crc3215# define xz_crc32(buf, size, crc) \16(~crc32_le(~(uint32_t)(crc), buf, size))17#endif1819/*20* See the .xz file format specification at21* https://tukaani.org/xz/xz-file-format.txt22* to understand the container format.23*/2425#define STREAM_HEADER_SIZE 122627#define HEADER_MAGIC "\3757zXZ"28#define HEADER_MAGIC_SIZE 62930#define FOOTER_MAGIC "YZ"31#define FOOTER_MAGIC_SIZE 23233/*34* Variable-length integer can hold a 63-bit unsigned integer or a special35* value indicating that the value is unknown.36*37* Experimental: vli_type can be defined to uint32_t to save a few bytes38* in code size (no effect on speed). Doing so limits the uncompressed and39* compressed size of the file to less than 256 MiB and may also weaken40* error detection slightly.41*/42typedef uint64_t vli_type;4344#define VLI_MAX ((vli_type)-1 / 2)45#define VLI_UNKNOWN ((vli_type)-1)4647/* Maximum encoded size of a VLI */48#define VLI_BYTES_MAX (sizeof(vli_type) * 8 / 7)4950/* Integrity Check types */51enum xz_check {52XZ_CHECK_NONE = 0,53XZ_CHECK_CRC32 = 1,54XZ_CHECK_CRC64 = 4,55XZ_CHECK_SHA256 = 1056};5758/* Maximum possible Check ID */59#define XZ_CHECK_MAX 156061#endif626364