lib/zlib_dfltcc/dfltcc_util.h

Source file repositories/reference/linux-study-clean/lib/zlib_dfltcc/dfltcc_util.h

File Facts

System
Linux kernel
Corpus path
lib/zlib_dfltcc/dfltcc_util.h
Extension
.h
Size
3225 bytes
Lines
132
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.

Dependency Surface

Detected Declarations

Annotated Snippet

switch (fn & DFLTCC_FN_MASK) {
    case DFLTCC_QAF:
        kmsan_unpoison_memory(param, sizeof(struct dfltcc_qaf_param));
        break;
    case DFLTCC_GDHT:
        kmsan_unpoison_memory(param, offsetof(struct dfltcc_param_v0, csb));
        break;
    case DFLTCC_CMPR:
        kmsan_unpoison_memory(param, sizeof(struct dfltcc_param_v0));
        kmsan_unpoison_memory(
                orig_t2,
                t2 - orig_t2 +
                    (((struct dfltcc_param_v0 *)param)->sbb == 0 ? 0 : 1));
        break;
    case DFLTCC_XPND:
        kmsan_unpoison_memory(param, sizeof(struct dfltcc_param_v0));
        kmsan_unpoison_memory(orig_t2, t2 - orig_t2);
        break;
    }

    if (op1)
        *op1 = t2;
    if (len1)
        *len1 = t3;
    if (op2)
        *op2 = t4;
    if (len2)
        *len2 = t5;
    return (cc >> 28) & 3;
}

static inline int is_bit_set(
    const char *bits,
    int n
)
{
    return bits[n / 8] & (1 << (7 - (n % 8)));
}

static inline void turn_bit_off(
    char *bits,
    int n
)
{
    bits[n / 8] &= ~(1 << (7 - (n % 8)));
}

static inline int dfltcc_are_params_ok(
    int level,
    uInt window_bits,
    int strategy,
    uLong level_mask
)
{
    return (level_mask & (1 << level)) != 0 &&
        (window_bits == HB_BITS) &&
        (strategy == Z_DEFAULT_STRATEGY);
}

char *oesc_msg(char *buf, int oesc);

#endif /* DFLTCC_UTIL_H */

Annotation

Implementation Notes