linux/include/linux/rwlock_types.h

#ifndef __LINUX_RWLOCK_TYPES_H
#define __LINUX_RWLOCK_TYPES_H

#if !defined(__LINUX_SPINLOCK_TYPES_H)
# error "Do not include directly, include spinlock_types.h"
#endif

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

#ifndef CONFIG_PREEMPT_RT
/*
 * generic rwlock type definitions and initializers
 *
 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
 * Released under the General Public License (GPL).
 */
rwlock_t;

#define RWLOCK_MAGIC

#ifdef CONFIG_DEBUG_SPINLOCK
#define __RW_LOCK_UNLOCKED(lockname)
#else
#define __RW_LOCK_UNLOCKED
#endif

#define DEFINE_RWLOCK(x)

#else /* !CONFIG_PREEMPT_RT */

#include <linux/rwbase_rt.h>

typedef struct {
	struct rwbase_rt	rwbase;
	atomic_t		readers;
#ifdef CONFIG_DEBUG_LOCK_ALLOC
	struct lockdep_map	dep_map;
#endif
} rwlock_t;

#define __RWLOCK_RT_INITIALIZER

#define __RW_LOCK_UNLOCKED

#define DEFINE_RWLOCK

#endif /* CONFIG_PREEMPT_RT */

#endif /* __LINUX_RWLOCK_TYPES_H */