scsi_alloc_target(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 pressure
  • channel β€” the target channel number ✨ if there are no channels at all, it's just zero
  • id β€” 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 πŸ’–:


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