Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at f1a5e78a55ebf2b05777fd5eb738038ddae609d6 80 lines 1.9 kB view raw
1#ifndef __LINUX_RWLOCK_TYPES_H 2#define __LINUX_RWLOCK_TYPES_H 3 4#if !defined(__LINUX_SPINLOCK_TYPES_H) 5# error "Do not include directly, include spinlock_types.h" 6#endif 7 8#ifdef CONFIG_DEBUG_LOCK_ALLOC 9# define RW_DEP_MAP_INIT(lockname) \ 10 .dep_map = { \ 11 .name = #lockname, \ 12 .wait_type_inner = LD_WAIT_CONFIG, \ 13 } 14#else 15# define RW_DEP_MAP_INIT(lockname) 16#endif 17 18#ifndef CONFIG_PREEMPT_RT 19/* 20 * generic rwlock type definitions and initializers 21 * 22 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar 23 * Released under the General Public License (GPL). 24 */ 25context_lock_struct(rwlock) { 26 arch_rwlock_t raw_lock; 27#ifdef CONFIG_DEBUG_SPINLOCK 28 unsigned int magic, owner_cpu; 29 void *owner; 30#endif 31#ifdef CONFIG_DEBUG_LOCK_ALLOC 32 struct lockdep_map dep_map; 33#endif 34}; 35typedef struct rwlock rwlock_t; 36 37#define RWLOCK_MAGIC 0xdeaf1eed 38 39#ifdef CONFIG_DEBUG_SPINLOCK 40#define __RW_LOCK_UNLOCKED(lockname) \ 41 (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \ 42 .magic = RWLOCK_MAGIC, \ 43 .owner = SPINLOCK_OWNER_INIT, \ 44 .owner_cpu = -1, \ 45 RW_DEP_MAP_INIT(lockname) } 46#else 47#define __RW_LOCK_UNLOCKED(lockname) \ 48 (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \ 49 RW_DEP_MAP_INIT(lockname) } 50#endif 51 52#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x) 53 54#else /* !CONFIG_PREEMPT_RT */ 55 56#include <linux/rwbase_rt.h> 57 58context_lock_struct(rwlock) { 59 struct rwbase_rt rwbase; 60 atomic_t readers; 61#ifdef CONFIG_DEBUG_LOCK_ALLOC 62 struct lockdep_map dep_map; 63#endif 64}; 65typedef struct rwlock rwlock_t; 66 67#define __RWLOCK_RT_INITIALIZER(name) \ 68{ \ 69 .rwbase = __RWBASE_INITIALIZER(name), \ 70 RW_DEP_MAP_INIT(name) \ 71} 72 73#define __RW_LOCK_UNLOCKED(name) __RWLOCK_RT_INITIALIZER(name) 74 75#define DEFINE_RWLOCK(name) \ 76 rwlock_t name = __RW_LOCK_UNLOCKED(name) 77 78#endif /* CONFIG_PREEMPT_RT */ 79 80#endif /* __LINUX_RWLOCK_TYPES_H */