Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios.git] / kitten / include / lwk / types.h
1 #ifndef _LWK_TYPES_H
2 #define _LWK_TYPES_H
3
4 #ifdef  __KERNEL__
5
6 #define BITS_TO_LONGS(bits) \
7         (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
8 #define DECLARE_BITMAP(name,bits) \
9         unsigned long name[BITS_TO_LONGS(bits)]
10
11 #define BITS_PER_BYTE 8
12 #endif
13
14 #include <lwk/posix_types.h>
15 #include <arch/types.h>
16
17 #ifndef __KERNEL_STRICT_NAMES
18
19 typedef __u32 __kernel_dev_t;
20
21 typedef __kernel_fd_set         fd_set;
22 typedef __kernel_dev_t          dev_t;
23 typedef __kernel_ino_t          ino_t;
24 typedef __kernel_mode_t         mode_t;
25 typedef __kernel_nlink_t        nlink_t;
26 typedef __kernel_off_t          off_t;
27 typedef __kernel_pid_t          pid_t;
28 typedef __kernel_daddr_t        daddr_t;
29 typedef __kernel_key_t          key_t;
30 typedef __kernel_suseconds_t    suseconds_t;
31 typedef __kernel_timer_t        timer_t;
32 typedef __kernel_clockid_t      clockid_t;
33 typedef __kernel_mqd_t          mqd_t;
34 typedef __kernel_uid_t          uid_t;
35 typedef __kernel_gid_t          gid_t;
36 typedef __kernel_loff_t         loff_t;
37
38 /*
39  * The following typedefs are also protected by individual ifdefs for
40  * historical reasons:
41  */
42 #ifndef _SIZE_T
43 #define _SIZE_T
44 typedef __kernel_size_t         size_t;
45 #endif
46
47 #ifndef _SSIZE_T
48 #define _SSIZE_T
49 typedef __kernel_ssize_t        ssize_t;
50 #endif
51
52 #ifndef _PTRDIFF_T
53 #define _PTRDIFF_T
54 typedef __kernel_ptrdiff_t      ptrdiff_t;
55 #endif
56
57 #ifndef _UINTPTR_T
58 #define _UINTPTR_T
59 typedef __kernel_uintptr_t      uintptr_t;
60 #endif
61
62 #ifndef _TIME_T
63 #define _TIME_T
64 typedef __kernel_time_t         time_t;
65 #endif
66
67 #ifndef _CLOCK_T
68 #define _CLOCK_T
69 typedef __kernel_clock_t        clock_t;
70 #endif
71
72 #ifndef _CADDR_T
73 #define _CADDR_T
74 typedef __kernel_caddr_t        caddr_t;
75 #endif
76
77 /* bsd */
78 typedef unsigned char           u_char;
79 typedef unsigned short          u_short;
80 typedef unsigned int            u_int;
81 typedef unsigned long           u_long;
82
83 /* sysv */
84 typedef unsigned char           unchar;
85 typedef unsigned short          ushort;
86 typedef unsigned int            uint;
87 typedef unsigned long           ulong;
88
89 #ifndef __BIT_TYPES_DEFINED__
90 #define __BIT_TYPES_DEFINED__
91
92 typedef         __u8            u_int8_t;
93 typedef         __s8            int8_t;
94 typedef         __u16           u_int16_t;
95 typedef         __s16           int16_t;
96 typedef         __u32           u_int32_t;
97 typedef         __s32           int32_t;
98
99 #endif /* !(__BIT_TYPES_DEFINED__) */
100
101 /* user-space uses stdint.h for these */
102 #ifdef __KERNEL__
103
104 typedef         __u8            uint8_t;
105 typedef         __u16           uint16_t;
106 typedef         __u32           uint32_t;
107
108 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
109 typedef         __u64           uint64_t;
110 typedef         __u64           u_int64_t;
111 typedef         __s64           int64_t;
112 #endif
113
114 #endif /* __KERNEL_ */
115
116 /* this is a special 64bit data type that is 8-byte aligned */
117 #define aligned_u64 unsigned long long __attribute__((aligned(8)))
118
119 #endif /* __KERNEL_STRICT_NAMES */
120
121 #ifdef __KERNEL__
122 /* _Bool is a base type in C99... what a bad name! */
123 typedef _Bool                   bool;
124 #else
125 #include <stdbool.h>
126 #include <stdint.h>
127 #endif
128
129 /*
130  * Below are truly LWK-specific types that should never collide with
131  * any application/library that wants lwk/types.h.
132  */
133
134 /* Address types */
135 typedef __kernel_uintptr_t      paddr_t;        /* physical address */
136 typedef __kernel_uintptr_t      vaddr_t;        /* virtual address */
137 typedef __kernel_uintptr_t      kaddr_t;        /* kernel virtual address */
138 typedef __kernel_uintptr_t      uaddr_t;        /* user virtual address */
139
140 /* Locality group ID */
141 typedef unsigned int            lgroup_t;
142
143 #ifdef __CHECKER__
144 #define __bitwise__ __attribute__((bitwise))
145 #else
146 #define __bitwise__
147 #endif
148 #ifdef __CHECK_ENDIAN__
149 #define __bitwise __bitwise__
150 #else
151 #define __bitwise
152 #endif
153
154 typedef __u16 __bitwise __le16;
155 typedef __u16 __bitwise __be16;
156 typedef __u32 __bitwise __le32;
157 typedef __u32 __bitwise __be32;
158 typedef __u64 __bitwise __le64;
159 typedef __u64 __bitwise __be64;
160
161 #ifdef __KERNEL__
162 typedef unsigned __bitwise__ gfp_t;
163 #endif
164
165 struct ustat {
166         __kernel_daddr_t        f_tfree;
167         __kernel_ino_t          f_tinode;
168         char                    f_fname[6];
169         char                    f_fpack[6];
170 };
171
172 #endif /* _LWK_TYPES_H */