]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - arch/powerpc/include/asm/compat.h
UBUNTU: Ubuntu-5.15.0-39.42
[mirror_ubuntu-jammy-kernel.git] / arch / powerpc / include / asm / compat.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
8882a4da
DG
2#ifndef _ASM_POWERPC_COMPAT_H
3#define _ASM_POWERPC_COMPAT_H
88ced031 4#ifdef __KERNEL__
1da177e4
LT
5/*
6 * Architecture specific compatibility types
7 */
8#include <linux/types.h>
9#include <linux/sched.h>
10
fb373975
AB
11#include <asm-generic/compat.h>
12
e28cbf22 13#define COMPAT_USER_HZ 100
422b9b96 14#ifdef __BIG_ENDIAN__
e28cbf22 15#define COMPAT_UTS_MACHINE "ppc\0\0"
422b9b96
AB
16#else
17#define COMPAT_UTS_MACHINE "ppcle\0\0"
18#endif
1da177e4 19
202e5979
SR
20typedef u32 __compat_uid_t;
21typedef u32 __compat_gid_t;
1da177e4 22typedef u32 compat_dev_t;
1da177e4
LT
23typedef s16 compat_nlink_t;
24typedef u16 compat_ipc_pid_t;
1da177e4 25typedef __kernel_fsid_t compat_fsid_t;
1da177e4 26
1da177e4
LT
27struct compat_stat {
28 compat_dev_t st_dev;
29 compat_ino_t st_ino;
30 compat_mode_t st_mode;
8882a4da 31 compat_nlink_t st_nlink;
202e5979
SR
32 __compat_uid32_t st_uid;
33 __compat_gid32_t st_gid;
1da177e4
LT
34 compat_dev_t st_rdev;
35 compat_off_t st_size;
36 compat_off_t st_blksize;
37 compat_off_t st_blocks;
9afc5eee 38 old_time32_t st_atime;
1da177e4 39 u32 st_atime_nsec;
9afc5eee 40 old_time32_t st_mtime;
1da177e4 41 u32 st_mtime_nsec;
9afc5eee 42 old_time32_t st_ctime;
1da177e4
LT
43 u32 st_ctime_nsec;
44 u32 __unused4[2];
45};
46
47struct compat_flock {
48 short l_type;
49 short l_whence;
50 compat_off_t l_start;
51 compat_off_t l_len;
52 compat_pid_t l_pid;
53};
54
55#define F_GETLK64 12 /* using 'struct flock64' */
56#define F_SETLK64 13
57#define F_SETLKW64 14
58
59struct compat_flock64 {
60 short l_type;
61 short l_whence;
62 compat_loff_t l_start;
63 compat_loff_t l_len;
64 compat_pid_t l_pid;
65};
66
67struct compat_statfs {
68 int f_type;
69 int f_bsize;
70 int f_blocks;
71 int f_bfree;
72 int f_bavail;
73 int f_files;
74 int f_ffree;
75 compat_fsid_t f_fsid;
76 int f_namelen; /* SunOS ignores this field. */
77 int f_frsize;
1448c721
EB
78 int f_flags;
79 int f_spare[4];
1da177e4
LT
80};
81
1da177e4
LT
82#define COMPAT_RLIM_INFINITY 0xffffffff
83
1da177e4 84#define COMPAT_OFF_T_MAX 0x7fffffff
29e646df 85
1da177e4
LT
86/*
87 * ipc64_perm is actually 32/64bit clean but since the compat layer refers to
88 * it we may as well define it.
89 */
90struct compat_ipc64_perm {
91 compat_key_t key;
202e5979
SR
92 __compat_uid_t uid;
93 __compat_gid_t gid;
94 __compat_uid_t cuid;
95 __compat_gid_t cgid;
1da177e4
LT
96 compat_mode_t mode;
97 unsigned int seq;
98 unsigned int __pad2;
99 unsigned long __unused1; /* yes they really are 64bit pads */
100 unsigned long __unused2;
101};
102
103struct compat_semid64_ds {
104 struct compat_ipc64_perm sem_perm;
d0b67de9
AB
105 unsigned int sem_otime_high;
106 unsigned int sem_otime;
107 unsigned int sem_ctime_high;
108 unsigned int sem_ctime;
1da177e4
LT
109 compat_ulong_t sem_nsems;
110 compat_ulong_t __unused3;
111 compat_ulong_t __unused4;
112};
113
114struct compat_msqid64_ds {
115 struct compat_ipc64_perm msg_perm;
d0b67de9
AB
116 unsigned int msg_stime_high;
117 unsigned int msg_stime;
118 unsigned int msg_rtime_high;
119 unsigned int msg_rtime;
120 unsigned int msg_ctime_high;
121 unsigned int msg_ctime;
1da177e4
LT
122 compat_ulong_t msg_cbytes;
123 compat_ulong_t msg_qnum;
124 compat_ulong_t msg_qbytes;
125 compat_pid_t msg_lspid;
126 compat_pid_t msg_lrpid;
127 compat_ulong_t __unused4;
128 compat_ulong_t __unused5;
129};
130
131struct compat_shmid64_ds {
132 struct compat_ipc64_perm shm_perm;
d0b67de9
AB
133 unsigned int shm_atime_high;
134 unsigned int shm_atime;
135 unsigned int shm_dtime_high;
136 unsigned int shm_dtime;
137 unsigned int shm_ctime_high;
138 unsigned int shm_ctime;
1da177e4
LT
139 unsigned int __unused4;
140 compat_size_t shm_segsz;
141 compat_pid_t shm_cpid;
142 compat_pid_t shm_lpid;
143 compat_ulong_t shm_nattch;
144 compat_ulong_t __unused5;
145 compat_ulong_t __unused6;
146};
147
5b101740
RM
148static inline int is_compat_task(void)
149{
cab175f9 150 return is_32bit_task();
5b101740
RM
151}
152
88ced031 153#endif /* __KERNEL__ */
8882a4da 154#endif /* _ASM_POWERPC_COMPAT_H */