lib/zlib_dfltcc/dfltcc_deflate.c
Source file repositories/reference/linux-study-clean/lib/zlib_dfltcc/dfltcc_deflate.c
File Facts
- System
- Linux kernel
- Corpus path
lib/zlib_dfltcc/dfltcc_deflate.c- Extension
.c- Size
- 10607 bytes
- Lines
- 314
- Domain
- Kernel Services
- Bucket
- lib
- Inferred role
- Kernel Services: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
../zlib_deflate/defutil.hdfltcc_util.hdfltcc_deflate.hasm/setup.hlinux/export.hlinux/zutil.h
Detected Declarations
function dfltcc_can_deflatefunction dfltcc_reset_deflate_statefunction dfltcc_gdhtfunction dfltcc_cmprfunction send_eobsfunction dfltcc_deflateexport dfltcc_can_deflateexport dfltcc_reset_deflate_stateexport dfltcc_deflate
Annotated Snippet
void dfltcc_reset_deflate_state(z_streamp strm) {
deflate_state *state = (deflate_state *)strm->state;
struct dfltcc_deflate_state *dfltcc_state = GET_DFLTCC_DEFLATE_STATE(state);
dfltcc_reset_state(&dfltcc_state->common);
/* Initialize tuning parameters */
if (zlib_dfltcc_support == ZLIB_DFLTCC_FULL_DEBUG)
dfltcc_state->level_mask = DFLTCC_LEVEL_MASK_DEBUG;
else
dfltcc_state->level_mask = DFLTCC_LEVEL_MASK;
dfltcc_state->block_size = DFLTCC_BLOCK_SIZE;
dfltcc_state->block_threshold = DFLTCC_FIRST_FHT_BLOCK_SIZE;
dfltcc_state->dht_threshold = DFLTCC_DHT_MIN_SAMPLE_SIZE;
}
EXPORT_SYMBOL(dfltcc_reset_deflate_state);
static void dfltcc_gdht(
z_streamp strm
)
{
deflate_state *state = (deflate_state *)strm->state;
struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param;
size_t avail_in = strm->avail_in;
dfltcc(DFLTCC_GDHT,
param, NULL, NULL,
&strm->next_in, &avail_in, NULL);
}
static dfltcc_cc dfltcc_cmpr(
z_streamp strm
)
{
deflate_state *state = (deflate_state *)strm->state;
struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param;
size_t avail_in = strm->avail_in;
size_t avail_out = strm->avail_out;
dfltcc_cc cc;
cc = dfltcc(DFLTCC_CMPR | HBT_CIRCULAR,
param, &strm->next_out, &avail_out,
&strm->next_in, &avail_in, state->window);
strm->total_in += (strm->avail_in - avail_in);
strm->total_out += (strm->avail_out - avail_out);
strm->avail_in = avail_in;
strm->avail_out = avail_out;
return cc;
}
static void send_eobs(
z_streamp strm,
const struct dfltcc_param_v0 *param
)
{
deflate_state *state = (deflate_state *)strm->state;
zlib_tr_send_bits(
state,
bi_reverse(param->eobs >> (15 - param->eobl), param->eobl),
param->eobl);
flush_pending(strm);
if (state->pending != 0) {
/* The remaining data is located in pending_out[0:pending]. If someone
* calls put_byte() - this might happen in deflate() - the byte will be
* placed into pending_buf[pending], which is incorrect. Move the
* remaining data to the beginning of pending_buf so that put_byte() is
* usable again.
*/
memmove(state->pending_buf, state->pending_out, state->pending);
state->pending_out = state->pending_buf;
}
#ifdef ZLIB_DEBUG
state->compressed_len += param->eobl;
#endif
}
int dfltcc_deflate(
z_streamp strm,
int flush,
block_state *result
)
{
deflate_state *state = (deflate_state *)strm->state;
struct dfltcc_deflate_state *dfltcc_state = GET_DFLTCC_DEFLATE_STATE(state);
struct dfltcc_param_v0 *param = &dfltcc_state->common.param;
uInt masked_avail_in;
dfltcc_cc cc;
int need_empty_block;
int soft_bcc;
Annotation
- Immediate include surface: `../zlib_deflate/defutil.h`, `dfltcc_util.h`, `dfltcc_deflate.h`, `asm/setup.h`, `linux/export.h`, `linux/zutil.h`.
- Detected declarations: `function dfltcc_can_deflate`, `function dfltcc_reset_deflate_state`, `function dfltcc_gdht`, `function dfltcc_cmpr`, `function send_eobs`, `function dfltcc_deflate`, `export dfltcc_can_deflate`, `export dfltcc_reset_deflate_state`, `export dfltcc_deflate`.
- Atlas domain: Kernel Services / lib.
- Implementation status: integration 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.