blob: 3a4bb4d661f972a459ee67a34424b07c241be3b4 [file] [log] [blame]
Chris Mason4920c9a2007-01-26 16:38:42 -05001#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