lib/zstd/compress/zstd_compress_internal.h
Source file repositories/reference/linux-study-clean/lib/zstd/compress/zstd_compress_internal.h
File Facts
- System
- Linux kernel
- Corpus path
lib/zstd/compress/zstd_compress_internal.h- Extension
.h- Size
- 68354 bytes
- Lines
- 1629
- Domain
- Kernel Services
- Bucket
- lib
- Inferred role
- Kernel Services: implementation source
- Status
- source implementation candidate
Why This File Exists
Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
../common/zstd_internal.hzstd_cwksp.h../common/bits.hzstd_preSplit.h
Detected Declarations
struct ZSTD_MatchState_tstruct ZSTD_CCtx_params_sstruct ZSTD_CCtx_sfunction ZSTD_getSequenceLengthfunction ZSTD_LLcodefunction ZSTD_MLcodefunction ZSTD_cParam_withinBoundsfunction ZSTD_selectAddrfunction ZSTD_noCompressBlockfunction ZSTD_rleCompressBlockfunction ZSTD_minGainfunction ZSTD_literalsCompressionIsDisabledfunction memcpyfunction sequencefunction sequencefunction ZSTD_updateRepfunction ZSTD_newRepfunction ZSTD_countfunction ZSTD_count_2segmentsfunction ZSTD_hash3function ZSTD_hash3Ptrfunction ZSTD_hash3PtrSfunction ZSTD_hash4function ZSTD_hash4Ptrfunction ZSTD_hash4PtrSfunction ZSTD_hash5function ZSTD_hash5Ptrfunction ZSTD_hash5PtrSfunction ZSTD_hash6function ZSTD_hash6Ptrfunction ZSTD_hash6PtrSfunction ZSTD_hash7function ZSTD_hash7Ptrfunction ZSTD_hash7PtrSfunction ZSTD_hash8function ZSTD_hash8Ptrfunction ZSTD_hash8PtrSfunction ZSTD_hashPtrfunction ZSTD_hashPtrSaltedfunction ZSTD_ipowfunction ZSTD_rollingHash_appendfunction ZSTD_rollingHash_computefunction ZSTD_rollingHash_rotatefunction ZSTD_rollingHash_rotatefunction ZSTD_window_clearfunction ZSTD_window_isEmptyfunction ZSTD_window_hasExtDictfunction ZSTD_matchState_dictMode
Annotated Snippet
struct ZSTD_MatchState_t {
ZSTD_window_t window; /* State for window round buffer management */
U32 loadedDictEnd; /* index of end of dictionary, within context's referential.
* When loadedDictEnd != 0, a dictionary is in use, and still valid.
* This relies on a mechanism to set loadedDictEnd=0 when dictionary is no longer within distance.
* Such mechanism is provided within ZSTD_window_enforceMaxDist() and ZSTD_checkDictValidity().
* When dict referential is copied into active context (i.e. not attached),
* loadedDictEnd == dictSize, since referential starts from zero.
*/
U32 nextToUpdate; /* index from which to continue table update */
U32 hashLog3; /* dispatch table for matches of len==3 : larger == faster, more memory */
U32 rowHashLog; /* For row-based matchfinder: Hashlog based on nb of rows in the hashTable.*/
BYTE* tagTable; /* For row-based matchFinder: A row-based table containing the hashes and head index. */
U32 hashCache[ZSTD_ROW_HASH_CACHE_SIZE]; /* For row-based matchFinder: a cache of hashes to improve speed */
U64 hashSalt; /* For row-based matchFinder: salts the hash for reuse of tag table */
U32 hashSaltEntropy; /* For row-based matchFinder: collects entropy for salt generation */
U32* hashTable;
U32* hashTable3;
U32* chainTable;
int forceNonContiguous; /* Non-zero if we should force non-contiguous load for the next window update. */
int dedicatedDictSearch; /* Indicates whether this matchState is using the
* dedicated dictionary search structure.
*/
optState_t opt; /* optimal parser state */
const ZSTD_MatchState_t* dictMatchState;
ZSTD_compressionParameters cParams;
const RawSeqStore_t* ldmSeqStore;
/* Controls prefetching in some dictMatchState matchfinders.
* This behavior is controlled from the cctx ms.
* This parameter has no effect in the cdict ms. */
int prefetchCDictTables;
/* When == 0, lazy match finders insert every position.
* When != 0, lazy match finders only insert positions they search.
* This allows them to skip much faster over incompressible data,
* at a small cost to compression ratio.
*/
int lazySkipping;
};
typedef struct {
ZSTD_compressedBlockState_t* prevCBlock;
ZSTD_compressedBlockState_t* nextCBlock;
ZSTD_MatchState_t matchState;
} ZSTD_blockState_t;
typedef struct {
U32 offset;
U32 checksum;
} ldmEntry_t;
typedef struct {
BYTE const* split;
U32 hash;
U32 checksum;
ldmEntry_t* bucket;
} ldmMatchCandidate_t;
#define LDM_BATCH_SIZE 64
typedef struct {
ZSTD_window_t window; /* State for the window round buffer management */
ldmEntry_t* hashTable;
U32 loadedDictEnd;
BYTE* bucketOffsets; /* Next position in bucket to insert entry */
size_t splitIndices[LDM_BATCH_SIZE];
ldmMatchCandidate_t matchCandidates[LDM_BATCH_SIZE];
} ldmState_t;
typedef struct {
ZSTD_ParamSwitch_e enableLdm; /* ZSTD_ps_enable to enable LDM. ZSTD_ps_auto by default */
U32 hashLog; /* Log size of hashTable */
U32 bucketSizeLog; /* Log bucket size for collision resolution, at most 8 */
U32 minMatchLength; /* Minimum match length */
U32 hashRateLog; /* Log number of entries to skip */
U32 windowLog; /* Window log for the LDM */
} ldmParams_t;
typedef struct {
int collectSequences;
ZSTD_Sequence* seqStart;
size_t seqIndex;
size_t maxSequences;
} SeqCollector;
Annotation
- Immediate include surface: `../common/zstd_internal.h`, `zstd_cwksp.h`, `../common/bits.h`, `zstd_preSplit.h`.
- Detected declarations: `struct ZSTD_MatchState_t`, `struct ZSTD_CCtx_params_s`, `struct ZSTD_CCtx_s`, `function ZSTD_getSequenceLength`, `function ZSTD_LLcode`, `function ZSTD_MLcode`, `function ZSTD_cParam_withinBounds`, `function ZSTD_selectAddr`, `function ZSTD_noCompressBlock`, `function ZSTD_rleCompressBlock`.
- Atlas domain: Kernel Services / lib.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.