Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios.git] / kitten / include / lwk / spinlock_types.h
1 #ifndef _LWK_SPINLOCK_TYPES_H
2 #define _LWK_SPINLOCK_TYPES_H
3
4 /*
5  * include/lwk/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 <arch/spinlock_types.h>
13
14 typedef struct {
15         raw_spinlock_t raw_lock;
16 #ifdef CONFIG_DEBUG_SPINLOCK
17         unsigned int magic, owner_cpu;
18         void *owner;
19 #endif
20 } spinlock_t;
21
22 #define SPINLOCK_MAGIC          0xdead4ead
23
24 typedef struct {
25         raw_rwlock_t raw_lock;
26 #ifdef CONFIG_DEBUG_SPINLOCK
27         unsigned int magic, owner_cpu;
28         void *owner;
29 #endif
30 } rwlock_t;
31
32 #define RWLOCK_MAGIC            0xdeaf1eed
33
34 #define SPINLOCK_OWNER_INIT     ((void *)-1L)
35
36 #ifdef CONFIG_DEBUG_SPINLOCK
37 # define SPIN_LOCK_UNLOCKED                                             \
38                         {       .raw_lock = __RAW_SPIN_LOCK_UNLOCKED,   \
39                                 .magic = SPINLOCK_MAGIC,                \
40                                 .owner = SPINLOCK_OWNER_INIT,           \
41                                 .owner_cpu = -1 }
42 #define RW_LOCK_UNLOCKED                                                \
43                         {       .raw_lock = __RAW_RW_LOCK_UNLOCKED,     \
44                                 .magic = RWLOCK_MAGIC,                  \
45                                 .owner = SPINLOCK_OWNER_INIT,           \
46                                 .owner_cpu = -1 }
47 #else
48 # define SPIN_LOCK_UNLOCKED \
49                         {       .raw_lock = __RAW_SPIN_LOCK_UNLOCKED }
50 #define RW_LOCK_UNLOCKED \
51                         {       .raw_lock = __RAW_RW_LOCK_UNLOCKED }
52 #endif
53
54 #define DEFINE_SPINLOCK(x)      spinlock_t x = SPIN_LOCK_UNLOCKED
55 #define DEFINE_RWLOCK(x)        rwlock_t x = RW_LOCK_UNLOCKED
56
57 #endif /* _LWK_SPINLOCK_TYPES_H */