int_to_scsilun(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the struct scsi_lun that 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 🧚

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