scsi_alloc_target(9)
π scsi_alloc_target(9) β Kernel API Manual π
okay so bestie, welcome to the manual page for scsi_alloc_target π this one lives in the Kernel API Manual and honestly? it's a whole vibe. it's giving "matchmaker for SCSI targets" β¨
β¨ NAME β¨
scsi_alloc_target β allocate a new or find an existing target πΈ
like, it either finds you a target that already exists or it makes a brand new one. no cap.
π¦ SYNOPSIS π¦
struct scsi_target * scsi_alloc_target (struct device *parent , int
channel , uint id );
π ARGUMENTS π
parentβ the parent of the target π full disclosure: it doesn't have to be a SCSI host, so no pressurechannelβ the target channel number β¨ if there are no channels at all, it's justzeroidβ the target id number π«Ά
π DESCRIPTION π
okay so here's the tea β if a target already exists and it hasn't already gone into STARGET_DEL state, you get that existing target back. iconic. but if it's already in STARGET_DEL? nope, bye β it allocates a shiny new target for you instead π
and listen, this is the important part, so pay attention bestie π: the target is returned with an incremented reference, which means the caller is responsible for both reaping and doing a last put. not me handing you a whole responsibility like that π but fr fr, that's on you now.
π¨ reminder: incremented reference = your problem now. reap it, then do the last put. don't leave it hanging π
π SEE ALSO π
Kernel file ./drivers/scsi/scsi_scan.c β plus the whole friend group π:
scsi_complete_async_scans(9)scsi_unlock_floptical(9)scsi_alloc_sdev(9)scsi_target_reap_ref_release(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)
and that's the page babes π«Ά shoutout to ./drivers/scsi for keeping it real, dated October 2026 β¨ mwah π go forth and scsi_alloc_target 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