scsi_add_lun(9)
β¨ scsi_add_lun(9) β¨
okay so bestie, welcome to the Kernel API Manual π
this one's a little kernel function called scsi_add_lun, and it's literally the glow-up station for a scsi_device. no cap.
πΈ NAME πΈ
scsi_add_lun β allocate and fully initialize a scsi_device π«Ά
π SYNOPSIS π
int scsi_add_lun (struct scsi_device *sdev , unsigned char *inq_result ,
blist_flags_t *bflags , int async );
that's the whole signature, keep it exactly like that, she's precise π
π¦ ARGUMENTS π¦
sdevβ this cutie holds the information that's gonna get stored in the newscsi_deviceβ¨inq_resultβ holds the result of a previous INQUIRY to the LUN π like, the receipts from the last time someone askedbflagsβ the black/white list flag π€π€ yes both, she contains multitudesasyncβ1if this device is being scanned asynchronously β‘ (otherwise it's doing the synchronous thing, iykyk)
π DESCRIPTION π
So basically: initialize the scsi_device sdev. π«Ά And optionally set fields based on the values in *bflags β only if you pass them, no pressure, she's flexible like that π
π RETURN π
SCSI_SCAN_NO_RESPONSEβ could not allocate or setup ascsi_deviceπ it's giving flop era, no device for youSCSI_SCAN_LUN_PRESENTβ a newscsi_devicewas allocated and initialized π main character energy, she ate
β SEE ALSO β
kernel file ./drivers/scsi/scsi_scan.c π and like, the whole friend group:
scsi_complete_async_scans(9)scsi_unlock_floptical(9)scsi_alloc_sdev(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_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)
ngl this page lives in ./drivers/scsi and it's dated October 2026 β so yeah, future vibes only π§β¨
k that's it, go forth and add your LUNs bestie, slay πππ¦
π¦ 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