scsi_probe_and_add_lun(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 not NULL. if it is NULL, she simply does not store them, and that's valid 🫢
  • sdevp β€” probe the LUN corresponding to this scsi_device πŸ’–
  • rescan β€” if not equal to SCSI_SCAN_INITIAL, skip some code only needed on first scan. so like, been here, done that, skipping the rerun πŸ™ˆ
  • hostdata β€” passed to scsi_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 a scsi_device 😭 it's giving ghosted
  • SCSI_SCAN_TARGET_PRESENT: target responded, but no device is attached at the LUN πŸ’€ someone picked up the phone but nobody's at the LUN
  • SCSI_SCAN_LUN_PRESENT: a new scsi_device was 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:


bestie, one thing: rescan genuinely does change behaviour β€” anything that isn't SCSI_SCAN_INITIAL means 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