lz77_encode_match(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… lz77_encode_match β€” bestie's guide to match encoding πŸ’…

okay so this one lives in the Kernel API Manual (yes, the kernel has a manual, and yes it's iconic) and it's called lz77_encode_match(9). buckle up, it's actually short and slay. πŸŽ€


✨ NAME ✨

lz77_encode_match β€” match encoding. that's it. that's the whole vibe. it encodes a match. periodt. πŸ’…


✨ SYNOPSIS ✨

void * lz77_encode_match (void *dst , void **nib , u16 dist , u32 len );

look at her. four args, returns a pointer, no cap. 🫢


✨ ARGUMENTS ✨

so these four besties walk into a function:

  • dst β€” the compressed buffer. this is the main character, the one getting written into. πŸ’–
  • nib β€” a pointer to an address in dst. like, a pointer inside the buffer. nested pointer energy, highkey iconic. πŸ¦‹
  • dist β€” the match distance. how far back we're reaching, ngl. 🧚
  • len β€” the match length. how much we're grabbing from back there. ✨
it's typed u16 dist and u32 len fr fr β€” short distance, long length, that's the signature, don't @ me.

✨ DESCRIPTION ✨

so the description is literally one line and it's giving confident:

Assumes all args were previously checked. 😭

like ok queen, she's not doing the vibe check herself β€” somebody already validated everything before calling her, and she trusts that. so please, please do your checking before you pass stuff in, because she will not be re-checking it for you. πŸ™ˆ

and here's the receipt, the reference, the source-of-truth citation:

Ref: MS-XCA 2.3.4 "Plain LZ77 Compression Algorithm Details" - "Processing"

that's where the algorithm brainrot comes from. go read it if you want the whole lore. πŸ”₯


✨ RETURN ✨

dst advanced to new position. πŸ‘‘

that's the whole return value. the buffer pointer, but moved forward. new position, new her. ⭐


✨ SEE ALSO ✨

  • Kernel file ./fs/smb/common/compress/lz77.c β€” the actual source, go read it bestie πŸ’œ
  • lz77_encode_literals(9) β€” the sibling function, the literal counterpart, the other half of the duo 🌈

anyway that's the whole page, no filler, all facts, all slay πŸ’€πŸŒΈ

also lowkey: this page is from ./fs/smb/common/compress and it's dated October 2026 β€” yes, the future, because we're just that ahead. πŸ•°οΈβœ¨ and the manual name up top? Kernel API Manual, iykyk. 🫢

bye bestie, go encode some matches πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from