/include/linux/types.h

https://github.com/airy09/android_kernel_sony_apq8064 · C Header · 260 lines · 171 code · 47 blank · 42 comment · 0 complexity · 1797850b77ef914eb237a0444c5fe866 MD5 · raw file

  1. #ifndef _LINUX_TYPES_H
  2. #define _LINUX_TYPES_H
  3. #include <asm/types.h>
  4. #ifndef __ASSEMBLY__
  5. #ifdef __KERNEL__
  6. #define DECLARE_BITMAP(name,bits) \
  7. unsigned long name[BITS_TO_LONGS(bits)]
  8. #else
  9. #ifndef __EXPORTED_HEADERS__
  10. #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
  11. #endif /* __EXPORTED_HEADERS__ */
  12. #endif
  13. #include <linux/posix_types.h>
  14. #ifdef __KERNEL__
  15. typedef __u32 __kernel_dev_t;
  16. typedef __kernel_fd_set fd_set;
  17. typedef __kernel_dev_t dev_t;
  18. typedef __kernel_ino_t ino_t;
  19. typedef __kernel_mode_t mode_t;
  20. typedef unsigned short umode_t;
  21. typedef __kernel_nlink_t nlink_t;
  22. typedef __kernel_off_t off_t;
  23. typedef __kernel_pid_t pid_t;
  24. typedef __kernel_daddr_t daddr_t;
  25. typedef __kernel_key_t key_t;
  26. typedef __kernel_suseconds_t suseconds_t;
  27. typedef __kernel_timer_t timer_t;
  28. typedef __kernel_clockid_t clockid_t;
  29. typedef __kernel_mqd_t mqd_t;
  30. typedef _Bool bool;
  31. typedef __kernel_uid32_t uid_t;
  32. typedef __kernel_gid32_t gid_t;
  33. typedef __kernel_uid16_t uid16_t;
  34. typedef __kernel_gid16_t gid16_t;
  35. typedef unsigned long uintptr_t;
  36. #ifdef CONFIG_UID16
  37. /* This is defined by include/asm-{arch}/posix_types.h */
  38. typedef __kernel_old_uid_t old_uid_t;
  39. typedef __kernel_old_gid_t old_gid_t;
  40. #endif /* CONFIG_UID16 */
  41. #if defined(__GNUC__)
  42. typedef __kernel_loff_t loff_t;
  43. #endif
  44. /*
  45. * The following typedefs are also protected by individual ifdefs for
  46. * historical reasons:
  47. */
  48. #ifndef _SIZE_T
  49. #define _SIZE_T
  50. typedef __kernel_size_t size_t;
  51. #endif
  52. #ifndef _SSIZE_T
  53. #define _SSIZE_T
  54. typedef __kernel_ssize_t ssize_t;
  55. #endif
  56. #ifndef _PTRDIFF_T
  57. #define _PTRDIFF_T
  58. typedef __kernel_ptrdiff_t ptrdiff_t;
  59. #endif
  60. #ifndef _TIME_T
  61. #define _TIME_T
  62. typedef __kernel_time_t time_t;
  63. #endif
  64. #ifndef _CLOCK_T
  65. #define _CLOCK_T
  66. typedef __kernel_clock_t clock_t;
  67. #endif
  68. #ifndef _CADDR_T
  69. #define _CADDR_T
  70. typedef __kernel_caddr_t caddr_t;
  71. #endif
  72. /* bsd */
  73. typedef unsigned char u_char;
  74. typedef unsigned short u_short;
  75. typedef unsigned int u_int;
  76. typedef unsigned long u_long;
  77. /* sysv */
  78. typedef unsigned char unchar;
  79. typedef unsigned short ushort;
  80. typedef unsigned int uint;
  81. typedef unsigned long ulong;
  82. #ifndef __BIT_TYPES_DEFINED__
  83. #define __BIT_TYPES_DEFINED__
  84. typedef __u8 u_int8_t;
  85. typedef __s8 int8_t;
  86. typedef __u16 u_int16_t;
  87. typedef __s16 int16_t;
  88. typedef __u32 u_int32_t;
  89. typedef __s32 int32_t;
  90. #endif /* !(__BIT_TYPES_DEFINED__) */
  91. typedef __u8 uint8_t;
  92. typedef __u16 uint16_t;
  93. typedef __u32 uint32_t;
  94. #if defined(__GNUC__)
  95. typedef __u64 uint64_t;
  96. typedef __u64 u_int64_t;
  97. typedef __s64 int64_t;
  98. #endif
  99. /* this is a special 64bit data type that is 8-byte aligned */
  100. #define aligned_u64 __u64 __attribute__((aligned(8)))
  101. #define aligned_be64 __be64 __attribute__((aligned(8)))
  102. #define aligned_le64 __le64 __attribute__((aligned(8)))
  103. /**
  104. * The type used for indexing onto a disc or disc partition.
  105. *
  106. * Linux always considers sectors to be 512 bytes long independently
  107. * of the devices real block size.
  108. *
  109. * blkcnt_t is the type of the inode's block count.
  110. */
  111. #ifdef CONFIG_LBDAF
  112. typedef u64 sector_t;
  113. typedef u64 blkcnt_t;
  114. #else
  115. typedef unsigned long sector_t;
  116. typedef unsigned long blkcnt_t;
  117. #endif
  118. /*
  119. * The type of an index into the pagecache. Use a #define so asm/types.h
  120. * can override it.
  121. */
  122. #ifndef pgoff_t
  123. #define pgoff_t unsigned long
  124. #endif
  125. #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
  126. typedef u64 dma_addr_t;
  127. #else
  128. typedef u32 dma_addr_t;
  129. #endif /* dma_addr_t */
  130. #endif /* __KERNEL__ */
  131. /*
  132. * Below are truly Linux-specific types that should never collide with
  133. * any application/library that wants linux/types.h.
  134. */
  135. #ifdef __CHECKER__
  136. #define __bitwise__ __attribute__((bitwise))
  137. #else
  138. #define __bitwise__
  139. #endif
  140. #ifdef __CHECK_ENDIAN__
  141. #define __bitwise __bitwise__
  142. #else
  143. #define __bitwise
  144. #endif
  145. typedef __u16 __bitwise __le16;
  146. typedef __u16 __bitwise __be16;
  147. typedef __u32 __bitwise __le32;
  148. typedef __u32 __bitwise __be32;
  149. typedef __u64 __bitwise __le64;
  150. typedef __u64 __bitwise __be64;
  151. typedef __u16 __bitwise __sum16;
  152. typedef __u32 __bitwise __wsum;
  153. /*
  154. * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid
  155. * common 32/64-bit compat problems.
  156. * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other
  157. * architectures) and to 8-byte boundaries on 64-bit architectures. The new
  158. * aligned_64 type enforces 8-byte alignment so that structs containing
  159. * aligned_64 values have the same alignment on 32-bit and 64-bit architectures.
  160. * No conversions are necessary between 32-bit user-space and a 64-bit kernel.
  161. */
  162. #define __aligned_u64 __u64 __attribute__((aligned(8)))
  163. #define __aligned_be64 __be64 __attribute__((aligned(8)))
  164. #define __aligned_le64 __le64 __attribute__((aligned(8)))
  165. #ifdef __KERNEL__
  166. typedef unsigned __bitwise__ gfp_t;
  167. typedef unsigned __bitwise__ fmode_t;
  168. #ifdef CONFIG_PHYS_ADDR_T_64BIT
  169. typedef u64 phys_addr_t;
  170. #else
  171. typedef u32 phys_addr_t;
  172. #endif
  173. typedef phys_addr_t resource_size_t;
  174. /*
  175. * This type is the placeholder for a hardware interrupt number. It has to be
  176. * big enough to enclose whatever representation is used by a given platform.
  177. */
  178. typedef unsigned long irq_hw_number_t;
  179. typedef struct {
  180. int counter;
  181. } atomic_t;
  182. #ifdef CONFIG_64BIT
  183. typedef struct {
  184. long counter;
  185. } atomic64_t;
  186. #endif
  187. struct list_head {
  188. struct list_head *next, *prev;
  189. };
  190. struct hlist_head {
  191. struct hlist_node *first;
  192. };
  193. struct hlist_node {
  194. struct hlist_node *next, **pprev;
  195. };
  196. struct ustat {
  197. __kernel_daddr_t f_tfree;
  198. __kernel_ino_t f_tinode;
  199. char f_fname[6];
  200. char f_fpack[6];
  201. };
  202. /**
  203. * struct rcu_head - callback structure for use with RCU
  204. * @next: next update requests in a list
  205. * @func: actual update function to call after the grace period.
  206. */
  207. struct rcu_head {
  208. struct rcu_head *next;
  209. void (*func)(struct rcu_head *head);
  210. };
  211. #endif /* __KERNEL__ */
  212. #endif /* __ASSEMBLY__ */
  213. #endif /* _LINUX_TYPES_H */