STRUCT XZ_BUF(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 be NULL if and only if in_pos is equal to in_size β€” that's the whole rule, no wiggle room, fr.
  • in_pos β€” where we're currently at in the input buffer. must not exceed in_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 be NULL if and only if out_pos is equal to out_size. same energy as in, matching set 🫢.
  • out_pos β€” current position in the output buffer. must not exceed out_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 be NULL if and only if" thing on in and out is 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:


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