bus: Add a new IVAR accessor to check for the existence of an IVAR

<varp>_has_<var> returns true if the given IVAR can be read.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D55352
This commit is contained in:
John Baldwin
2026-02-24 15:28:28 -05:00
parent 82b293ea69
commit cb5a0eb053
+11
View File
@@ -945,6 +945,17 @@ DECLARE_MODULE(_name##_##busname, _name##_##busname##_mod, \
*/
#define __BUS_ACCESSOR(varp, var, ivarp, ivar, type) \
\
static __inline bool \
varp ## _has_ ## var(device_t dev) \
{ \
uintptr_t v = 0; \
int e; \
\
e = BUS_READ_IVAR(device_get_parent(dev), dev, \
ivarp ## _IVAR_ ## ivar, &v); \
return (e == 0); \
} \
\
static __inline type \
varp ## _get_ ## var(device_t dev) \
{ \