scsilun_to_int(9)
π 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β thestruct scsi_lunthat'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 π₯
- Kernel file
./drivers/scsi/scsi_common.c scsi_device_type(9)int_to_scsilun(9)scsi_normalize_sense(9)scsi_sense_desc_find(9)scsi_build_sense_buffer(9)scsi_set_sense_information(9)scsi_set_sense_field_pointer(9)
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
- 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