Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_TYPES_H
0003 #define _LINUX_TYPES_H
0004 
0005 #define __EXPORTED_HEADERS__
0006 #include <uapi/linux/types.h>
0007 
0008 #ifndef __ASSEMBLY__
0009 
0010 #define DECLARE_BITMAP(name,bits) \
0011     unsigned long name[BITS_TO_LONGS(bits)]
0012 
0013 typedef u32 __kernel_dev_t;
0014 
0015 typedef __kernel_fd_set     fd_set;
0016 typedef __kernel_dev_t      dev_t;
0017 typedef __kernel_ulong_t    ino_t;
0018 typedef __kernel_mode_t     mode_t;
0019 typedef unsigned short      umode_t;
0020 typedef u32         nlink_t;
0021 typedef __kernel_off_t      off_t;
0022 typedef __kernel_pid_t      pid_t;
0023 typedef __kernel_daddr_t    daddr_t;
0024 typedef __kernel_key_t      key_t;
0025 typedef __kernel_suseconds_t    suseconds_t;
0026 typedef __kernel_timer_t    timer_t;
0027 typedef __kernel_clockid_t  clockid_t;
0028 typedef __kernel_mqd_t      mqd_t;
0029 
0030 typedef _Bool           bool;
0031 
0032 typedef __kernel_uid32_t    uid_t;
0033 typedef __kernel_gid32_t    gid_t;
0034 typedef __kernel_uid16_t        uid16_t;
0035 typedef __kernel_gid16_t        gid16_t;
0036 
0037 typedef unsigned long       uintptr_t;
0038 
0039 #ifdef CONFIG_HAVE_UID16
0040 /* This is defined by include/asm-{arch}/posix_types.h */
0041 typedef __kernel_old_uid_t  old_uid_t;
0042 typedef __kernel_old_gid_t  old_gid_t;
0043 #endif /* CONFIG_UID16 */
0044 
0045 #if defined(__GNUC__)
0046 typedef __kernel_loff_t     loff_t;
0047 #endif
0048 
0049 /*
0050  * The following typedefs are also protected by individual ifdefs for
0051  * historical reasons:
0052  */
0053 #ifndef _SIZE_T
0054 #define _SIZE_T
0055 typedef __kernel_size_t     size_t;
0056 #endif
0057 
0058 #ifndef _SSIZE_T
0059 #define _SSIZE_T
0060 typedef __kernel_ssize_t    ssize_t;
0061 #endif
0062 
0063 #ifndef _PTRDIFF_T
0064 #define _PTRDIFF_T
0065 typedef __kernel_ptrdiff_t  ptrdiff_t;
0066 #endif
0067 
0068 #ifndef _CLOCK_T
0069 #define _CLOCK_T
0070 typedef __kernel_clock_t    clock_t;
0071 #endif
0072 
0073 #ifndef _CADDR_T
0074 #define _CADDR_T
0075 typedef __kernel_caddr_t    caddr_t;
0076 #endif
0077 
0078 /* bsd */
0079 typedef unsigned char       u_char;
0080 typedef unsigned short      u_short;
0081 typedef unsigned int        u_int;
0082 typedef unsigned long       u_long;
0083 
0084 /* sysv */
0085 typedef unsigned char       unchar;
0086 typedef unsigned short      ushort;
0087 typedef unsigned int        uint;
0088 typedef unsigned long       ulong;
0089 
0090 #ifndef __BIT_TYPES_DEFINED__
0091 #define __BIT_TYPES_DEFINED__
0092 
0093 typedef u8          u_int8_t;
0094 typedef s8          int8_t;
0095 typedef u16         u_int16_t;
0096 typedef s16         int16_t;
0097 typedef u32         u_int32_t;
0098 typedef s32         int32_t;
0099 
0100 #endif /* !(__BIT_TYPES_DEFINED__) */
0101 
0102 typedef u8          uint8_t;
0103 typedef u16         uint16_t;
0104 typedef u32         uint32_t;
0105 
0106 #if defined(__GNUC__)
0107 typedef u64         uint64_t;
0108 typedef u64         u_int64_t;
0109 typedef s64         int64_t;
0110 #endif
0111 
0112 /* this is a special 64bit data type that is 8-byte aligned */
0113 #define aligned_u64     __aligned_u64
0114 #define aligned_be64        __aligned_be64
0115 #define aligned_le64        __aligned_le64
0116 
0117 /**
0118  * The type used for indexing onto a disc or disc partition.
0119  *
0120  * Linux always considers sectors to be 512 bytes long independently
0121  * of the devices real block size.
0122  *
0123  * blkcnt_t is the type of the inode's block count.
0124  */
0125 typedef u64 sector_t;
0126 typedef u64 blkcnt_t;
0127 
0128 /*
0129  * The type of an index into the pagecache.
0130  */
0131 #define pgoff_t unsigned long
0132 
0133 /*
0134  * A dma_addr_t can hold any valid DMA address, i.e., any address returned
0135  * by the DMA API.
0136  *
0137  * If the DMA API only uses 32-bit addresses, dma_addr_t need only be 32
0138  * bits wide.  Bus addresses, e.g., PCI BARs, may be wider than 32 bits,
0139  * but drivers do memory-mapped I/O to ioremapped kernel virtual addresses,
0140  * so they don't care about the size of the actual bus addresses.
0141  */
0142 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
0143 typedef u64 dma_addr_t;
0144 #else
0145 typedef u32 dma_addr_t;
0146 #endif
0147 
0148 typedef unsigned int __bitwise gfp_t;
0149 typedef unsigned int __bitwise slab_flags_t;
0150 typedef unsigned int __bitwise fmode_t;
0151 
0152 #ifdef CONFIG_PHYS_ADDR_T_64BIT
0153 typedef u64 phys_addr_t;
0154 #else
0155 typedef u32 phys_addr_t;
0156 #endif
0157 
0158 typedef phys_addr_t resource_size_t;
0159 
0160 /*
0161  * This type is the placeholder for a hardware interrupt number. It has to be
0162  * big enough to enclose whatever representation is used by a given platform.
0163  */
0164 typedef unsigned long irq_hw_number_t;
0165 
0166 typedef struct {
0167     int counter;
0168 } atomic_t;
0169 
0170 #define ATOMIC_INIT(i) { (i) }
0171 
0172 #ifdef CONFIG_64BIT
0173 typedef struct {
0174     s64 counter;
0175 } atomic64_t;
0176 #endif
0177 
0178 struct list_head {
0179     struct list_head *next, *prev;
0180 };
0181 
0182 struct hlist_head {
0183     struct hlist_node *first;
0184 };
0185 
0186 struct hlist_node {
0187     struct hlist_node *next, **pprev;
0188 };
0189 
0190 struct ustat {
0191     __kernel_daddr_t    f_tfree;
0192 #ifdef CONFIG_ARCH_32BIT_USTAT_F_TINODE
0193     unsigned int        f_tinode;
0194 #else
0195     unsigned long       f_tinode;
0196 #endif
0197     char            f_fname[6];
0198     char            f_fpack[6];
0199 };
0200 
0201 /**
0202  * struct callback_head - callback structure for use with RCU and task_work
0203  * @next: next update requests in a list
0204  * @func: actual update function to call after the grace period.
0205  *
0206  * The struct is aligned to size of pointer. On most architectures it happens
0207  * naturally due ABI requirements, but some architectures (like CRIS) have
0208  * weird ABI and we need to ask it explicitly.
0209  *
0210  * The alignment is required to guarantee that bit 0 of @next will be
0211  * clear under normal conditions -- as long as we use call_rcu() or
0212  * call_srcu() to queue the callback.
0213  *
0214  * This guarantee is important for few reasons:
0215  *  - future call_rcu_lazy() will make use of lower bits in the pointer;
0216  *  - the structure shares storage space in struct page with @compound_head,
0217  *    which encode PageTail() in bit 0. The guarantee is needed to avoid
0218  *    false-positive PageTail().
0219  */
0220 struct callback_head {
0221     struct callback_head *next;
0222     void (*func)(struct callback_head *head);
0223 } __attribute__((aligned(sizeof(void *))));
0224 #define rcu_head callback_head
0225 
0226 typedef void (*rcu_callback_t)(struct rcu_head *head);
0227 typedef void (*call_rcu_func_t)(struct rcu_head *head, rcu_callback_t func);
0228 
0229 typedef void (*swap_r_func_t)(void *a, void *b, int size, const void *priv);
0230 typedef void (*swap_func_t)(void *a, void *b, int size);
0231 
0232 typedef int (*cmp_r_func_t)(const void *a, const void *b, const void *priv);
0233 typedef int (*cmp_func_t)(const void *a, const void *b);
0234 
0235 #endif /*  __ASSEMBLY__ */
0236 #endif /* _LINUX_TYPES_H */