Revert "vfs: Delete the associated dentry when deleting a file"
[linux-2.6-block.git] / arch / x86 / include / asm / compat.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1965aae3
PA
2#ifndef _ASM_X86_COMPAT_H
3#define _ASM_X86_COMPAT_H
1da177e4
LT
4
5/*
6 * Architecture specific compatibility types
7 */
8#include <linux/types.h>
9#include <linux/sched.h>
d375cf15 10#include <linux/sched/task_stack.h>
d1a797f3 11#include <asm/processor.h>
95d1b8f9 12#include <asm/user32.h>
fca460f9 13#include <asm/unistd.h>
1da177e4 14
1a33b18b
AB
15#define compat_mode_t compat_mode_t
16typedef u16 compat_mode_t;
17
84a0c977
GR
18#define __compat_uid_t __compat_uid_t
19typedef u16 __compat_uid_t;
20typedef u16 __compat_gid_t;
21
22#define compat_dev_t compat_dev_t
23typedef u16 compat_dev_t;
24
25#define compat_ipc_pid_t compat_ipc_pid_t
26typedef u16 compat_ipc_pid_t;
27
28#define compat_statfs compat_statfs
29
fb373975
AB
30#include <asm-generic/compat.h>
31
e28cbf22 32#define COMPAT_UTS_MACHINE "i686\0\0"
1da177e4 33
1da177e4 34typedef u16 compat_nlink_t;
1da177e4 35
1da177e4 36struct compat_stat {
932aba1e 37 u32 st_dev;
1da177e4
LT
38 compat_ino_t st_ino;
39 compat_mode_t st_mode;
40 compat_nlink_t st_nlink;
202e5979
SR
41 __compat_uid_t st_uid;
42 __compat_gid_t st_gid;
932aba1e 43 u32 st_rdev;
1da177e4
LT
44 u32 st_size;
45 u32 st_blksize;
46 u32 st_blocks;
47 u32 st_atime;
48 u32 st_atime_nsec;
49 u32 st_mtime;
50 u32 st_mtime_nsec;
51 u32 st_ctime;
52 u32 st_ctime_nsec;
53 u32 __unused4;
54 u32 __unused5;
55};
56
1da177e4 57/*
3ce0f237
CH
58 * IA32 uses 4 byte alignment for 64 bit quantities, so we need to pack the
59 * compat flock64 structure.
1da177e4 60 */
3ce0f237 61#define __ARCH_NEED_COMPAT_FLOCK64_PACKED
1da177e4
LT
62
63struct compat_statfs {
64 int f_type;
65 int f_bsize;
66 int f_blocks;
67 int f_bfree;
68 int f_bavail;
69 int f_files;
70 int f_ffree;
71 compat_fsid_t f_fsid;
72 int f_namelen; /* SunOS ignores this field. */
73 int f_frsize;
1448c721
EB
74 int f_flags;
75 int f_spare[4];
1da177e4
LT
76};
77
7b2dd368 78#ifdef CONFIG_X86_X32_ABI
d1a797f3
PA
79#define COMPAT_USE_64BIT_TIME \
80 (!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT))
d1a797f3 81#endif
95d1b8f9 82
abfb9498 83static inline bool in_x32_syscall(void)
a628b684 84{
fca460f9
PA
85#ifdef CONFIG_X86_X32_ABI
86 if (task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)
87 return true;
88#endif
89 return false;
bf2fcc6f
AK
90}
91
a846446b 92static inline bool in_32bit_syscall(void)
a628b684 93{
abfb9498 94 return in_ia32_syscall() || in_x32_syscall();
a628b684 95}
a846446b
DS
96
97#ifdef CONFIG_COMPAT
98static inline bool in_compat_syscall(void)
99{
100 return in_32bit_syscall();
101}
f970165b 102#define in_compat_syscall in_compat_syscall /* override the generic impl */
527c4125 103#define compat_need_64bit_alignment_fixup in_ia32_syscall
a846446b 104#endif
a628b684 105
ea64d5ac 106struct compat_siginfo;
c3b3f524
CH
107
108#ifdef CONFIG_X86_X32_ABI
109int copy_siginfo_to_user32(struct compat_siginfo __user *to,
110 const kernel_siginfo_t *from);
111#define copy_siginfo_to_user32 copy_siginfo_to_user32
112#endif /* CONFIG_X86_X32_ABI */
ea64d5ac 113
1965aae3 114#endif /* _ASM_X86_COMPAT_H */