decode_rs16(9)
π decode_rs16(9) β the kernel API manual, but make it cute
okay so bestie, buckle up, because we're diving into decode_rs16(9) β it's a kernel API manual page and honestly it's lowkey iconic. β¨ It lives in the Kernel API Manual section (section 9, iykyk), and it's all about decoding a codeword with 16-bit data width. yes, sixteen. not eight. sixteen. don't mix them up, that's the whole plot. π
β¨ NAME β¨
decode_rs16 β Decode codeword (16bit data width) π¦
πΈ SYNOPSIS πΈ
int decode_rs16 (struct rs_control *rsc , uint16_t *data , uint16_t *par
, int len , uint16_t *s , int no_eras , int *eras_pos , uint16_t invmsk
, uint16_t *corr );
that's the whole signature, copied exactly, no cap. π
π«Ά ARGUMENTS π«Ά
rscβ the rs control structure. it's the main character here, thestruct rs_controlthat holds all the decoder's little secrets. πdataβ data field of a given type. this is the actual payload we're working with. πparβ received parity data field. the parity bits that came in with the data. πlenβ data length. how much data we're talking about, anint. πΈsβ syndrome data field, must be in index form (ifNULL, syndrome is calculated). so like, if you passNULLhere, it'll just go ahead and compute the syndrome for you. thoughtful queen behavior. β¨no_erasβ number of erasures. counting them erasures, anint. π¦eras_posβ position of erasures, can beNULL. it's aint *and yes,NULLis allowed, she's flexible. πinvmskβ invert data mask (will be xored on data, not on parity!). read that again bestie: on data, not on parity β that distinction is doing a lot of work. β οΈcorrβ buffer to store correction bitmask oneras_pos. theuint16_t *where the correction bitmask goes. π
π₯ DESCRIPTION π₯
Each field in the data array contains up to symbol size bits of valid data. that's it, that's the description. short, sweet, ate. π
β NOTE β
okay so here's the important tea, bestie, do not skip this: β
the rc_control struct rsc contains buffers which are used for decoding, so the caller has to ensure that decoder invocations are serialized. like, no parallel chaos here β serialize those calls, or you're gonna have a bad time. π
it returns the number of corrected symbols, or -EBADMSG for uncorrectable errors. and heads up: the count includes errors in the parity. so don't be surprised when the number is bigger than you expected β parity counts too. π
fr fr: -EBADMSG means the errors were not correctable. that's a real error, not a vibe. π
π SEE ALSO π
go look at these, they're all in the Kernel file ./lib/reed_solomon/reed_solomon.c and honestly the whole friend group is iconic:
codec_init(9)free_rs(9)init_rs_internal(9)init_rs_gfp(9)init_rs_non_canonical(9)encode_rs8(9)decode_rs8(9)encode_rs16(9)
(yes, there's an encode_rs16? no β it's not listed. what's listed is what's listed, i don't make the rules. π§)
and that's the page! this one's straight outta ./lib/reed_solomon, from the Kernel API Manual, dated October 2026 in the footer. slay, go serialize your decoder calls, and remember: -EBADMSG is not a personality trait. bye bestie! πβ¨ππ¦πΈπ
π«Ά
π¦ 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