mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 00:32:25 -04:00
Implement DECLARE_RWSEM() macro in the LinuxKPI to initialize a
Read-Write semaphore during module init time. MFC after: 1 week Sponsored by: Mellanox Technologies
This commit is contained in:
parent
684bcfec89
commit
19bf8ef562
1 changed files with 9 additions and 0 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#include <sys/lock.h>
|
||||
#include <sys/sx.h>
|
||||
#include <sys/libkern.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue