DEVICE_SET_DESC(9)

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

πŸ’… DEVICE_SET_DESC(9) β€” bestie's guide to device descriptions ✨

okay so this is the Kernel Developer's Manual, and we're talking about device_set_desc, device_set_descf, device_set_desc_copy, and device_get_desc β€” the little squad that handles a device's description. yes bestie, you're gonna be setting and getting desc strings like a main character πŸŽ€


🌸 NAME 🌸

device_set_desc, device_set_descf, device_set_desc_copy, device_get_desc β€” access the description of a device πŸ’–


✨ SYNOPSIS ✨

okay so first the includes, gotta have 'em:

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

then the actual functions, slay:

void
device_set_desc(device_t dev, const char *desc);

void
device_set_descf(device_t dev, const char *fmt, ...);

void
device_set_desc_copy(device_t dev, const char *desc);

const char *
device_get_desc(device_t dev);

πŸ”₯ DESCRIPTION πŸ”₯

So what we're doing here is manipulating the verbose description of a device β€” literally its little blurb, its bio, its whole vibe ✨

This description (if it's actually present) gets printed as part of the message when the device is attached during autoconfiguration. so like, it's the thing that shows up in the boot chatter, iconic.

Now the variations, because of course there are variations:

  • device_set_desc_copy() β€” use this one when the string you're passing in is a temporary buffer that's gonna get overwritten 😭 In that case the system copies the string for you. Otherwise (with the plain device_set_desc()), the pointer you passed is just used directly β€” no copy, no safety net, fr fr.
  • device_set_descf() β€” it's the printf-like version of device_set_desc(). so you can format your desc all cute instead of pre-building the string yourself. obsessed πŸ’…
ngl the pointer-vs-copy distinction is the whole plot here β€” if your string is temporary and you don't use the _copy version, that's a you problem waiting to happen πŸ™ˆ

πŸ¦‹ SEE ALSO πŸ¦‹

  • device(9) β€” go read it, it's the whole context iykyk 🫢

πŸ‘‘ AUTHORS πŸ‘‘

This manual page was written by Doug Rabson. king behavior, we stan πŸ’–


and that's the whole page bestie, no cap πŸ’œ this was the Debian edition, dated January 9, 2024 β€” catch you in the next manpage, mwah πŸŽ€βœ¨πŸŒˆ

πŸ“¦ where this page comes from