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 #ifndef CONFIG_ARCH_BITS_64
20 typedef unsigned long long u64_t;
22 typedef unsigned long u64_t;
26 typedef signed long ssize_t;
28 typedef unsigned int cpu_t;
37 * container_of - cast a member of a structure out to the containing structure
39 * @ptr: the pointer to the member.
40 * @type: the type of the container struct this is embedded in.
41 * @member: the name of the member within the struct.
44 #define container_of(ptr, type, member) \
46 const typeof(((type*)0)->member)* __mptr = (ptr); \
47 ((ptr_t)ptr != 0UL) ? (type*)((char*)__mptr - offsetof(type, member)) : 0; \
50 #define offset(data, off) \
51 ((typeof(data))(__ptr(data) + (off)))
53 #define offset_t(data, type, off) \
54 ((type*)(__ptr(data) + (off)))
56 #define __ptr(val) ((ptr_t)(val))
58 typedef va_list* sc_va_list;
60 #endif /* __LUNAIX_TYPES_H */