diff --git a/sys/compat/linuxkpi/common/include/linux/container_of.h b/sys/compat/linuxkpi/common/include/linux/container_of.h --- a/sys/compat/linuxkpi/common/include/linux/container_of.h +++ b/sys/compat/linuxkpi/common/include/linux/container_of.h @@ -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