~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/rwlock_rt.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 #ifndef __LINUX_RWLOCK_RT_H
  3 #define __LINUX_RWLOCK_RT_H
  4 
  5 #ifndef __LINUX_SPINLOCK_RT_H
  6 #error Do not #include directly. Use <linux/spinlock.h>.
  7 #endif
  8 
  9 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 10 extern void __rt_rwlock_init(rwlock_t *rwlock, const char *name,
 11                              struct lock_class_key *key);
 12 #else
 13 static inline void __rt_rwlock_init(rwlock_t *rwlock, char *name,
 14                                     struct lock_class_key *key)
 15 {
 16 }
 17 #endif
 18 
 19 #define rwlock_init(rwl)                                \
 20 do {                                                    \
 21         static struct lock_class_key __key;             \
 22                                                         \
 23         init_rwbase_rt(&(rwl)->rwbase);                 \
 24         __rt_rwlock_init(rwl, #rwl, &__key);            \
 25 } while (0)
 26 
 27 extern void rt_read_lock(rwlock_t *rwlock);
 28 extern int rt_read_trylock(rwlock_t *rwlock);
 29 extern void rt_read_unlock(rwlock_t *rwlock);
 30 extern void rt_write_lock(rwlock_t *rwlock);
 31 extern void rt_write_lock_nested(rwlock_t *rwlock, int subclass);
 32 extern int rt_write_trylock(rwlock_t *rwlock);
 33 extern void rt_write_unlock(rwlock_t *rwlock);
 34 
 35 static __always_inline void read_lock(rwlock_t *rwlock)
 36 {
 37         rt_read_lock(rwlock);
 38 }
 39 
 40 static __always_inline void read_lock_bh(rwlock_t *rwlock)
 41 {
 42         local_bh_disable();
 43         rt_read_lock(rwlock);
 44 }
 45 
 46 static __always_inline void read_lock_irq(rwlock_t *rwlock)
 47 {
 48         rt_read_lock(rwlock);
 49 }
 50 
 51 #define read_lock_irqsave(lock, flags)                  \
 52         do {                                            \
 53                 typecheck(unsigned long, flags);        \
 54                 rt_read_lock(lock);                     \
 55                 flags = 0;                              \
 56         } while (0)
 57 
 58 #define read_trylock(lock)      __cond_lock(lock, rt_read_trylock(lock))
 59 
 60 static __always_inline void read_unlock(rwlock_t *rwlock)
 61 {
 62         rt_read_unlock(rwlock);
 63 }
 64 
 65 static __always_inline void read_unlock_bh(rwlock_t *rwlock)
 66 {
 67         rt_read_unlock(rwlock);
 68         local_bh_enable();
 69 }
 70 
 71 static __always_inline void read_unlock_irq(rwlock_t *rwlock)
 72 {
 73         rt_read_unlock(rwlock);
 74 }
 75 
 76 static __always_inline void read_unlock_irqrestore(rwlock_t *rwlock,
 77                                                    unsigned long flags)
 78 {
 79         rt_read_unlock(rwlock);
 80 }
 81 
 82 static __always_inline void write_lock(rwlock_t *rwlock)
 83 {
 84         rt_write_lock(rwlock);
 85 }
 86 
 87 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 88 static __always_inline void write_lock_nested(rwlock_t *rwlock, int subclass)
 89 {
 90         rt_write_lock_nested(rwlock, subclass);
 91 }
 92 #else
 93 #define write_lock_nested(lock, subclass)       rt_write_lock(((void)(subclass), (lock)))
 94 #endif
 95 
 96 static __always_inline void write_lock_bh(rwlock_t *rwlock)
 97 {
 98         local_bh_disable();
 99         rt_write_lock(rwlock);
100 }
101 
102 static __always_inline void write_lock_irq(rwlock_t *rwlock)
103 {
104         rt_write_lock(rwlock);
105 }
106 
107 #define write_lock_irqsave(lock, flags)                 \
108         do {                                            \
109                 typecheck(unsigned long, flags);        \
110                 rt_write_lock(lock);                    \
111                 flags = 0;                              \
112         } while (0)
113 
114 #define write_trylock(lock)     __cond_lock(lock, rt_write_trylock(lock))
115 
116 #define write_trylock_irqsave(lock, flags)              \
117 ({                                                      \
118         int __locked;                                   \
119                                                         \
120         typecheck(unsigned long, flags);                \
121         flags = 0;                                      \
122         __locked = write_trylock(lock);                 \
123         __locked;                                       \
124 })
125 
126 static __always_inline void write_unlock(rwlock_t *rwlock)
127 {
128         rt_write_unlock(rwlock);
129 }
130 
131 static __always_inline void write_unlock_bh(rwlock_t *rwlock)
132 {
133         rt_write_unlock(rwlock);
134         local_bh_enable();
135 }
136 
137 static __always_inline void write_unlock_irq(rwlock_t *rwlock)
138 {
139         rt_write_unlock(rwlock);
140 }
141 
142 static __always_inline void write_unlock_irqrestore(rwlock_t *rwlock,
143                                                     unsigned long flags)
144 {
145         rt_write_unlock(rwlock);
146 }
147 
148 #define rwlock_is_contended(lock)               (((void)(lock), 0))
149 
150 #endif /* __LINUX_RWLOCK_RT_H */
151 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php