scsi_report_lun_scan(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… scsi_report_lun_scan(9)

okay so this is a page from the Kernel API Manual β€” yes, the actual kernel docs, and yes we're gonna make it cute. it's all about scanning LUNs with SCSI REPORT LUN results, and honestly? kind of iconic.


✨ SYNOPSIS ✨

int scsi_report_lun_scan (struct Scsi_Host *shost , struct scsi_target
*starget , blist_flags_t bflags , enum scsi_scan_mode rescan );

like, four arguments, one int return, no drama πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • shost β€” the SCSI host pointer, bestie. your entry point to the host.
  • starget β€” which target we're talking about here.
  • bflags β€” zero, or a mix of BLIST_NOLUN, BLIST_REPORTLUN2, or BLIST_NOREPORTLUN. mix responsibly 🫢
  • rescan β€” nonzero if we can skip code that's only needed on the first scan. so like, nonzero = we're doing a repeat and we get to skip the new-kid stuff ✨

🌸 DESCRIPTION 🌸

okay so the whole vibe here is fast scanning for modern (SCSI-3) devices β€” the way it does that is by sending a REPORT LUN command, and then scanning the resulting list of LUNs by calling scsi_probe_and_add_lun. efficient! obsessed! πŸ”₯

now for the conditional tea β˜•:

  • if BLINK_REPORTLUN2 is set, it scans a target that supports more than 8 LUNs, even if that target is older than SCSI-3. yes, older devices can still slay.
  • if BLIST_NOREPORTLUN is set, it returns 1 always. always always.
  • if BLIST_NOLUN is set, it returns 0 always. periodt.
  • if starget->no_report_luns is set, it returns 1 always. no notes, it just does.
side note bestie: the manpage literally spells that one flag BLINK_REPORTLUN2 β€” that's what's written, so that's what we're quoting. no i will not be fixing it, i don't make the rules πŸ’€

πŸ‘‘ RETURN πŸ‘‘

  • 0 β€” scan completed (or no memory, so further scanning is futile 😭)
  • 1 β€” could not scan with REPORT LUN

πŸ¦‹ SEE ALSO πŸ¦‹

kernel file ./drivers/scsi/scsi_scan.c and honestly a whole friend group of functions, all linked together like a group chat:


πŸ’– sign-off πŸ’–

this little masterpiece lives in ./drivers/scsi, and it's dated October 2026 β€” yes, from the future, main character energy fr fr. that's the whole page, bestie, you ate it up πŸŒˆβœ¨πŸŽ€

πŸ“¦ where this page comes from