/kern_2.6.32/include/linux/types.h

http://omnia2droid.googlecode.com/ · C++ Header · 209 lines · 144 code · 41 blank · 24 comment · 0 complexity · 3d38b859f6173d301fc081d87fbcdf1b 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. #endif
  9. #include <linux/posix_types.h>
  10. #ifdef __KERNEL__
  11. typedef __u32 __kernel_dev_t;
  12. typedef __kernel_fd_set fd_set;
  13. typedef __kernel_dev_t dev_t;
  14. typedef __kernel_ino_t ino_t;
  15. typedef __kernel_mode_t mode_t;
  16. typedef __kernel_nlink_t nlink_t;
  17. typedef __kernel_off_t off_t;
  18. typedef __kernel_pid_t pid_t;
  19. typedef __kernel_daddr_t daddr_t;
  20. typedef __kernel_key_t key_t;
  21. typedef __kernel_suseconds_t suseconds_t;
  22. typedef __kernel_timer_t timer_t;
  23. typedef __kernel_clockid_t clockid_t;
  24. typedef __kernel_mqd_t mqd_t;
  25. typedef _Bool bool;
  26. typedef __kernel_uid32_t uid_t;
  27. typedef __kernel_gid32_t gid_t;
  28. typedef __kernel_uid16_t uid16_t;
  29. typedef __kernel_gid16_t gid16_t;
  30. typedef unsigned long uintptr_t;
  31. #ifdef CONFIG_UID16
  32. /* This is defined by include/asm-{arch}/posix_types.h */
  33. typedef __kernel_old_uid_t old_uid_t;
  34. typedef __kernel_old_gid_t old_gid_t;
  35. #endif /* CONFIG_UID16 */
  36. #if defined(__GNUC__)
  37. typedef __kernel_loff_t loff_t;
  38. #endif
  39. /*
  40. * The following typedefs are also protected by individual ifdefs for
  41. * historical reasons:
  42. */
  43. #ifndef _SIZE_T
  44. #define _SIZE_T
  45. typedef __kernel_size_t size_t;
  46. #endif
  47. #ifndef _SSIZE_T
  48. #define _SSIZE_T
  49. typedef __kernel_ssize_t ssize_t;
  50. #endif
  51. #ifndef _PTRDIFF_T
  52. #define _PTRDIFF_T
  53. typedef __kernel_ptrdiff_t ptrdiff_t;
  54. #endif
  55. #ifndef _TIME_T
  56. #define _TIME_T
  57. typedef __kernel_time_t time_t;
  58. #endif
  59. #ifndef _CLOCK_T
  60. #define _CLOCK_T
  61. typedef __kernel_clock_t clock_t;
  62. #endif
  63. #ifndef _CADDR_T
  64. #define _CADDR_T
  65. typedef __kernel_caddr_t caddr_t;
  66. #endif
  67. /* bsd */
  68. typedef unsigned char u_char;
  69. typedef unsigned short u_short;
  70. typedef unsigned int u_int;
  71. typedef unsigned long u_long;
  72. /* sysv */
  73. typedef unsigned char unchar;
  74. typedef unsigned short ushort;
  75. typedef unsigned int uint;
  76. typedef unsigned long ulong;
  77. #ifndef __BIT_TYPES_DEFINED__
  78. #define __BIT_TYPES_DEFINED__
  79. typedef __u8 u_int8_t;
  80. typedef __s8 int8_t;
  81. typedef __u16 u_int16_t;
  82. typedef __s16 int16_t;
  83. typedef __u32 u_int32_t;
  84. typedef __s32 int32_t;
  85. #endif /* !(__BIT_TYPES_DEFINED__) */
  86. typedef __u8 uint8_t;
  87. typedef __u16 uint16_t;
  88. typedef __u32 uint32_t;
  89. #if defined(__GNUC__)
  90. typedef __u64 uint64_t;
  91. typedef __u64 u_int64_t;
  92. typedef __s64 int64_t;
  93. #endif
  94. /* this is a special 64bit data type that is 8-byte aligned */
  95. #define aligned_u64 __u64 __attribute__((aligned(8)))
  96. #define aligned_be64 __be64 __attribute__((aligned(8)))
  97. #define aligned_le64 __le64 __attribute__((aligned(8)))
  98. /**
  99. * The type used for indexing onto a disc or disc partition.
  100. *
  101. * Linux always considers sectors to be 512 bytes long independently
  102. * of the devices real block size.
  103. *
  104. * blkcnt_t is the type of the inode's block count.
  105. */
  106. #ifdef CONFIG_LBDAF
  107. typedef u64 sector_t;
  108. typedef u64 blkcnt_t;
  109. #else
  110. typedef unsigned long sector_t;
  111. typedef unsigned long blkcnt_t;
  112. #endif
  113. /*
  114. * The type of an index into the pagecache. Use a #define so asm/types.h
  115. * can override it.
  116. */
  117. #ifndef pgoff_t
  118. #define pgoff_t unsigned long
  119. #endif
  120. #endif /* __KERNEL__ */
  121. /*
  122. * Below are truly Linux-specific types that should never collide with
  123. * any application/library that wants linux/types.h.
  124. */
  125. #ifdef __CHECKER__
  126. #define __bitwise__ __attribute__((bitwise))
  127. #else
  128. #define __bitwise__
  129. #endif
  130. #ifdef __CHECK_ENDIAN__
  131. #define __bitwise __bitwise__
  132. #else
  133. #define __bitwise
  134. #endif
  135. typedef __u16 __bitwise __le16;
  136. typedef __u16 __bitwise __be16;
  137. typedef __u32 __bitwise __le32;
  138. typedef __u32 __bitwise __be32;
  139. typedef __u64 __bitwise __le64;
  140. typedef __u64 __bitwise __be64;
  141. typedef __u16 __bitwise __sum16;
  142. typedef __u32 __bitwise __wsum;
  143. #ifdef __KERNEL__
  144. typedef unsigned __bitwise__ gfp_t;
  145. typedef unsigned __bitwise__ fmode_t;
  146. #ifdef CONFIG_PHYS_ADDR_T_64BIT
  147. typedef u64 phys_addr_t;
  148. #else
  149. typedef u32 phys_addr_t;
  150. #endif
  151. typedef phys_addr_t resource_size_t;
  152. typedef struct {
  153. volatile int counter;
  154. } atomic_t;
  155. #ifdef CONFIG_64BIT
  156. typedef struct {
  157. volatile long counter;
  158. } atomic64_t;
  159. #endif
  160. struct ustat {
  161. __kernel_daddr_t f_tfree;
  162. __kernel_ino_t f_tinode;
  163. char f_fname[6];
  164. char f_fpack[6];
  165. };
  166. #endif /* __KERNEL__ */
  167. #endif /* __ASSEMBLY__ */
  168. #endif /* _LINUX_TYPES_H */