int_to_scsilun(9)
π int_to_scsilun(9) β the Kernel API Manual, bestie edition π
okay so picture this: you're deep in the kernel, you've got an int (well, a u64) that used to be a LUN, and you need the actual struct scsi_lun back. that's this function. it's giving "unpacking my emotional baggage" but make it SCSI. β¨
πΈ NAME πΈ
int_to_scsilun β reverts an int into a scsi_lun. yes literally reverses the vibe. no cap. π
π¦ SYNOPSIS π¦
void int_to_scsilun (u64 lun , struct scsi_lun *scsilun );
π ARGUMENTS π
lunβ the integer that's about to be reverted π«Ά like, it's the number you're un-packing, bestie.scsilunβ thestruct scsi_lunthat gets set. this is the glow-up destination.
β¨ DESCRIPTION β¨
so scsilun_to_int had one job: pack an 8-byte LUN value into an int. this routine? this routine does the reverse β it unpacks that int right back into the LUN value. it's the undo button. the "jk, come back" of the pair. ππ₯
it reverts the functionality of scsilun_to_int, periodt. π
π NOTES π
genuinely obsessed with this example, watch:
given an integer: 0x0b03d204
this function returns a struct scsi_lun of:
d2 04 0b 03 00 00 00 00
the way it just... reorders the bytes. main character energy fr fr. πβ
π§ SEE ALSO π§
- Kernel file
./drivers/scsi/scsi_common.c scsi_device_type(9)scsilun_to_int(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)
iykyk β go read the whole friend group. π«Άπ
and that's the page! source is ./drivers/scsi, dated October 2026 β mwah, slay, go unpack some LUNs responsibly π
ππ¦
π¦ 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