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

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

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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 #ifndef __LINUX_SPINLOCK_TYPES_H
  2 #define __LINUX_SPINLOCK_TYPES_H
  3 
  4 /*
  5  * include/linux/spinlock_types.h - generic spinlock type definitions
  6  *                                  and initializers
  7  *
  8  * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
  9  * Released under the General Public License (GPL).
 10  */
 11 
 12 #include <linux/spinlock_types_raw.h>
 13 
 14 #ifndef CONFIG_PREEMPT_RT
 15 
 16 /* Non PREEMPT_RT kernels map spinlock to raw_spinlock */
 17 typedef struct spinlock {
 18         union {
 19                 struct raw_spinlock rlock;
 20 
 21 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 22 # define LOCK_PADSIZE (offsetof(struct raw_spinlock, dep_map))
 23                 struct {
 24                         u8 __padding[LOCK_PADSIZE];
 25                         struct lockdep_map dep_map;
 26                 };
 27 #endif
 28         };
 29 } spinlock_t;
 30 
 31 #define ___SPIN_LOCK_INITIALIZER(lockname)      \
 32         {                                       \
 33         .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED,  \
 34         SPIN_DEBUG_INIT(lockname)               \
 35         SPIN_DEP_MAP_INIT(lockname) }
 36 
 37 #define __SPIN_LOCK_INITIALIZER(lockname) \
 38         { { .rlock = ___SPIN_LOCK_INITIALIZER(lockname) } }
 39 
 40 #define __SPIN_LOCK_UNLOCKED(lockname) \
 41         (spinlock_t) __SPIN_LOCK_INITIALIZER(lockname)
 42 
 43 #define DEFINE_SPINLOCK(x)      spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
 44 
 45 #else /* !CONFIG_PREEMPT_RT */
 46 
 47 /* PREEMPT_RT kernels map spinlock to rt_mutex */
 48 #include <linux/rtmutex.h>
 49 
 50 typedef struct spinlock {
 51         struct rt_mutex_base    lock;
 52 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 53         struct lockdep_map      dep_map;
 54 #endif
 55 } spinlock_t;
 56 
 57 #define __SPIN_LOCK_UNLOCKED(name)                              \
 58         {                                                       \
 59                 .lock = __RT_MUTEX_BASE_INITIALIZER(name.lock), \
 60                 SPIN_DEP_MAP_INIT(name)                         \
 61         }
 62 
 63 #define __LOCAL_SPIN_LOCK_UNLOCKED(name)                        \
 64         {                                                       \
 65                 .lock = __RT_MUTEX_BASE_INITIALIZER(name.lock), \
 66                 LOCAL_SPIN_DEP_MAP_INIT(name)                   \
 67         }
 68 
 69 #define DEFINE_SPINLOCK(name)                                   \
 70         spinlock_t name = __SPIN_LOCK_UNLOCKED(name)
 71 
 72 #endif /* CONFIG_PREEMPT_RT */
 73 
 74 #include <linux/rwlock_types.h>
 75 
 76 #endif /* __LINUX_SPINLOCK_TYPES_H */
 77 

~ [ 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