spinlock_types.h revision a27d2baa0c1a2ec70f47ea9199b1dd6762c8a349
1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ****************************************************************************
11 ****************************************************************************/
12#ifndef __LINUX_SPINLOCK_TYPES_H
13#define __LINUX_SPINLOCK_TYPES_H
14
15#include <linux/lockdep.h>
16
17#include <linux/spinlock_types_up.h>
18
19typedef struct {
20 raw_spinlock_t raw_lock;
21} spinlock_t;
22
23#define SPINLOCK_MAGIC 0xdead4ead
24
25typedef struct {
26 raw_rwlock_t raw_lock;
27} rwlock_t;
28
29#define RWLOCK_MAGIC 0xdeaf1eed
30
31#define SPINLOCK_OWNER_INIT ((void *)-1L)
32
33#define SPIN_DEP_MAP_INIT(lockname)
34
35#define RW_DEP_MAP_INIT(lockname)
36
37#define __SPIN_LOCK_UNLOCKED(lockname)   (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED,   SPIN_DEP_MAP_INIT(lockname) }
38#define __RW_LOCK_UNLOCKED(lockname)   (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED,   RW_DEP_MAP_INIT(lockname) }
39
40#define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init)
41#define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init)
42
43#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
44#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x)
45
46#endif
47