1 #ifndef _LINUX_TYPES_H 2 #define _LINUX_TYPES_H 3 4 #ifdef __KERNEL__ 5 #include <linux/config.h> 6 7 #define BITS_TO_LONGS(bits) \ 8 (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG) 9 #define DECLARE_BITMAP(name,bits) \ 10 unsigned long name[BITS_TO_LONGS(bits)] 11 #define CLEAR_BITMAP(name,bits) \ 12 memset(name, 0, BITS_TO_LONGS(bits)*sizeof(unsigned long)) 13 #endif 14 15 #include <linux/posix_types.h> 16 #include <asm/types.h> 17 18 #ifndef __KERNEL_STRICT_NAMES 19 20 typedef __kernel_fd_set fd_set; 21 typedef __kernel_dev_t dev_t; 22 typedef __kernel_ino_t ino_t; 23 typedef __kernel_mode_t mode_t; 24 typedef __kernel_nlink_t nlink_t; 25 typedef __kernel_off_t off_t; 26 typedef __kernel_pid_t pid_t; 27 typedef __kernel_daddr_t daddr_t; 28 typedef __kernel_key_t key_t; 29 typedef __kernel_suseconds_t suseconds_t; 30 31 #ifdef __KERNEL__ 32 typedef __kernel_uid32_t uid_t; 33 typedef __kernel_gid32_t gid_t; 34 typedef __kernel_uid16_t uid16_t; 35 typedef __kernel_gid16_t gid16_t; 36 37 #ifdef CONFIG_UID16 38 /* This is defined by include/asm-{arch}/posix_types.h */ 39 typedef __kernel_old_uid_t old_uid_t; 40 typedef __kernel_old_gid_t old_gid_t; 41 #endif /* CONFIG_UID16 */ 42 43 /* libc5 includes this file to define uid_t, thus uid_t can never change 44 * when it is included by non-kernel code 45 */ 46 #else 47 typedef __kernel_uid_t uid_t; 48 typedef __kernel_gid_t gid_t; 49 #endif /* __KERNEL__ */ 50 51 #if defined(__GNUC__) 52 typedef __kernel_loff_t loff_t; 53 #endif 54 55 /* 56 * The following typedefs are also protected by individual ifdefs for 57 * historical reasons: 58 */ 59 #ifndef _SIZE_T 60 #define _SIZE_T 61 typedef __kernel_size_t size_t; 62 #endif 63 64 #ifndef _SSIZE_T 65 #define _SSIZE_T 66 typedef __kernel_ssize_t ssize_t; 67 #endif 68 69 #ifndef _PTRDIFF_T 70 #define _PTRDIFF_T 71 typedef __kernel_ptrdiff_t ptrdiff_t; 72 #endif 73 74 #ifndef _TIME_T 75 #define _TIME_T 76 typedef __kernel_time_t time_t; 77 #endif 78 79 #ifndef _CLOCK_T 80 #define _CLOCK_T 81 typedef __kernel_clock_t clock_t; 82 #endif 83 84 #ifndef _CADDR_T 85 #define _CADDR_T 86 typedef __kernel_caddr_t caddr_t; 87 #endif 88 89 /* bsd */ 90 typedef unsigned char u_char; 91 typedef unsigned short u_short; 92 typedef unsigned int u_int; 93 typedef unsigned long u_long; 94 95 /* sysv */ 96 typedef unsigned char unchar; 97 typedef unsigned short ushort; 98 typedef unsigned int uint; 99 typedef unsigned long ulong; 100 101 #ifndef __BIT_TYPES_DEFINED__ 102 #define __BIT_TYPES_DEFINED__ 103 104 typedef __u8 u_int8_t; 105 typedef __s8 int8_t; 106 typedef __u16 u_int16_t; 107 typedef __s16 int16_t; 108 typedef __u32 u_int32_t; 109 typedef __s32 int32_t; 110 111 #endif /* !(__BIT_TYPES_DEFINED__) */ 112 113 typedef __u8 uint8_t; 114 typedef __u16 uint16_t; 115 typedef __u32 uint32_t; 116 117 #if defined(__GNUC__) && !defined(__STRICT_ANSI__) 118 typedef __u64 uint64_t; 119 typedef __u64 u_int64_t; 120 typedef __s64 int64_t; 121 #endif 122 123 #endif /* __KERNEL_STRICT_NAMES */ 124 125 /* 126 * Below are truly Linux-specific types that should never collide with 127 * any application/library that wants linux/types.h. 128 */ 129 130 struct ustat { 131 __kernel_daddr_t f_tfree; 132 __kernel_ino_t f_tinode; 133 char f_fname[6]; 134 char f_fpack[6]; 135 }; 136 137 #endif /* _LINUX_TYPES_H */ 138