diff --git a/sys/compat/linuxkpi/common/include/linux/rwsem.h b/sys/compat/linuxkpi/common/include/linux/rwsem.h index db9457a9aa4..fbb71a2d490 100644 --- a/sys/compat/linuxkpi/common/include/linux/rwsem.h +++ b/sys/compat/linuxkpi/common/include/linux/rwsem.h @@ -35,6 +35,7 @@ #include #include #include +#include struct rw_semaphore { struct sx sx; @@ -61,6 +62,14 @@ struct rw_semaphore { #define _rwsem_name(...) __rwsem_name(__VA_ARGS__) #define rwsem_name(name) _rwsem_name(name, __FILE__, __LINE__) +#define DECLARE_RWSEM(name) \ +struct rw_semaphore name; \ +static void name##_rwsem_init(void *arg) \ +{ \ + linux_init_rwsem(&name, rwsem_name(#name)) \ +} \ +SYSINIT(name, SI_SUB_LOCKS, SI_ORDER_SECOND, name##_rwsem_init, NULL) + static inline void linux_init_rwsem(struct rw_semaphore *rw, const char *name) {