STRUCT XZ_BUF(9)
π struct xz_buf(9) π
okay bestie, so this is from the Kernel API Manual and honestly it's giving "the little struct that could" β it's literally just the carrier bag that XZ code uses to pass input and output buffers around. no cap.
β¨ NAME β¨
struct xz_buf β passing input and output buffers to XZ code π
π¦ SYNOPSIS π¦
struct xz_buf {
const uint8_t *in;
size_t in_pos;
size_t in_size;
uint8_t *out;
size_t out_pos;
size_t out_size;
};
like, look at her. six fields. iconic. π
πΈ Members πΈ
inβ the very beginning of the input buffer. she may beNULLif and only ifin_posis equal toin_sizeβ that's the whole rule, no wiggle room, fr.in_posβ where we're currently at in the input buffer. must not exceedin_size. periodt.in_sizeβ the size of the input buffer. that's it, that's the vibe check.outβ beginning of the output buffer. this one may beNULLif and only ifout_posis equal toout_size. same energy asin, matching set π«Ά.out_posβ current position in the output buffer. must not exceedout_size. don't test her.out_sizeβ size of the output buffer. standard.
π Description π
okay so here's the thing that makes her special: the XZ code only ever touches the contents of the output buffer from out[out_pos] onward, and the variables in_pos and out_pos. that's it. everything else stays exactly where you left it. she's respectful like that π.
bestie pls note β the "may beNULLif and only if" thing oninandoutis not a suggestion. it's an if-and-only-if. slay responsibly β¨.
π₯ SEE ALSO π₯
kernel file ./include/linux/xz.h, and her whole friend group:
enum xz_mode(9)enum xz_ret(9)xz_dec_init(9)xz_dec_run(9)xz_dec_reset(9)xz_dec_end(9)MicroLZMA decompressor(9)xz_dec_microlzma_alloc(9)xz_dec_microlzma_reset(9)xz_dec_microlzma_run(9)xz_dec_microlzma_end(9)
and that's the whole page, no notes π shoutout to ./include/linux, dated October 2026 β keep her in your kernel and she'll keep your buffers in check. mwah ππ§π«
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms