scsi_alloc_sdev(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ scsi_alloc_sdev(9) ✨

okay bestie so we're in the Kernel API Manual today and this one is literally about making a whole new scsi_device out of thin air 🫢 stay with me, it's actually so good.


🌸 NAME 🌸

scsi_alloc_sdev β€” allocate and setup a scsi_Device πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

struct scsi_device * scsi_alloc_sdev (struct scsi_target *starget , u64
lun , void *hostdata );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • starget β€” the target you wanna allocate a scsi_device for, like, which one, be specific πŸ’–
  • lun β€” which lun. that's the one. that's the lun ✨
  • hostdata β€” usually NULL, and honestly it gets set by ->sdev_init instead, so don't stress πŸ™ˆ

🌈 DESCRIPTION 🌈

So what it does is: allocate, initialize for io, and return a pointer to a scsi_Device. All three. Iconic behavior honestly πŸ‘‘

It stores the shost, channel, id, and lun in the scsi_Device, and then adds that scsi_Device to the appropriate list. slay, organized, everything in its place πŸŽ€

Return value: a scsi_Device pointer, or NULL on failure 😭 (not the vibe, but it happens).


πŸ”₯ SEE ALSO πŸ”₯

Kernel file ./drivers/scsi/scsi_scan.c β€” plus all these besties, go read them:


no cap, that's the whole page β€” go forth and allocate responsibly πŸ’œ

kay bye ily, this came from the ./drivers/scsi girlies, dated October 2026, and yes it's still called scsi_alloc_sdev(9) in case you forgot already πŸ“πŸ’…

πŸ“¦ where this page comes from