Fixup the code to merge during path walks
[btrfs-progs-unstable.git] / kerncompat.h
blobf5efc5f0fff078316d7e21e31e4b91d3fd13c9ea
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 GFP_KERNEL 0
10 #define __read_mostly
11 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
12 #define __force
13 #define PAGE_SHIFT 12
14 #define ULONG_MAX (~0UL)
15 #define BUG() abort()
17 typedef unsigned int u32;
18 typedef unsigned long long u64;
19 typedef unsigned char u8;
20 typedef unsigned short u16;
22 typedef unsigned long pgoff_t;
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
28 struct vma_shared { int prio_tree_node; };
29 struct vm_area_struct {
30 unsigned long vm_pgoff;
31 unsigned long vm_start;
32 unsigned long vm_end;
33 struct vma_shared shared;
36 struct page {
37 unsigned long index;
40 static inline void preempt_enable(void) { do {; } while(0);}
41 static inline void preempt_disable(void) { do {; } while(0);}
43 static inline void __set_bit(int bit, unsigned long *map) {
44 unsigned long *p = map + bit / BITS_PER_LONG;
45 bit = bit & (BITS_PER_LONG -1);
46 *p |= 1UL << bit;
49 static inline int test_bit(int bit, unsigned long *map) {
50 unsigned long *p = map + bit / BITS_PER_LONG;
51 bit = bit & (BITS_PER_LONG -1);
52 return *p & (1UL << bit) ? 1 : 0;
55 static inline void __clear_bit(int bit, unsigned long *map) {
56 unsigned long *p = map + bit / BITS_PER_LONG;
57 bit = bit & (BITS_PER_LONG -1);
58 *p &= ~(1UL << bit);
60 #define BUG_ON(c) do { if (c) abort(); } while (0)
62 #define container_of(ptr, type, member) ({ \
63 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
64 (type *)( (char *)__mptr - __builtin_offsetof(type,member) );})
66 #endif
68 #define ENOMEM 5
69 #define EEXIST 6