mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 01:34:14 +08:00
45ec975efb
To prevent any issues with persistent data, separate lzo-rle from lzo so that it is treated as a separate algorithm, and lzo is still available. Link: http://lkml.kernel.org/r/20190205155944.16007-3-dave.rodgman@arm.com Signed-off-by: Dave Rodgman <dave.rodgman@arm.com> Cc: David S. Miller <davem@davemloft.net> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Markus F.X.J. Oberhumer <markus@oberhumer.com> Cc: Matt Sealey <matt.sealey@arm.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Nitin Gupta <nitingupta910@gmail.com> Cc: Richard Purdie <rpurdie@openedhand.com> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> Cc: Sonny Rao <sonnyrao@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
72 lines
1.8 KiB
C
72 lines
1.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* lzodefs.h -- architecture, OS and compiler specific defines
|
|
*
|
|
* Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <markus@oberhumer.com>
|
|
*
|
|
* The full LZO package can be found at:
|
|
* http://www.oberhumer.com/opensource/lzo/
|
|
*
|
|
* Changed for Linux kernel use by:
|
|
* Nitin Gupta <nitingupta910@gmail.com>
|
|
* Richard Purdie <rpurdie@openedhand.com>
|
|
*/
|
|
|
|
|
|
/* Version
|
|
* 0: original lzo version
|
|
* 1: lzo with support for RLE
|
|
*/
|
|
#define LZO_VERSION 1
|
|
|
|
#define COPY4(dst, src) \
|
|
put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst))
|
|
#if defined(CONFIG_X86_64) || defined(CONFIG_ARM64)
|
|
#define COPY8(dst, src) \
|
|
put_unaligned(get_unaligned((const u64 *)(src)), (u64 *)(dst))
|
|
#else
|
|
#define COPY8(dst, src) \
|
|
COPY4(dst, src); COPY4((dst) + 4, (src) + 4)
|
|
#endif
|
|
|
|
#if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
|
|
#error "conflicting endian definitions"
|
|
#elif defined(CONFIG_X86_64) || defined(CONFIG_ARM64)
|
|
#define LZO_USE_CTZ64 1
|
|
#define LZO_USE_CTZ32 1
|
|
#define LZO_FAST_64BIT_MEMORY_ACCESS
|
|
#elif defined(CONFIG_X86) || defined(CONFIG_PPC)
|
|
#define LZO_USE_CTZ32 1
|
|
#elif defined(CONFIG_ARM) && (__LINUX_ARM_ARCH__ >= 5)
|
|
#define LZO_USE_CTZ32 1
|
|
#endif
|
|
|
|
#define M1_MAX_OFFSET 0x0400
|
|
#define M2_MAX_OFFSET 0x0800
|
|
#define M3_MAX_OFFSET 0x4000
|
|
#define M4_MAX_OFFSET_V0 0xbfff
|
|
#define M4_MAX_OFFSET_V1 0xbffe
|
|
|
|
#define M1_MIN_LEN 2
|
|
#define M1_MAX_LEN 2
|
|
#define M2_MIN_LEN 3
|
|
#define M2_MAX_LEN 8
|
|
#define M3_MIN_LEN 3
|
|
#define M3_MAX_LEN 33
|
|
#define M4_MIN_LEN 3
|
|
#define M4_MAX_LEN 9
|
|
|
|
#define M1_MARKER 0
|
|
#define M2_MARKER 64
|
|
#define M3_MARKER 32
|
|
#define M4_MARKER 16
|
|
|
|
#define MIN_ZERO_RUN_LENGTH 4
|
|
#define MAX_ZERO_RUN_LENGTH (2047 + MIN_ZERO_RUN_LENGTH)
|
|
|
|
#define lzo_dict_t unsigned short
|
|
#define D_BITS 13
|
|
#define D_SIZE (1u << D_BITS)
|
|
#define D_MASK (D_SIZE - 1)
|
|
#define D_HIGH ((D_MASK >> 1) + 1)
|