treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / arm64 / include / asm / compat.h
blob935d2aa231bf066e21d08d15d11eb5246b40d203
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2012 ARM Ltd.
4 */
5 #ifndef __ASM_COMPAT_H
6 #define __ASM_COMPAT_H
8 #include <asm-generic/compat.h>
10 #ifdef CONFIG_COMPAT
13 * Architecture specific compatibility types
15 #include <linux/types.h>
16 #include <linux/sched.h>
17 #include <linux/sched/task_stack.h>
19 #define COMPAT_USER_HZ 100
20 #ifdef __AARCH64EB__
21 #define COMPAT_UTS_MACHINE "armv8b\0\0"
22 #else
23 #define COMPAT_UTS_MACHINE "armv8l\0\0"
24 #endif
26 typedef u16 __compat_uid_t;
27 typedef u16 __compat_gid_t;
28 typedef u16 __compat_uid16_t;
29 typedef u16 __compat_gid16_t;
30 typedef u32 __compat_uid32_t;
31 typedef u32 __compat_gid32_t;
32 typedef u16 compat_mode_t;
33 typedef u32 compat_dev_t;
34 typedef s32 compat_nlink_t;
35 typedef u16 compat_ipc_pid_t;
36 typedef u32 compat_caddr_t;
37 typedef __kernel_fsid_t compat_fsid_t;
38 typedef s64 compat_s64;
39 typedef u64 compat_u64;
41 struct compat_stat {
42 #ifdef __AARCH64EB__
43 short st_dev;
44 short __pad1;
45 #else
46 compat_dev_t st_dev;
47 #endif
48 compat_ino_t st_ino;
49 compat_mode_t st_mode;
50 compat_ushort_t st_nlink;
51 __compat_uid16_t st_uid;
52 __compat_gid16_t st_gid;
53 #ifdef __AARCH64EB__
54 short st_rdev;
55 short __pad2;
56 #else
57 compat_dev_t st_rdev;
58 #endif
59 compat_off_t st_size;
60 compat_off_t st_blksize;
61 compat_off_t st_blocks;
62 old_time32_t st_atime;
63 compat_ulong_t st_atime_nsec;
64 old_time32_t st_mtime;
65 compat_ulong_t st_mtime_nsec;
66 old_time32_t st_ctime;
67 compat_ulong_t st_ctime_nsec;
68 compat_ulong_t __unused4[2];
71 struct compat_flock {
72 short l_type;
73 short l_whence;
74 compat_off_t l_start;
75 compat_off_t l_len;
76 compat_pid_t l_pid;
79 #define F_GETLK64 12 /* using 'struct flock64' */
80 #define F_SETLK64 13
81 #define F_SETLKW64 14
83 struct compat_flock64 {
84 short l_type;
85 short l_whence;
86 compat_loff_t l_start;
87 compat_loff_t l_len;
88 compat_pid_t l_pid;
91 struct compat_statfs {
92 int f_type;
93 int f_bsize;
94 int f_blocks;
95 int f_bfree;
96 int f_bavail;
97 int f_files;
98 int f_ffree;
99 compat_fsid_t f_fsid;
100 int f_namelen; /* SunOS ignores this field. */
101 int f_frsize;
102 int f_flags;
103 int f_spare[4];
106 #define COMPAT_RLIM_INFINITY 0xffffffff
108 typedef u32 compat_old_sigset_t;
110 #define _COMPAT_NSIG 64
111 #define _COMPAT_NSIG_BPW 32
113 typedef u32 compat_sigset_word;
115 #define COMPAT_OFF_T_MAX 0x7fffffff
117 #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
118 #define COMPAT_MINSIGSTKSZ 2048
120 static inline void __user *arch_compat_alloc_user_space(long len)
122 return (void __user *)compat_user_stack_pointer() - len;
125 struct compat_ipc64_perm {
126 compat_key_t key;
127 __compat_uid32_t uid;
128 __compat_gid32_t gid;
129 __compat_uid32_t cuid;
130 __compat_gid32_t cgid;
131 unsigned short mode;
132 unsigned short __pad1;
133 unsigned short seq;
134 unsigned short __pad2;
135 compat_ulong_t unused1;
136 compat_ulong_t unused2;
139 struct compat_semid64_ds {
140 struct compat_ipc64_perm sem_perm;
141 compat_ulong_t sem_otime;
142 compat_ulong_t sem_otime_high;
143 compat_ulong_t sem_ctime;
144 compat_ulong_t sem_ctime_high;
145 compat_ulong_t sem_nsems;
146 compat_ulong_t __unused3;
147 compat_ulong_t __unused4;
150 struct compat_msqid64_ds {
151 struct compat_ipc64_perm msg_perm;
152 compat_ulong_t msg_stime;
153 compat_ulong_t msg_stime_high;
154 compat_ulong_t msg_rtime;
155 compat_ulong_t msg_rtime_high;
156 compat_ulong_t msg_ctime;
157 compat_ulong_t msg_ctime_high;
158 compat_ulong_t msg_cbytes;
159 compat_ulong_t msg_qnum;
160 compat_ulong_t msg_qbytes;
161 compat_pid_t msg_lspid;
162 compat_pid_t msg_lrpid;
163 compat_ulong_t __unused4;
164 compat_ulong_t __unused5;
167 struct compat_shmid64_ds {
168 struct compat_ipc64_perm shm_perm;
169 compat_size_t shm_segsz;
170 compat_ulong_t shm_atime;
171 compat_ulong_t shm_atime_high;
172 compat_ulong_t shm_dtime;
173 compat_ulong_t shm_dtime_high;
174 compat_ulong_t shm_ctime;
175 compat_ulong_t shm_ctime_high;
176 compat_pid_t shm_cpid;
177 compat_pid_t shm_lpid;
178 compat_ulong_t shm_nattch;
179 compat_ulong_t __unused4;
180 compat_ulong_t __unused5;
183 static inline int is_compat_task(void)
185 return test_thread_flag(TIF_32BIT);
188 static inline int is_compat_thread(struct thread_info *thread)
190 return test_ti_thread_flag(thread, TIF_32BIT);
193 #else /* !CONFIG_COMPAT */
195 static inline int is_compat_thread(struct thread_info *thread)
197 return 0;
200 #endif /* CONFIG_COMPAT */
201 #endif /* __ASM_COMPAT_H */