aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/kerncompat.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-01-26 16:38:42 -0500
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-01-26 16:38:42 -0500
commit4920c9ac9a4bbc6bf9acd8c614987ee6b378e78f (patch)
tree4c23ba9685b87407a8d25e42eefb970e34d934bb /fs/btrfs/kerncompat.h
parentbe0e5c097fc206b863ce9fe6b3cfd6974b0110f4 (diff)
Btrfs: Faster deletes, add Makefile and kerncompat
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/kerncompat.h')
-rw-r--r--fs/btrfs/kerncompat.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/fs/btrfs/kerncompat.h b/fs/btrfs/kerncompat.h
new file mode 100644
index 000000000000..3a4bb4d661f9
--- /dev/null
+++ b/fs/btrfs/kerncompat.h
@@ -0,0 +1,68 @@
1#ifndef __KERNCOMPAT
2#define __KERNCOMPAT
3#define gfp_t int
4#define get_cpu_var(p) (p)
5#define __get_cpu_var(p) (p)
6#define BITS_PER_LONG 64
7#define __GFP_BITS_SHIFT 20
8#define __GFP_BITS_MASK ((int)((1 << __GFP_BITS_SHIFT) - 1))
9#define __read_mostly
10#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
11#define __force
12#define PAGE_SHIFT 12
13#define ULONG_MAX (~0UL)
14#define BUG() abort()
15
16typedef unsigned int u32;
17typedef unsigned long u64;
18typedef unsigned char u8;
19typedef unsigned short u16;
20
21typedef unsigned long pgoff_t;
22
23#include <stdio.h>
24#include <stdlib.h>
25#include <string.h>
26
27struct vma_shared { int prio_tree_node; };
28struct vm_area_struct {
29 unsigned long vm_pgoff;
30 unsigned long vm_start;
31 unsigned long vm_end;
32 struct vma_shared shared;
33};
34
35struct page {
36 unsigned long index;
37};
38
39static inline void preempt_enable(void) { do {; } while(0);}
40static inline void preempt_disable(void) { do {; } while(0);}
41
42static inline void __set_bit(int bit, unsigned long *map) {
43 unsigned long *p = map + bit / BITS_PER_LONG;
44 bit = bit & (BITS_PER_LONG -1);
45 *p |= 1UL << bit;
46}
47
48static inline int test_bit(int bit, unsigned long *map) {
49 unsigned long *p = map + bit / BITS_PER_LONG;
50 bit = bit & (BITS_PER_LONG -1);
51 return *p & (1UL << bit) ? 1 : 0;
52}
53
54static inline void __clear_bit(int bit, unsigned long *map) {
55 unsigned long *p = map + bit / BITS_PER_LONG;
56 bit = bit & (BITS_PER_LONG -1);
57 *p &= ~(1UL << bit);
58}
59#define BUG_ON(c) do { if (c) abort(); } while (0)
60
61#define container_of(ptr, type, member) ({ \
62 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
63 (type *)( (char *)__mptr - __builtin_offsetof(type,member) );})
64
65#endif
66
67#define ENOMEM 5
68#define EEXIST 6