]> git.proxmox.com Git - ceph.git/blob - ceph/src/crush/crush_compat.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / crush / crush_compat.h
1 #ifndef CEPH_CRUSH_COMPAT_H
2 #define CEPH_CRUSH_COMPAT_H
3
4 #include "include/int_types.h"
5
6 #include <assert.h>
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10
11 /* asm-generic/bug.h */
12
13 #define BUG_ON(x) assert(!(x))
14
15 /* linux/kernel.h */
16
17 #define U8_MAX ((__u8)~0U)
18 #define S8_MAX ((__s8)(U8_MAX>>1))
19 #define S8_MIN ((__s8)(-S8_MAX - 1))
20 #define U16_MAX ((__u16)~0U)
21 #define S16_MAX ((__s16)(U16_MAX>>1))
22 #define S16_MIN ((__s16)(-S16_MAX - 1))
23 #define U32_MAX ((__u32)~0U)
24 #define S32_MAX ((__s32)(U32_MAX>>1))
25 #define S32_MIN ((__s32)(-S32_MAX - 1))
26 #define U64_MAX ((__u64)~0ULL)
27 #define S64_MAX ((__s64)(U64_MAX>>1))
28 #define S64_MIN ((__s64)(-S64_MAX - 1))
29
30 /* linux/math64.h */
31
32 #define div64_s64(dividend, divisor) ((dividend) / (divisor))
33
34 /* linux/slab.h */
35
36 #define kmalloc(size, flags) malloc(size)
37 #define kfree(x) do { if (x) free(x); } while (0)
38
39 #endif /* CEPH_CRUSH_COMPAT_H */