xref: /openbmc/linux/arch/powerpc/include/asm/compat.h (revision 2dd6532e)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_COMPAT_H
3 #define _ASM_POWERPC_COMPAT_H
4 #ifdef __KERNEL__
5 /*
6  * Architecture specific compatibility types
7  */
8 #include <linux/types.h>
9 #include <linux/sched.h>
10 
11 #define compat_ipc_pid_t compat_ipc_pid_t
12 typedef u16		compat_ipc_pid_t;
13 
14 #define compat_ipc64_perm compat_ipc64_perm
15 
16 #include <asm-generic/compat.h>
17 
18 #ifdef __BIG_ENDIAN__
19 #define COMPAT_UTS_MACHINE	"ppc\0\0"
20 #else
21 #define COMPAT_UTS_MACHINE	"ppcle\0\0"
22 #endif
23 
24 typedef s16		compat_nlink_t;
25 
26 struct compat_stat {
27 	compat_dev_t	st_dev;
28 	compat_ino_t	st_ino;
29 	compat_mode_t	st_mode;
30 	compat_nlink_t	st_nlink;
31 	__compat_uid32_t	st_uid;
32 	__compat_gid32_t	st_gid;
33 	compat_dev_t	st_rdev;
34 	compat_off_t	st_size;
35 	compat_off_t	st_blksize;
36 	compat_off_t	st_blocks;
37 	old_time32_t	st_atime;
38 	u32		st_atime_nsec;
39 	old_time32_t	st_mtime;
40 	u32		st_mtime_nsec;
41 	old_time32_t	st_ctime;
42 	u32		st_ctime_nsec;
43 	u32		__unused4[2];
44 };
45 
46 /*
47  * ipc64_perm is actually 32/64bit clean but since the compat layer refers to
48  * it we may as well define it.
49  */
50 struct compat_ipc64_perm {
51 	compat_key_t key;
52 	__compat_uid_t uid;
53 	__compat_gid_t gid;
54 	__compat_uid_t cuid;
55 	__compat_gid_t cgid;
56 	compat_mode_t mode;
57 	unsigned int seq;
58 	unsigned int __pad2;
59 	unsigned long __unused1;	/* yes they really are 64bit pads */
60 	unsigned long __unused2;
61 };
62 
63 struct compat_semid64_ds {
64 	struct compat_ipc64_perm sem_perm;
65 	unsigned int sem_otime_high;
66 	unsigned int sem_otime;
67 	unsigned int sem_ctime_high;
68 	unsigned int sem_ctime;
69 	compat_ulong_t sem_nsems;
70 	compat_ulong_t __unused3;
71 	compat_ulong_t __unused4;
72 };
73 
74 struct compat_msqid64_ds {
75 	struct compat_ipc64_perm msg_perm;
76 	unsigned int msg_stime_high;
77 	unsigned int msg_stime;
78 	unsigned int msg_rtime_high;
79 	unsigned int msg_rtime;
80 	unsigned int msg_ctime_high;
81 	unsigned int msg_ctime;
82 	compat_ulong_t msg_cbytes;
83 	compat_ulong_t msg_qnum;
84 	compat_ulong_t msg_qbytes;
85 	compat_pid_t msg_lspid;
86 	compat_pid_t msg_lrpid;
87 	compat_ulong_t __unused4;
88 	compat_ulong_t __unused5;
89 };
90 
91 struct compat_shmid64_ds {
92 	struct compat_ipc64_perm shm_perm;
93 	unsigned int shm_atime_high;
94 	unsigned int shm_atime;
95 	unsigned int shm_dtime_high;
96 	unsigned int shm_dtime;
97 	unsigned int shm_ctime_high;
98 	unsigned int shm_ctime;
99 	unsigned int __unused4;
100 	compat_size_t shm_segsz;
101 	compat_pid_t shm_cpid;
102 	compat_pid_t shm_lpid;
103 	compat_ulong_t shm_nattch;
104 	compat_ulong_t __unused5;
105 	compat_ulong_t __unused6;
106 };
107 
108 static inline int is_compat_task(void)
109 {
110 	return is_32bit_task();
111 }
112 
113 #endif /* __KERNEL__ */
114 #endif /* _ASM_POWERPC_COMPAT_H */
115