Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 1 | #ifndef _KERNEL_H |
| 2 | #define _KERNEL_H |
| 3 | |
| 4 | #include <assert.h> |
| 5 | #include <string.h> |
| 6 | #include <stdio.h> |
| 7 | #include <stddef.h> |
| 8 | #include <limits.h> |
| 9 | |
Matthew Wilcox | f518b16 | 2016-05-20 17:01:36 -0700 | [diff] [blame] | 10 | #include "../../include/linux/compiler.h" |
| 11 | |
Matthew Wilcox | d42cb1a | 2016-05-20 17:01:39 -0700 | [diff] [blame] | 12 | #define CONFIG_SHMEM |
| 13 | #define CONFIG_SWAP |
| 14 | |
Ross Zwisler | 97d778b | 2016-05-20 17:01:42 -0700 | [diff] [blame^] | 15 | #define RADIX_TREE_MAP_SHIFT 3 |
| 16 | |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 17 | #ifndef NULL |
| 18 | #define NULL 0 |
| 19 | #endif |
| 20 | |
| 21 | #define BUG_ON(expr) assert(!(expr)) |
Matthew Wilcox | f518b16 | 2016-05-20 17:01:36 -0700 | [diff] [blame] | 22 | #define WARN_ON(expr) assert(!(expr)) |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 23 | #define __init |
Konstantin Khlebnikov | 2d6f45b | 2016-03-17 14:22:08 -0700 | [diff] [blame] | 24 | #define __must_check |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 25 | #define panic(expr) |
| 26 | #define printk printf |
| 27 | #define __force |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 28 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) |
Matthew Wilcox | f518b16 | 2016-05-20 17:01:36 -0700 | [diff] [blame] | 29 | #define pr_debug printk |
| 30 | |
| 31 | #define smp_rmb() barrier() |
| 32 | #define smp_wmb() barrier() |
| 33 | #define cpu_relax() barrier() |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 34 | |
| 35 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) |
| 36 | |
| 37 | #define container_of(ptr, type, member) ({ \ |
| 38 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ |
| 39 | (type *)( (char *)__mptr - offsetof(type, member) );}) |
| 40 | #define min(a, b) ((a) < (b) ? (a) : (b)) |
| 41 | |
Matthew Wilcox | f518b16 | 2016-05-20 17:01:36 -0700 | [diff] [blame] | 42 | #define cond_resched() sched_yield() |
| 43 | |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 44 | static inline int in_interrupt(void) |
| 45 | { |
| 46 | return 0; |
| 47 | } |
| 48 | #endif /* _KERNEL_H */ |