LZ4_saveDict(9)
πΎ LZ4_saveDict(9) β the Kernel API Manual, but make it cute β¨
okay so bestie, this is LZ4_saveDict from the kernel API manual and it is literally the "move my stuff somewhere safe" function π«Ά it lives in the kernel, it deals with LZ4 compression streams, and it's way less scary than the manpage makes it look. let's go π
πΈ SYNOPSIS πΈ
int LZ4_saveDict (LZ4_stream_t *streamPtr , char *safeBuffer , int
dictSize );
that's the whole signature, no cap β
π ARGUMENTS π
streamPtrβ pointer to theLZ4_stream_tstructure. this is your stream, your main character πsafeBufferβ the buffer you're saving the dictionary to. heads up: it must be already allocated by you, this function does not do your malloc-ing for you πdictSizeβ the size ofsafeBuffer. i.e. how much room you're giving it π
π¦ DESCRIPTION π¦
so here's the vibe check π« if the data block you compressed earlier is not guaranteed to remain available at its memory location (rude of it, honestly), you save it into a safer place β specifically a char *safeBuffer. that's it. that's the whole job. it's giving "moving your plants before the landlord visits" π±β¨
lowkey important: this is about memory that might move or disappear on you. the function exists precisely because "it'll still be there, probably" is not a compression strategy π
π§ NOTE π§
pay attention bestie because this is the good part π₯ you do not need to call LZ4_loadDict afterwards β the dictionary is immediately usable, so you can just go straight to calling LZ4_compress_fast_continue. no extra steps, no loading ritual, we love efficiency π
π RETURN π
it returns the saved dictionary size in bytes (necessarily <= dictSize, always, it's not gonna overdo it π
), or 0 if there was an error π
β SEE ALSO β
go read these next, i promise they're not that deep, iykyk:
- kernel file:
./include/linux/lz4.hπ LZ4_compressBound(9)LZ4_compress_default(9)LZ4_compress_fast(9)LZ4_compress_destSize(9)LZ4_decompress_fast(9)LZ4_decompress_safe(9)LZ4_decompress_safe_partial(9)LZ4_compress_HC(9)LZ4_resetStreamHC(9)LZ4_loadDictHC(9)LZ4_compress_HC_continue(9)LZ4_saveDictHC(9)LZ4_resetStream(9)LZ4_loadDict(9)LZ4_compress_fast_continue(9)LZ4_setStreamDecode(9)LZ4_decompress_safe_continue(9)LZ4_decompress_fast_continue(9)LZ4_decompress_safe_usingDict(9)LZ4_decompress_fast_usingDict(9)
and that's the page, bestie π«Ά this one ships out of ./include/linux, dated October 2026, and the manual entry is LZ4_saveDict(9) β slay, go compress something safely ππ
π¦ 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