mirror of
https://github.com/opnsense/src.git
synced 2026-02-03 18:14:35 -06:00
LinuxKPI: add container_of_const()
Implement container_of_const() needed for wireless driver updates. Sponsored by: The FreeBSD Foundation Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D49999 (cherry picked from commit 6841b9987e83fdd9a5b05ceafc20811469222d8b)
This commit is contained in:
parent
a072e67c04
commit
f20e1f6241
@ -41,6 +41,14 @@
|
||||
(type *)((uintptr_t)__p - offsetof(type, member)); \
|
||||
})
|
||||
|
||||
#define container_of_const(ptr, type, member) \
|
||||
_Generic(ptr, \
|
||||
const typeof(*(ptr)) *: \
|
||||
(const type *)container_of(ptr, type, member), \
|
||||
default: \
|
||||
container_of(ptr, type, member) \
|
||||
)
|
||||
|
||||
#define typeof_member(type, member) __typeof(((type *)0)->member)
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user