blob: ae013b0160ac842c801e63360bda3128a23d8dd1 [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
10#ifndef NULL
11#define NULL 0
12#endif
13
14#define BUG_ON(expr) assert(!(expr))
15#define __init
Konstantin Khlebnikov2d6f45b2016-03-17 14:22:08 -070016#define __must_check
Matthew Wilcox1366c372016-03-17 14:21:45 -070017#define panic(expr)
18#define printk printf
19#define __force
20#define likely(c) (c)
21#define unlikely(c) (c)
22#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
23
24#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
25
26#define container_of(ptr, type, member) ({ \
27 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
28 (type *)( (char *)__mptr - offsetof(type, member) );})
29#define min(a, b) ((a) < (b) ? (a) : (b))
30
31static inline int in_interrupt(void)
32{
33 return 0;
34}
35#endif /* _KERNEL_H */