DEVICE_GET_SOFTC(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’– DEVICE_GET_SOFTC(9) β€” access driver private instance variables πŸ’–

(okay bestie, this one is from the Kernel Developer's Manual β€” and it's literally about grabbing a driver's private instance-variable pointer ✨)

🌸 NAME 🌸

device_get_softc β€” access driver private instance variables

✨ SYNOPSIS ✨

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

void *
device_get_softc(device_t dev);

πŸ¦‹ DESCRIPTION πŸ¦‹

So device_get_softc(dev) returns the driver-specific software context of dev. The softc is automatically allocated and zeroed when the device is attached. πŸ’…

It's also initialized and present when a device is probed, but there are caveats β€” those are described in DEVICE_PROBE(9). πŸ‘€

The size of the allocation is determined by the device's driver_t information used to define the driver. The softc typically encapsulates the state of this instance of the device. πŸŽ€

⚠️ real talk, bestie: driver writers are discouraged from using their own softc management mechanisms. And they should not copy such mechanisms found in drivers in the tree that predate this function. no cap. πŸ’€

🌈 RETURN VALUES 🌈

The pointer to the driver-specific instance variable is returned. that's it, that's the vibe. 🫢

πŸ”₯ SEE ALSO πŸ”₯

πŸ‘‘ AUTHORS πŸ‘‘

This manual page was written by Doug Rabson. iconic. πŸ’œ


πŸŽ€ that's the whole page, bestie. source/version vibes: Debian, dated January 21, 2015, and the manpage tag is DEVICE_GET_SOFTC(9) β€” periodt. πŸ’…βœ¨
πŸ“¦ where this page comes from