shost_for_each_device(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the struct scsi_device to use as a cursor πŸ‘€ (yes, it's your lil pointer-bestie that walks the list)
  • shost β€” the struct scsi_host to 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 you break out of the loop early, the loop never gets to the end, so you must call scsi_device_put(sdev) yourself. Fr fr, don't forget, or that reference is just gonna sit there πŸ’€

πŸ”₯ SEE ALSO πŸ”₯


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