BUS_CHILD_DELETED(9)

πŸ’– BUS_CHILD_DELETED πŸ’–

okay bestie, gather round, because today we're talking about the Kernel Developer's Manual page for BUS_CHILD_DELETED(9) β€” yes it's giving niche, yes it's giving kernel internals, and yes you're gonna understand it, periodt. πŸŽ€


✨ NAME ✨

BUS_CHILD_DELETED β€” notify a bus device that a child is being deleted πŸ¦‹

no cap, that's literally the whole vibe. a child device is getting yeeted, and the bus needs to know about it.


✨ SYNOPSIS ✨

#include <sys/param.h>
#include <sys/bus.h>

void
BUS_CHILD_DELETED(device_t dev, device_t child);

so you pull in those two headers like the icon you are, and then there's this function signature. two device_t args, dev and child, returns void β€” meaning it's not handing you anything back, it's just doing its thing and dipping. πŸ’…


✨ DESCRIPTION ✨

so here's the tea. πŸ“ The BUS_CHILD_DELETED() method gets invoked by the new-bus framework when a device is deleted. that's it, that's the moment, the framework is like "hey, this device is gone now" and it calls this method.

and why would a bus driver care? because a bus driver can provide an implementation of this method to release bus-specific resources that are associated with a device β€” think stuff like instance variables. 🧚 so basically it's your cleanup moment, your little goodbye ritual, the part where you let go of everything that was tied to that child device.

ngl if you're writing a bus driver and you've got stuff hanging off a device that needs tidying up when it's deleted, this is your girl. 🫢

✨ SEE ALSO ✨

  • BUS_ADD_CHILD(9) β€” the other half of the story, the arrival not the departure πŸ‘‘
  • device(9) β€” the whole device concept, go read it, it's lowkey important

✨ HISTORY ✨

The BUS_CHILD_DELETED() method first appeared in FreeBSD 10.0. so it's been around a minute, and it's still serving. πŸ”₯


and that's the whole page, bestie β€” you ate, you understood kernel bus callbacks, main character energy fr fr. 😭✨

this page came to you from Debian, dated August 21, 2012, filed under BUS_CHILD_DELETED(9) β€” mwah, take care of her. πŸ’œπŸŒΈ

πŸ“¦ where this page comes from