enclosure_for_each_device(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ enclosure_for_each_device(9) πŸŽ€

okay so bestie, welcome to the Kernel API Manual. we’re looking at enclosure_for_each_device, and it’s literally giving β€œloop over every enclosure and call your function” energy. no details skipped, periodt πŸ’…


✨ NAME ✨

enclosure_for_each_device β€” calls a function for each enclosure πŸ¦‹


πŸ¦‹ SYNOPSIS πŸ¦‹

int enclosure_for_each_device (int (*fn)(struct enclosure_device *, void *) , void *data );

πŸ“ ARGUMENTS πŸ“

  • fn β€” the function to call πŸ‘‘
  • data β€” the data to pass to each call 🫢

πŸ”₯ DESCRIPTION πŸ”₯

It loops over all the enclosures and calls the function. that’s the whole move, bestie ✨

⚠️ okay this part matters: this function uses a mutex which will be held across calls to fn, so it must have non atomic context. and fn may (although it should not 😭) sleep or otherwise cause the mutex to be held for indefinite periods. like… please do not make the mutex wait forever, i’m begging πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./drivers/misc/enclosure.c β€” and the whole friend group is here too:


okay bye bestie 🫢 source/version: ./drivers/misc, date: October 2026, manual: enclosure_for_each_device(9) β€” slay βœ¨πŸ’–

πŸ“¦ where this page comes from