DEVICE_GET_IVARS(9)

πŸ’– DEVICE_GET_IVARS(9) πŸ’–

okay bestie, welcome to the device_get_ivars / device_set_ivars page from the Kernel Developer's Manual ✨ this one's short and sweet but it's lowkey important, so let's get into it 🫢


🌸 NAME 🌸

device_get_ivars, device_set_ivars β€” access bus private variables πŸ’…


✨ SYNOPSIS ✨

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

void *
device_get_ivars(device_t dev);

void
device_set_ivars(device_t dev, void *ivar);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the way this works: device_get_ivars() hands you back the bus-specific instance variables of a device. it's giving "here's your stuff, bestie" πŸŽ€

and then device_set_ivars() is the reverse β€” it sets the bus-specific instance variables of a device. iconic duo fr fr πŸ‘‘

ngl, typically only bus drivers use these functions. the kernel is literally assuming that the bus driver is gonna manage this memory β€” there is no automatic memory allocation or deallocation happening here. none. zero. not a crumb. 😭

so if you're a client driver, please don't come through here β€” you should be accessing ivars through the BUS_READ_IVAR(9) interface instead. that's the vibe check, and you passed it πŸ’–


🌈 SEE ALSO 🌈


πŸŽ€ AUTHORS πŸŽ€

this manual page was written by Doug Rabson. thank you Doug, we are obsessed 🫢✨


and that's a wrap, bestie πŸ¦‹ this page came to you from Debian, dated June 16, 1998 β€” vintage fr, main character energy from the very start πŸ‘‘πŸ’… slay, mwah πŸ“

πŸ“¦ where this page comes from