| 1 | #ifndef KERNELCOMPAT_H |
| 2 | #define KERNELCOMPAT_H |
| 3 | |
| 4 | #include <string.h> |
| 5 | |
| 6 | #define container_of(ptr, type, member) ({ \ |
| 7 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ |
| 8 | (type *)( (char *)__mptr - offsetof(type,member) );}) |
| 9 | |
| 10 | #define KERN_DEBUG |
| 11 | #define KERN_NOTICE |
| 12 | |
| 13 | static inline void *ERR_PTR(long error) |
| 14 | { |
| 15 | return (void *) error; |
| 16 | } |
| 17 | |
| 18 | |
| 19 | #include <stdint.h> |
| 20 | |
| 21 | typedef uint16_t u16; |
| 22 | typedef uint32_t u32; |
| 23 | |
| 24 | |
| 25 | #include <pthread.h> |
| 26 | |
| 27 | #define DEFINE_MUTEX(m) pthread_mutex_t (m) = PTHREAD_MUTEX_INITIALIZER; |
| 28 | |
| 29 | #define mutex_lock(m) pthread_mutex_lock(m) |
| 30 | |
| 31 | #define mutex_unlock(m) pthread_mutex_unlock(m) |
| 32 | |
| 33 | |
| 34 | #include <stdlib.h> |
| 35 | |
| 36 | #define kmalloc(s, t) malloc(s) |
| 37 | #define kzalloc(s, t) malloc(s) |
| 38 | #define kfree(p) free((void *)p) |
| 39 | #define kstrdup(s, t) strdup(s) |
| 40 | |
| 41 | |
| 42 | #include <stdio.h> |
| 43 | #define printk(fmt, args...) printf(fmt, ## args) |
| 44 | |
| 45 | |
| 46 | |
| 47 | #define smp_rmb() |
| 48 | #define smp_wmb() |
| 49 | |
| 50 | |
| 51 | #define read_barrier_depends() |
| 52 | #define smp_read_barrier_depends() |
| 53 | |
| 54 | |
| 55 | #define rcu_assign_pointer(a, b) |
| 56 | #endif /* KERNELCOMPAT_H */ |