Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
[linux-2.6-block.git] / include / asm-generic / compat.h
CommitLineData
2b5a9a37 1/* SPDX-License-Identifier: GPL-2.0 */
fb373975
AB
2#ifndef __ASM_GENERIC_COMPAT_H
3#define __ASM_GENERIC_COMPAT_H
2b5a9a37 4
84a0c977
GR
5#ifndef COMPAT_USER_HZ
6#define COMPAT_USER_HZ 100
7#endif
8
9#ifndef COMPAT_RLIM_INFINITY
10#define COMPAT_RLIM_INFINITY 0xffffffff
11#endif
12
13#ifndef COMPAT_OFF_T_MAX
14#define COMPAT_OFF_T_MAX 0x7fffffff
15#endif
16
59c10c52
GR
17#if !defined(compat_arg_u64) && !defined(CONFIG_CPU_BIG_ENDIAN)
18#define compat_arg_u64(name) u32 name##_lo, u32 name##_hi
19#define compat_arg_u64_dual(name) u32, name##_lo, u32, name##_hi
20#define compat_arg_u64_glue(name) (((u64)name##_lo & 0xffffffffUL) | \
21 ((u64)name##_hi << 32))
22#endif
23
fb373975
AB
24/* These types are common across all compat ABIs */
25typedef u32 compat_size_t;
26typedef s32 compat_ssize_t;
27typedef s32 compat_clock_t;
28typedef s32 compat_pid_t;
29typedef u32 compat_ino_t;
30typedef s32 compat_off_t;
31typedef s64 compat_loff_t;
32typedef s32 compat_daddr_t;
33typedef s32 compat_timer_t;
34typedef s32 compat_key_t;
35typedef s16 compat_short_t;
36typedef s32 compat_int_t;
37typedef s32 compat_long_t;
38typedef u16 compat_ushort_t;
39typedef u32 compat_uint_t;
40typedef u32 compat_ulong_t;
41typedef u32 compat_uptr_t;
1a33b18b 42typedef u32 compat_caddr_t;
fb373975 43typedef u32 compat_aio_context_t;
1a33b18b
AB
44typedef u32 compat_old_sigset_t;
45
84a0c977
GR
46#ifndef __compat_uid_t
47typedef u32 __compat_uid_t;
48typedef u32 __compat_gid_t;
49#endif
50
1a33b18b
AB
51#ifndef __compat_uid32_t
52typedef u32 __compat_uid32_t;
53typedef u32 __compat_gid32_t;
54#endif
55
56#ifndef compat_mode_t
57typedef u32 compat_mode_t;
58#endif
fb373975 59
cc7886d2
CH
60#ifdef CONFIG_COMPAT_FOR_U64_ALIGNMENT
61typedef s64 __attribute__((aligned(4))) compat_s64;
62typedef u64 __attribute__((aligned(4))) compat_u64;
63#else
64typedef s64 compat_s64;
65typedef u64 compat_u64;
66#endif
67
1a33b18b
AB
68#ifndef _COMPAT_NSIG
69typedef u32 compat_sigset_word;
70#define _COMPAT_NSIG _NSIG
71#define _COMPAT_NSIG_BPW 32
72#endif
73
84a0c977
GR
74#ifndef compat_dev_t
75typedef u32 compat_dev_t;
76#endif
77
78#ifndef compat_ipc_pid_t
79typedef s32 compat_ipc_pid_t;
80#endif
81
82#ifndef compat_fsid_t
83typedef __kernel_fsid_t compat_fsid_t;
84#endif
85
86#ifndef compat_statfs
87struct compat_statfs {
88 compat_int_t f_type;
89 compat_int_t f_bsize;
90 compat_int_t f_blocks;
91 compat_int_t f_bfree;
92 compat_int_t f_bavail;
93 compat_int_t f_files;
94 compat_int_t f_ffree;
95 compat_fsid_t f_fsid;
96 compat_int_t f_namelen;
97 compat_int_t f_frsize;
98 compat_int_t f_flags;
99 compat_int_t f_spare[4];
100};
101#endif
102
103#ifndef compat_ipc64_perm
104struct compat_ipc64_perm {
105 compat_key_t key;
106 __compat_uid32_t uid;
107 __compat_gid32_t gid;
108 __compat_uid32_t cuid;
109 __compat_gid32_t cgid;
110 compat_mode_t mode;
111 unsigned char __pad1[4 - sizeof(compat_mode_t)];
112 compat_ushort_t seq;
113 compat_ushort_t __pad2;
114 compat_ulong_t unused1;
115 compat_ulong_t unused2;
116};
117
118struct compat_semid64_ds {
119 struct compat_ipc64_perm sem_perm;
120 compat_ulong_t sem_otime;
121 compat_ulong_t sem_otime_high;
122 compat_ulong_t sem_ctime;
123 compat_ulong_t sem_ctime_high;
124 compat_ulong_t sem_nsems;
125 compat_ulong_t __unused3;
126 compat_ulong_t __unused4;
127};
128
129struct compat_msqid64_ds {
130 struct compat_ipc64_perm msg_perm;
131 compat_ulong_t msg_stime;
132 compat_ulong_t msg_stime_high;
133 compat_ulong_t msg_rtime;
134 compat_ulong_t msg_rtime_high;
135 compat_ulong_t msg_ctime;
136 compat_ulong_t msg_ctime_high;
137 compat_ulong_t msg_cbytes;
138 compat_ulong_t msg_qnum;
139 compat_ulong_t msg_qbytes;
140 compat_pid_t msg_lspid;
141 compat_pid_t msg_lrpid;
142 compat_ulong_t __unused4;
143 compat_ulong_t __unused5;
144};
145
146struct compat_shmid64_ds {
147 struct compat_ipc64_perm shm_perm;
148 compat_size_t shm_segsz;
149 compat_ulong_t shm_atime;
150 compat_ulong_t shm_atime_high;
151 compat_ulong_t shm_dtime;
152 compat_ulong_t shm_dtime_high;
153 compat_ulong_t shm_ctime;
154 compat_ulong_t shm_ctime_high;
155 compat_pid_t shm_cpid;
156 compat_pid_t shm_lpid;
157 compat_ulong_t shm_nattch;
158 compat_ulong_t __unused4;
159 compat_ulong_t __unused5;
160};
161#endif
162
fb373975 163#endif