BUS_READ_IVAR(9)
π BUS_READ_IVAR β bestie edition π
okay so. welcome to BUS_READ_IVAR(9), which lives in the Kernel Developer's Manual and is genuinely the most "let me peek at your vibes" pair of functions you'll ever meet. β¨
πΈ NAME πΈ
BUS_READ_IVAR, BUS_WRITE_IVAR β manipulate bus-specific device instance variables
like. the name is literally the whole personality. we're reading and writing instance variables that belong to a bus. no cap. π
π SYNOPSIS π
first you gotta bring the headers, bestie, they're not optional:
#include <sys/param.h>
#include <sys/bus.h>
and then, the icons themselves:
int
BUS_READ_IVAR(device_t dev, device_t child, int index,
uintptr_t *result);
int
BUS_WRITE_IVAR(device_t dev, device_t child, int index,
uintptr_t value);
look at them. so clean. so structured. main character energy fr fr. π
π¦ DESCRIPTION π¦
so here's the tea. β
These two methods manage a bus-specific set of instance variables belonging to a child device. The whole intention here is that each different type of bus defines its own set of appropriate instance variables β think ports and irqs for the ISA bus, etc. Every bus gets to curate its own little collection. it's giving personalised. π
and like, why not just hand the child device a struct and call it a day? great question, bestie. because doing that makes it hard for a bus to add or remove variables without forcing every single driver to be edited and recompiled. and that might not even be possible for vendor supplied binary drivers. π
so instead of that chaos: instance variables. flexible. iconic. able to grow without dragging the whole codebase into a recompile situation. we love a design decision that respects everyone's time. π«Ά
β RETURN VALUES β
Zero is returned on success. otherwise, an appropriate error is returned. that's it, that's the whole vibe check β 0 = slay, anything else = read the error and cope. π
π SEE ALSO π
go read those too, you'll be obsessed. iykyk. π
π AUTHORS π
This manual page was written by Doug Rabson. thank you for your service, king. π
lowkey reminder bestie: every option, every argument, every return value here is exactly as written. no improvising in kernel land. periodt. π
Debian β’ June 16, 1998 β’ that's the source, the date, and the whole BUS_READ_IVAR(9) moment β mwah, take care of your ivars and they'll take care of you πβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1998 Doug Rabson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms