decode_rs16(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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, the struct rs_control that 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, an int. 🌸
  • s β€” syndrome data field, must be in index form (if NULL, syndrome is calculated). so like, if you pass NULL here, it'll just go ahead and compute the syndrome for you. thoughtful queen behavior. ✨
  • no_eras β€” number of erasures. counting them erasures, an int. πŸ¦‹
  • eras_pos β€” position of erasures, can be NULL. it's a int * and yes, NULL is 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 on eras_pos. the uint16_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:

(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