BUS_GENERIC_ATTACH(9)
π BUS_GENERIC_ATTACH π
okay so this is a page from the Kernel Developer's Manual β it's BUS_GENERIC_ATTACH(9), and bestie, if you're writing bus code, this one's about to be your new fave. It's the generic implementation of DEVICE_ATTACH for buses. iconic behavior, honestly.
β¨ SYNOPSIS β¨
the vibe check, in code:
#include <sys/param.h>
#include <sys/bus.h>
int
bus_generic_attach(device_t dev);
that's it. that's the whole thing. dev is a device_t, and it returns an int. slay.
π¦ DESCRIPTION π¦
so what does this actually do? this function hands you a ready-made implementation of the DEVICE_ATTACH(9) method β the kind of thing most bus code can just use instead of writing itself from scratch. no cap, it's a huge time-saver.
and what's the actual work? it simply calls device_probe_and_attach(9) for each child device attached to the bus. that's literally the whole personality. one job, does it well. main character energy but make it minimal. π
like β it's not out here doing extra. it's just: here are your children, go probe and attach each one. periodt.
πΈ RETURN VALUES πΈ
- Zero β returned on success. π
- otherwise β an appropriate error is returned. π (so like, check that return value, bestie, don't just ignore it)
π₯ SEE ALSO π₯
go read these next, iykwup:
π AUTHORS π
This manual page was written by Doug Rabson. thank you Doug, king behavior fr fr π«Ά
and that's the page! this beauty came from Debian, dated January 15, 2017 β a little vintage moment, but the info's still iconic. πβ bye bestie, go attach some devices π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- Copyright (c) 1998 Doug Rabson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms