lib/xz/xz_dec_lzma2.c
Source file repositories/reference/linux-study-clean/lib/xz/xz_dec_lzma2.c
File Facts
- System
- Linux kernel
- Corpus path
lib/xz/xz_dec_lzma2.c- Extension
.c- Size
- 33332 bytes
- Lines
- 1342
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
xz_private.hxz_lzma2.h
Detected Declarations
struct dictionarystruct rc_decstruct lzma_len_decstruct lzma_decstruct lzma2_decstruct xz_dec_lzma2struct xz_dec_microlzmaenum lzma2_seqfunction dict_resetfunction dict_limitfunction dict_has_spacefunction dict_getfunction dict_putfunction dict_repeatfunction dict_uncompressedfunction dict_flushfunction rc_resetfunction rc_read_initfunction rc_limit_exceededfunction possiblefunction rc_normalizefunction rc_bitfunction rc_bittreefunction rc_bittree_reversefunction rc_directfunction lzma_literalfunction lzma_lenfunction lzma_matchfunction lzma_rep_matchfunction lzma_mainfunction lzma_resetfunction propertiesfunction limitfunction xz_dec_lzma2_runfunction xz_dec_lzma2_resetfunction xz_dec_lzma2_endfunction xz_dec_microlzma_runfunction xz_dec_microlzma_resetfunction xz_dec_microlzma_end
Annotated Snippet
struct dictionary {
/* Beginning of the history buffer */
uint8_t *buf;
/* Old position in buf (before decoding more data) */
size_t start;
/* Position in buf */
size_t pos;
/*
* How full dictionary is. This is used to detect corrupt input that
* would read beyond the beginning of the uncompressed stream.
*/
size_t full;
/* Write limit; we don't write to buf[limit] or later bytes. */
size_t limit;
/*
* End of the dictionary buffer. In multi-call mode, this is
* the same as the dictionary size. In single-call mode, this
* indicates the size of the output buffer.
*/
size_t end;
/*
* Size of the dictionary as specified in Block Header. This is used
* together with "full" to detect corrupt input that would make us
* read beyond the beginning of the uncompressed stream.
*/
uint32_t size;
/*
* Maximum allowed dictionary size in multi-call mode.
* This is ignored in single-call mode.
*/
uint32_t size_max;
/*
* Amount of memory currently allocated for the dictionary.
* This is used only with XZ_DYNALLOC. (With XZ_PREALLOC,
* size_max is always the same as the allocated size.)
*/
uint32_t allocated;
/* Operation mode */
enum xz_mode mode;
};
/* Range decoder */
struct rc_dec {
uint32_t range;
uint32_t code;
/*
* Number of initializing bytes remaining to be read
* by rc_read_init().
*/
uint32_t init_bytes_left;
/*
* Buffer from which we read our input. It can be either
* temp.buf or the caller-provided input buffer.
*/
const uint8_t *in;
size_t in_pos;
size_t in_limit;
};
/* Probabilities for a length decoder. */
struct lzma_len_dec {
/* Probability of match length being at least 10 */
uint16_t choice;
/* Probability of match length being at least 18 */
uint16_t choice2;
/* Probabilities for match lengths 2-9 */
uint16_t low[POS_STATES_MAX][LEN_LOW_SYMBOLS];
/* Probabilities for match lengths 10-17 */
uint16_t mid[POS_STATES_MAX][LEN_MID_SYMBOLS];
/* Probabilities for match lengths 18-273 */
uint16_t high[LEN_HIGH_SYMBOLS];
};
struct lzma_dec {
/* Distances of latest four matches */
Annotation
- Immediate include surface: `xz_private.h`, `xz_lzma2.h`.
- Detected declarations: `struct dictionary`, `struct rc_dec`, `struct lzma_len_dec`, `struct lzma_dec`, `struct lzma2_dec`, `struct xz_dec_lzma2`, `struct xz_dec_microlzma`, `enum lzma2_seq`, `function dict_reset`, `function dict_limit`.
- 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.