lib/zlib_dfltcc/dfltcc_inflate.c
Source file repositories/reference/linux-study-clean/lib/zlib_dfltcc/dfltcc_inflate.c
File Facts
- System
- Linux kernel
- Corpus path
lib/zlib_dfltcc/dfltcc_inflate.c- Extension
.c- Size
- 4561 bytes
- Lines
- 155
- 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_inflate/inflate.hdfltcc_util.hdfltcc_inflate.hasm/setup.hlinux/export.hlinux/zutil.h
Detected Declarations
function dfltcc_can_inflatefunction dfltcc_reset_inflate_statefunction dfltcc_was_inflate_usedfunction dfltcc_inflate_disablefunction dfltcc_xpndfunction dfltcc_inflateexport dfltcc_can_inflateexport dfltcc_reset_inflate_stateexport dfltcc_inflate
Annotated Snippet
void dfltcc_reset_inflate_state(z_streamp strm) {
struct inflate_state *state = (struct inflate_state *)strm->state;
struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
dfltcc_reset_state(dfltcc_state);
}
EXPORT_SYMBOL(dfltcc_reset_inflate_state);
static int dfltcc_was_inflate_used(
z_streamp strm
)
{
struct inflate_state *state = (struct inflate_state *)strm->state;
struct dfltcc_param_v0 *param = &GET_DFLTCC_STATE(state)->param;
return !param->nt;
}
static int dfltcc_inflate_disable(
z_streamp strm
)
{
struct inflate_state *state = (struct inflate_state *)strm->state;
struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
if (!dfltcc_can_inflate(strm))
return 0;
if (dfltcc_was_inflate_used(strm))
/* DFLTCC has already decompressed some data. Since there is not
* enough information to resume decompression in software, the call
* must fail.
*/
return 1;
/* DFLTCC was not used yet - decompress in software */
memset(&dfltcc_state->af, 0, sizeof(dfltcc_state->af));
return 0;
}
static dfltcc_cc dfltcc_xpnd(
z_streamp strm
)
{
struct inflate_state *state = (struct inflate_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_XPND | HBT_CIRCULAR,
param, &strm->next_out, &avail_out,
&strm->next_in, &avail_in, state->window);
strm->avail_in = avail_in;
strm->avail_out = avail_out;
return cc;
}
dfltcc_inflate_action dfltcc_inflate(
z_streamp strm,
int flush,
int *ret
)
{
struct inflate_state *state = (struct inflate_state *)strm->state;
struct dfltcc_state *dfltcc_state = GET_DFLTCC_STATE(state);
struct dfltcc_param_v0 *param = &dfltcc_state->param;
dfltcc_cc cc;
if (flush == Z_BLOCK || flush == Z_PACKET_FLUSH) {
/* DFLTCC does not support stopping on block boundaries (Z_BLOCK flush option)
* as well as the use of Z_PACKET_FLUSH option (used exclusively by PPP driver)
*/
if (dfltcc_inflate_disable(strm)) {
*ret = Z_STREAM_ERROR;
return DFLTCC_INFLATE_BREAK;
} else
return DFLTCC_INFLATE_SOFTWARE;
}
if (state->last) {
if (state->bits != 0) {
strm->next_in++;
strm->avail_in--;
state->bits = 0;
}
state->mode = CHECK;
return DFLTCC_INFLATE_CONTINUE;
}
if (strm->avail_in == 0 && !param->cf)
return DFLTCC_INFLATE_BREAK;
Annotation
- Immediate include surface: `../zlib_inflate/inflate.h`, `dfltcc_util.h`, `dfltcc_inflate.h`, `asm/setup.h`, `linux/export.h`, `linux/zutil.h`.
- Detected declarations: `function dfltcc_can_inflate`, `function dfltcc_reset_inflate_state`, `function dfltcc_was_inflate_used`, `function dfltcc_inflate_disable`, `function dfltcc_xpnd`, `function dfltcc_inflate`, `export dfltcc_can_inflate`, `export dfltcc_reset_inflate_state`, `export dfltcc_inflate`.
- 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.