blob: 31fe2c77d7aee3f430046622f0fc878ca26f4dde [file] [log] [blame]
Matthew Wilcox1366c372016-03-17 14:21:45 -07001#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 Wilcoxf518b162016-05-20 17:01:36 -070010#include "../../include/linux/compiler.h"
11
Matthew Wilcoxd42cb1a2016-05-20 17:01:39 -070012#define CONFIG_SHMEM
13#define CONFIG_SWAP
14
Ross Zwisler97d778b2016-05-20 17:01:42 -070015#define RADIX_TREE_MAP_SHIFT 3
16
Matthew Wilcox1366c372016-03-17 14:21:45 -070017#ifndef NULL
18#define NULL 0
19#endif
20
21#define BUG_ON(expr) assert(!(expr))
Matthew Wilcoxf518b162016-05-20 17:01:36 -070022#define WARN_ON(expr) assert(!(expr))
Matthew Wilcox1366c372016-03-17 14:21:45 -070023#define __init
Konstantin Khlebnikov2d6f45b2016-03-17 14:22:08 -070024#define __must_check
Matthew Wilcox1366c372016-03-17 14:21:45 -070025#define panic(expr)
26#define printk printf
27#define __force
Matthew Wilcox1366c372016-03-17 14:21:45 -070028#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
Matthew Wilcoxf518b162016-05-20 17:01:36 -070029#define pr_debug printk
30
31#define smp_rmb() barrier()
32#define smp_wmb() barrier()
33#define cpu_relax() barrier()
Matthew Wilcox1366c372016-03-17 14:21:45 -070034
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 Wilcoxf518b162016-05-20 17:01:36 -070042#define cond_resched() sched_yield()
43
Matthew Wilcox1366c372016-03-17 14:21:45 -070044static inline int in_interrupt(void)
45{
46 return 0;
47}
48#endif /* _KERNEL_H */