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