1 #ifndef __LUNAIX_TYPES_H
2 #define __LUNAIX_TYPES_H
4 #include <lunaix/compiler.h>
5 #include <lunaix/limits.h>
7 #include <usr/lunaix/types.h>
11 // TODO: replace the integer type with these. To make thing more portable.
13 typedef unsigned char u8_t;
14 typedef unsigned short u16_t;
15 typedef unsigned int u32_t;
16 typedef unsigned long ptr_t;
17 typedef unsigned long reg_t;
19 typedef unsigned int uid_t;
20 typedef unsigned int gid_t;
22 #ifndef CONFIG_ARCH_BITS_64
23 typedef unsigned long long u64_t;
25 typedef unsigned long u64_t;
29 typedef signed long ssize_t;
31 typedef unsigned int cpu_t;
40 * container_of - cast a member of a structure out to the containing structure
42 * @ptr: the pointer to the member.
43 * @type: the type of the container struct this is embedded in.
44 * @member: the name of the member within the struct.
47 #define container_of(ptr, type, member) \
49 const typeof(((type*)0)->member)* __mptr = (ptr); \
50 ((ptr_t)ptr != 0UL) ? (type*)((char*)__mptr - offsetof(type, member)) : 0; \
53 #define offset(data, off) \
54 ((typeof(data))(__ptr(data) + (off)))
56 #define offset_t(data, type, off) \
57 ((type*)(__ptr(data) + (off)))
59 #define __ptr(val) ((ptr_t)(val))
61 typedef va_list* sc_va_list;
63 #endif /* __LUNAIX_TYPES_H */