1/* 2 * This header has been modifies to remove definitions of types that 3 * are defined in standard userspace headers or are problematic for some 4 * other reason. 5 */ 6 7#ifndef _LINUX_TYPES_H 8#define _LINUX_TYPES_H 9 10#define __EXPORTED_HEADERS__ 11#include <uapi/linux/types.h> 12 13#ifndef __ASSEMBLY__ 14 15#define DECLARE_BITMAP(name, bits) \ 16 unsigned long name[BITS_TO_LONGS(bits)] 17 18typedef __u32 __kernel_dev_t; 19 20/* bsd */ 21typedef unsigned char u_char; 22typedef unsigned short u_short; 23typedef unsigned int u_int; 24typedef unsigned long u_long; 25 26/* sysv */ 27typedef unsigned char unchar; 28typedef unsigned short ushort; 29typedef unsigned int uint; 30typedef unsigned long ulong; 31 32#ifndef __BIT_TYPES_DEFINED__ 33#define __BIT_TYPES_DEFINED__ 34 35typedef __u8 u_int8_t; 36typedef __s8 int8_t; 37typedef __u16 u_int16_t; 38typedef __s16 int16_t; 39typedef __u32 u_int32_t; 40typedef __s32 int32_t; 41 42#endif /* !(__BIT_TYPES_DEFINED__) */ 43 44typedef __u8 uint8_t; 45typedef __u16 uint16_t; 46typedef __u32 uint32_t; 47 48/* this is a special 64bit data type that is 8-byte aligned */ 49#define aligned_u64 __u64 __attribute__((aligned(8))) 50#define aligned_be64 __be64 __attribute__((aligned(8))) 51#define aligned_le64 __le64 __attribute__((aligned(8))) 52 53/** 54 * The type used for indexing onto a disc or disc partition. 55 * 56 * Linux always considers sectors to be 512 bytes long independently 57 * of the devices real block size. 58 * 59 * blkcnt_t is the type of the inode's block count. 60 */ 61#ifdef CONFIG_LBDAF 62typedef u64 sector_t; 63#else 64typedef unsigned long sector_t; 65#endif 66 67/* 68 * The type of an index into the pagecache. 69 */ 70#define pgoff_t unsigned long 71 72/* 73 * A dma_addr_t can hold any valid DMA address, i.e., any address returned 74 * by the DMA API. 75 * 76 * If the DMA API only uses 32-bit addresses, dma_addr_t need only be 32 77 * bits wide. Bus addresses, e.g., PCI BARs, may be wider than 32 bits, 78 * but drivers do memory-mapped I/O to ioremapped kernel virtual addresses, 79 * so they don't care about the size of the actual bus addresses. 80 */ 81#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 82typedef u64 dma_addr_t; 83#else 84typedef u32 dma_addr_t; 85#endif 86 87#ifdef CONFIG_PHYS_ADDR_T_64BIT 88typedef u64 phys_addr_t; 89#else 90typedef u32 phys_addr_t; 91#endif 92 93typedef phys_addr_t resource_size_t; 94 95/* 96 * This type is the placeholder for a hardware interrupt number. It has to be 97 * big enough to enclose whatever representation is used by a given platform. 98 */ 99typedef unsigned long irq_hw_number_t; 100 101typedef struct { 102 int counter; 103} atomic_t; 104 105#ifdef CONFIG_64BIT 106typedef struct { 107 long counter; 108} atomic64_t; 109#endif 110 111struct list_head { 112 struct list_head *next, *prev; 113}; 114 115struct hlist_head { 116 struct hlist_node *first; 117}; 118 119struct hlist_node { 120 struct hlist_node *next, **pprev; 121}; 122 123/** 124 * struct callback_head - callback structure for use with RCU and task_work 125 * @next: next update requests in a list 126 * @func: actual update function to call after the grace period. 127 * 128 * The struct is aligned to size of pointer. On most architectures it happens 129 * naturally due ABI requirements, but some architectures (like CRIS) have 130 * weird ABI and we need to ask it explicitly. 131 * 132 * The alignment is required to guarantee that bits 0 and 1 of @next will be 133 * clear under normal conditions -- as long as we use call_rcu(), 134 * call_rcu_bh(), call_rcu_sched(), or call_srcu() to queue callback. 135 * 136 * This guarantee is important for few reasons: 137 * - future call_rcu_lazy() will make use of lower bits in the pointer; 138 * - the structure shares storage spacer in struct page with @compound_head, 139 * which encode PageTail() in bit 0. The guarantee is needed to avoid 140 * false-positive PageTail(). 141 */ 142struct callback_head { 143 struct callback_head *next; 144 void (*func)(struct callback_head *head); 145} __attribute__((aligned(sizeof(void *)))); 146#define rcu_head callback_head 147 148typedef void (*rcu_callback_t)(struct rcu_head *head); 149typedef void (*call_rcu_func_t)(struct rcu_head *head, rcu_callback_t func); 150 151/* clocksource cycle base type */ 152typedef u64 cycle_t; 153 154#endif /* __ASSEMBLY__ */ 155#endif /* _LINUX_TYPES_H */ 156