File: rwlock.h

package info (click to toggle)
linux 3.16.51-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-updates
  • size: 755,292 kB
  • sloc: ansic: 12,235,573; asm: 277,597; perl: 53,071; xml: 47,771; makefile: 30,539; sh: 7,977; python: 6,697; cpp: 5,131; yacc: 4,254; lex: 2,215; awk: 741; pascal: 231; lisp: 218; sed: 30
file content (49 lines) | stat: -rw-r--r-- 1,043 bytes parent folder | download | duplicates (22)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef _ASM_X86_RWLOCK_H
#define _ASM_X86_RWLOCK_H

#include <asm/asm.h>

#if CONFIG_NR_CPUS <= 2048

#ifndef __ASSEMBLY__
typedef union {
	s32 lock;
	s32 write;
} arch_rwlock_t;
#endif

#define RW_LOCK_BIAS		0x00100000
#define READ_LOCK_SIZE(insn)	__ASM_FORM(insn##l)
#define READ_LOCK_ATOMIC(n)	atomic_##n
#define WRITE_LOCK_ADD(n)	__ASM_FORM_COMMA(addl n)
#define WRITE_LOCK_SUB(n)	__ASM_FORM_COMMA(subl n)
#define WRITE_LOCK_CMP		RW_LOCK_BIAS

#else /* CONFIG_NR_CPUS > 2048 */

#include <linux/const.h>

#ifndef __ASSEMBLY__
typedef union {
	s64 lock;
	struct {
		u32 read;
		s32 write;
	};
} arch_rwlock_t;
#endif

#define RW_LOCK_BIAS		(_AC(1,L) << 32)
#define READ_LOCK_SIZE(insn)	__ASM_FORM(insn##q)
#define READ_LOCK_ATOMIC(n)	atomic64_##n
#define WRITE_LOCK_ADD(n)	__ASM_FORM(incl)
#define WRITE_LOCK_SUB(n)	__ASM_FORM(decl)
#define WRITE_LOCK_CMP		1

#endif /* CONFIG_NR_CPUS */

#define __ARCH_RW_LOCK_UNLOCKED		{ RW_LOCK_BIAS }

/* Actual code is in asm/spinlock.h or in arch/x86/lib/rwlock.S */

#endif /* _ASM_X86_RWLOCK_H */