__shost_for_each_device(9)
π
__shost_for_each_device (9) β Kernel API Manual, bestie edition π
okay so like. welcome to the kernel API manual, specifically the page for __shost_for_each_device β and yes the double underscore is part of the name, it's giving "i'm the internal one, don't @ me" energy π
β¨ NAME β¨
__shost_for_each_device β iterate over all devices of a host (UNLOCKED) ππ
β¨ SYNOPSIS β¨
__shost_for_each_device (sdev , shost );
π«Ά ARGUMENTS π«Ά
sdevβ thestruct scsi_deviceyou're using as a cursor, like your little finger on the page tracking where you are πshostβ thestruct scsi_hostyou're iterating over, the main character of this whole thing π
πΈ DESCRIPTION πΈ
So this is an iterator that hands you every device attached to shost, one at a time. Cute, right? But β and this is the important part, bestie β it does _not_ take a reference on the scsi_device. not even a little one. so the whole loop has to be protected by shost->host_lock. like, the entire thing. no cap. π
β οΈ NOTE β οΈ
The only reason to use this one is because you need to access the device list in interrupt context. that's it. that's the whole vibe. otherwise you really want to use shost_for_each_device instead β it's right there, it does the reference stuff for you, it's the iconic choice π
β¨
fr fr: if you're not in interrupt context, you're just making extra work for yourself for no reason π
π¦ SEE ALSO π¦
- Kernel file
./include/scsi/scsi_device.h - struct
scsi_vpd(9) shost_for_each_device(9)scsi_device_is_pseudo_dev(9)scsi_device_supports_vpd(9)
go read those next, iykyk π
mwah π this page lives in ./include/scsi, going out in October 2026 β that's the date and the source, bestie, and yes i remembered them both, you're welcome π«Άβ¨π
π¦ 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