fix: false positive when looking for room to host pmem_list
[lunaix-os.git] / lunaix-os / includes / lunaix / types.h
1 #ifndef __LUNAIX_TYPES_H
2 #define __LUNAIX_TYPES_H
3
4 #include <lunaix/compiler.h>
5 #include <stdarg.h>
6 #include <usr/lunaix/types.h>
7
8 // TODO: WTERMSIG
9
10 // TODO: replace the integer type with these. To make thing more portable.
11
12 typedef unsigned char u8_t;
13 typedef unsigned short u16_t;
14 typedef unsigned int u32_t;
15 typedef unsigned long ptr_t;
16 typedef unsigned long reg_t;
17
18 #ifndef CONFIG_ARCH_BITS_64
19 typedef unsigned long long u64_t;
20 #else
21 typedef unsigned long u64_t;
22 #endif
23
24 typedef int pid_t;
25 typedef signed long ssize_t;
26
27 typedef unsigned int cpu_t;
28
29 typedef u64_t lba_t;
30
31 #define true 1
32 #define false 0
33 typedef int bool;
34
35 /**
36  * container_of - cast a member of a structure out to the containing structure
37  *
38  * @ptr:        the pointer to the member.
39  * @type:       the type of the container struct this is embedded in.
40  * @member:     the name of the member within the struct.
41  *
42  */
43 #define container_of(ptr, type, member)                                        \
44     ({                                                                         \
45         const typeof(((type*)0)->member)* __mptr = (ptr);                      \
46         (ptr) ? (type*)((char*)__mptr - offsetof(type, member)) : 0;           \
47     })
48
49 #define __ptr(val)      ((ptr_t)(val))
50
51 typedef va_list* sc_va_list;
52
53 #endif /* __LUNAIX_TYPES_H */