scsi_report_lun_scan(9)
π 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 ofBLIST_NOLUN,BLIST_REPORTLUN2, orBLIST_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_REPORTLUN2is 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_NOREPORTLUNis set, it returns1always. always always. - if
BLIST_NOLUNis set, it returns0always. periodt. - if
starget->no_report_lunsis set, it returns1always. 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:
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_add_lun(9)scsi_inq_str(9)scsi_probe_and_add_lun(9)scsi_sequential_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)
π 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
- 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