DEVCLASS_GET_MAXUNIT(9)
π DEVCLASS_GET_MAXUNIT β kernel developer's manual, but make it make sense
okay bestie, so this is a page from the Kernel Developer's Manual, and the function we're stanning today is devclass_get_maxunit. it's giving "small function, big confusion" energy, but don't worry β we're gonna get through it together π«Ά
β¨ NAME β¨
devclass_get_maxunit β find the maximum unit number in the class π’
π SYNOPSIS π
#include <sys/param.h>
#include <sys/bus.h>
int
devclass_get_maxunit(devclass_t dc);
so you include those two headers, and then you call it with a devclass_t dc. that's the whole vibe. π¦
πΈ DESCRIPTION πΈ
okay so here's the tea β β this function returns the next unit number to be allocated to device instances in the devclass.
and like, read that carefully bestie: it's one greater than the highest currently allocated unit. not the highest one, the one after the highest one. the way that's a whole plot twist, i know π
π RETURN VALUES π
- if
dcisNULL, it returns-1π - otherwise, it returns the next unit number in
dc's devclass β¨
π§ ERRORS π§
None. literally none. not a single one. slay π
π₯ SEE ALSO π₯
go read those too, iykyk π
π AUTHORS π
this manual page was written by Doug Rabson. iconic behavior, thank you Doug π«Ά
π BUGS π
okay so the name is confusing, because it's actually one greater than the maximum unit π like the naming committee really said "let's make it a little evil" and honestly? it's giving misleading. so just remember: it's not the max, it's max + 1. periodt. π
ngl, this one's tiny but the name will absolutely trip you up if you don't read the BUGS section. so likeβ¦ read it. please. for me. π
and that's the whole page, bestie! this one came from the Debian flavor of the Kernel Developer's Manual, dated September 10, 2010, and it's the DEVCLASS_GET_MAXUNIT(9) page β go forth and allocate responsibly πβ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 1998 Doug Rabson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms