shost_for_each_device(9)
π shost_for_each_device β¨
okay bestie, welcome to the Kernel API Manual β this one's a little iterator that's literally the main character of your SCSI host loop π
πΈ NAME πΈ
shost_for_each_device β iterate over all devices of a host π«
β¨ SYNOPSIS β¨
shost_for_each_device (sdev , shost );
π«Ά ARGUMENTS π«Ά
sdevβ thestruct scsi_deviceto use as a cursor π (yes, it's your lil pointer-bestie that walks the list)shostβ thestruct scsi_hostto iterate over π¦ (this is the host whose devices you're gonna meet)
π DESCRIPTION π
So this is an iterator that returns each device attached to shost. Like, every single one, one at a time, slay π
Here's the tea though: this loop takes a reference on each device and releases it at the end β so the refcounting is handled for you, no cap π
β οΈ But if youbreakout of the loop early, the loop never gets to the end, so you must callscsi_device_put(sdev)yourself. Fr fr, don't forget, or that reference is just gonna sit there π
π₯ SEE ALSO π₯
- Kernel file
./include/scsi/scsi_device.hstructscsi_vpd(9) __shost_for_each_device(9)scsi_device_is_pseudo_dev(9)scsi_device_supports_vpd(9)
okay that's the whole page, periodt π
this lil gem lives in ./include/scsi and the version stamp says October 2026 β go forth and iterate responsibly, bestie ππ
π¦ 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