linux/include/linux/percpu-rwsem.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_PERCPU_RWSEM_H
#define _LINUX_PERCPU_RWSEM_H

#include <linux/atomic.h>
#include <linux/percpu.h>
#include <linux/rcuwait.h>
#include <linux/wait.h>
#include <linux/rcu_sync.h>
#include <linux/lockdep.h>

struct percpu_rw_semaphore {};

#ifdef CONFIG_DEBUG_LOCK_ALLOC
#define __PERCPU_RWSEM_DEP_MAP_INIT(lockname)
#else
#define __PERCPU_RWSEM_DEP_MAP_INIT
#endif

#define __DEFINE_PERCPU_RWSEM(name, is_static)

#define DEFINE_PERCPU_RWSEM(name)
#define DEFINE_STATIC_PERCPU_RWSEM(name)

extern bool __percpu_down_read(struct percpu_rw_semaphore *, bool);

static inline void percpu_down_read(struct percpu_rw_semaphore *sem)
{}

static inline bool percpu_down_read_trylock(struct percpu_rw_semaphore *sem)
{}

static inline void percpu_up_read(struct percpu_rw_semaphore *sem)
{}

extern bool percpu_is_read_locked(struct percpu_rw_semaphore *);
extern void percpu_down_write(struct percpu_rw_semaphore *);
extern void percpu_up_write(struct percpu_rw_semaphore *);

static inline bool percpu_is_write_locked(struct percpu_rw_semaphore *sem)
{}

extern int __percpu_init_rwsem(struct percpu_rw_semaphore *,
				const char *, struct lock_class_key *);

extern void percpu_free_rwsem(struct percpu_rw_semaphore *);

#define percpu_init_rwsem(sem)

#define percpu_rwsem_is_held(sem)
#define percpu_rwsem_assert_held(sem)

static inline void percpu_rwsem_release(struct percpu_rw_semaphore *sem,
					unsigned long ip)
{}

static inline void percpu_rwsem_acquire(struct percpu_rw_semaphore *sem,
					bool read, unsigned long ip)
{}

#endif