scsi_probe_and_add_lun(9)
π scsi_probe_and_add_lun β the Kernel API Manual glow-up β¨
okay so bestie, welcome to scsi_probe_and_add_lun(9), straight out of the Kernel API Manual. this is the function that goes "hiii is anyone home at this LUN??" and if somebody is home, it moves them in and sets up the whole apartment. no cap, it's giving talent show energy π
πΈ NAME πΈ
scsi_probe_and_add_lun β probe a LUN, and if a LUN is found, add it. that's literally the whole job description and she ate π
β¨ SYNOPSIS β¨
int scsi_probe_and_add_lun (struct Scsi_Host *shost , struct scsi_target
*starget , u64 lun , blist_flags_t *bflagsp , struct scsi_device **sdevp
, enum scsi_scan_mode rescan , void *hostdata );
seven arguments. SEVEN. she's high maintenance but she's worth it π
π¦ ARGUMENTS π¦
shostβ SCSI host pointer. the whole scene, the venue, the main character location πstargetβ pointer to the target device structure. iykyk, it's the target's vibes π―lunβ LUN of the target device. the specific unit number we're sliding into πbflagspβ store bflags here if notNULL. if it isNULL, she simply does not store them, and that's valid π«Άsdevpβ probe the LUN corresponding to thisscsi_deviceπrescanβ if not equal toSCSI_SCAN_INITIAL, skip some code only needed on first scan. so like, been here, done that, skipping the rerun πhostdataβ passed toscsi_alloc_sdev. just hand it over, it knows what to do π
π₯ DESCRIPTION π₯
so here's the plot: call scsi_probe_lun, and if a LUN with an attached device is found, allocate and set it up by calling scsi_add_lun.
that's it. that's the arc. probe, then add. iconic behaviour honestly.
and the outcome is one of these three, no in-between:
SCSI_SCAN_NO_RESPONSE: could not allocate or setup ascsi_deviceπ it's giving ghostedSCSI_SCAN_TARGET_PRESENT: target responded, but no device is attached at the LUN π someone picked up the phone but nobody's at the LUNSCSI_SCAN_LUN_PRESENT: a newscsi_devicewas allocated and initialized π literally new device just dropped, we love to see it
π 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_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_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)
bestie, one thing:rescangenuinely does change behaviour β anything that isn'tSCSI_SCAN_INITIALmeans some first-scan-only code gets skipped. don't come for me if you passed the wrong enum, that's on you π«Ά
and that's the page!! π this lil beauty lives under ./drivers/scsi, comes to you from the Kernel API Manual, dated October 2026, and yes she signs her name at the bottom like the queen she is: scsi_probe_and_add_lun(9). mwah πππ§π
π¦ 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