scsilun_to_int(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… scsilun_to_int(9) β€” like, the kernel API manual bestie ✨

okay so real talk, this one lives in section 9 of the kernel API manual and it's called scsilun_to_int β€” say that five times fast, I dare you 🫢


🌸 NAME 🌸

scsilun_to_int β€” converts a scsi_lun into an int, that's literally the whole gig πŸ’–


✨ SYNOPSIS ✨

u64 scsilun_to_int (struct scsi_lun *scsilun );

πŸŽ€ ARGUMENTS πŸŽ€

  • scsilun β€” the struct scsi_lun that's about to get converted. that's the one, that's our girl 🌈

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: it takes scsilun, converts it out of a struct scsi_lun and into a four-byte host byte-ordered integer, then hands you back the result. iconic behaviour, no notes πŸ‘‘

⚠️ but bestie, listen β€” the caller must check for truncation before using this function. do not skip the vibe check on this one, fr fr 😭

πŸ’€ NOTES πŸ’€

For a description of the LUN format: post SCSI-3, go look at the SCSI Architecture Model; for SCSI-3, go look at the SCSI Controller Commands. iykyk πŸ“š

Given a struct scsi_lun of:

d2 04 0b 03 00 00 00 00

this function returns the integer:

0x0b03d204

like… the way it just flips it around? obsessed πŸŒ€βœ¨

Also, this encoding will return a standard integer LUN for LUNs smaller than 256, which typically use a single level LUN structure with addressing method 0. lowkey neat 🌸


πŸ”₯ SEE ALSO πŸ”₯

go read them, they're all in the group chat πŸ«ΆπŸ’œ


mwah πŸ’‹ this little page comes straight out of ./drivers/scsi, dated October 2026, and it goes by scsilun_to_int(9) β€” stay slay, stay byte-ordered, and remember to check for truncation πŸ’…πŸŽ€

πŸ“¦ where this page comes from