scsi_alloc_sdev(9)
β¨ 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 ascsi_devicefor, like, which one, be specific πlunβ which lun. that's the one. that's the lun β¨hostdataβ usuallyNULL, and honestly it gets set by->sdev_initinstead, 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:
scsi_complete_async_scans(9)scsi_unlock_floptical(9)scsi_target_reap_ref_release(9)scsi_alloc_target(9)scsi_target_reap(9)scsi_sanitize_inquiry_string(9)scsi_probe_lun(9)scsi_add_lun(9)scsi_inq_str(9)scsi_probe_and_add_lun(9)scsi_sequential_lun_scan(9)scsi_report_lun_scan(9)scsi_add_device(9)scsi_scan_target(9)scsi_prep_async_scan(9)scsi_finish_async_scan(9)scsi_scan_host(9)scsi_get_pseudo_sdev(9)
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
- 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