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

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

Version: ~ [ linux-5.7 ] ~ [ linux-5.6.15 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.43 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.125 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.182 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.225 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.225 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.84 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ 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.5 ] ~ [ 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 #if defined(CONFIG_SMP)
 13 # include <asm/spinlock_types.h>
 14 #else
 15 # include <linux/spinlock_types_up.h>
 16 #endif
 17 
 18 #include <linux/lockdep.h>
 19 
 20 typedef struct raw_spinlock {
 21         arch_spinlock_t raw_lock;
 22 #ifdef CONFIG_GENERIC_LOCKBREAK
 23         unsigned int break_lock;
 24 #endif
 25 #ifdef CONFIG_DEBUG_SPINLOCK
 26         unsigned int magic, owner_cpu;
 27         void *owner;
 28 #endif
 29 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 30         struct lockdep_map dep_map;
 31 #endif
 32 } raw_spinlock_t;
 33 
 34 #define SPINLOCK_MAGIC          0xdead4ead
 35 
 36 #define SPINLOCK_OWNER_INIT     ((void *)-1L)
 37 
 38 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 39 # define SPIN_DEP_MAP_INIT(lockname)    .dep_map = { .name = #lockname }
 40 #else
 41 # define SPIN_DEP_MAP_INIT(lockname)
 42 #endif
 43 
 44 #ifdef CONFIG_DEBUG_SPINLOCK
 45 # define SPIN_DEBUG_INIT(lockname)              \
 46         .magic = SPINLOCK_MAGIC,                \
 47         .owner_cpu = -1,                        \
 48         .owner = SPINLOCK_OWNER_INIT,
 49 #else
 50 # define SPIN_DEBUG_INIT(lockname)
 51 #endif
 52 
 53 #define __RAW_SPIN_LOCK_INITIALIZER(lockname)   \
 54         {                                       \
 55         .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED,  \
 56         SPIN_DEBUG_INIT(lockname)               \
 57         SPIN_DEP_MAP_INIT(lockname) }
 58 
 59 #define __RAW_SPIN_LOCK_UNLOCKED(lockname)      \
 60         (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname)
 61 
 62 #define DEFINE_RAW_SPINLOCK(x)  raw_spinlock_t x = __RAW_SPIN_LOCK_UNLOCKED(x)
 63 
 64 typedef struct spinlock {
 65         union {
 66                 struct raw_spinlock rlock;
 67 
 68 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 69 # define LOCK_PADSIZE (offsetof(struct raw_spinlock, dep_map))
 70                 struct {
 71                         u8 __padding[LOCK_PADSIZE];
 72                         struct lockdep_map dep_map;
 73                 };
 74 #endif
 75         };
 76 } spinlock_t;
 77 
 78 #define __SPIN_LOCK_INITIALIZER(lockname) \
 79         { { .rlock = __RAW_SPIN_LOCK_INITIALIZER(lockname) } }
 80 
 81 #define __SPIN_LOCK_UNLOCKED(lockname) \
 82         (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname)
 83 
 84 #define DEFINE_SPINLOCK(x)      spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
 85 
 86 #include <linux/rwlock_types.h>
 87 
 88 #endif /* __LINUX_SPINLOCK_TYPES_H */
 89 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp