blob: 35d2604fe69cd8dc18dfdb6181292e354d023c90 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_COMPAT_H
2#define _ASM_COMPAT_H
3/*
4 * Architecture specific compatibility types
5 */
6#include <linux/types.h>
7#include <asm/page.h>
8
9#define COMPAT_USER_HZ 100
10
11typedef u32 compat_size_t;
12typedef s32 compat_ssize_t;
13typedef s32 compat_time_t;
14typedef s32 compat_clock_t;
15typedef s32 compat_suseconds_t;
16
17typedef s32 compat_pid_t;
Ralf Baechle4ee13032005-10-29 19:32:40 +010018typedef s32 __compat_uid_t;
19typedef s32 __compat_gid_t;
20typedef __compat_uid_t __compat_uid32_t;
21typedef __compat_gid_t __compat_gid32_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070022typedef u32 compat_mode_t;
23typedef u32 compat_ino_t;
24typedef u32 compat_dev_t;
25typedef s32 compat_off_t;
26typedef s64 compat_loff_t;
27typedef u32 compat_nlink_t;
28typedef s32 compat_ipc_pid_t;
29typedef s32 compat_daddr_t;
30typedef s32 compat_caddr_t;
31typedef struct {
32 s32 val[2];
33} compat_fsid_t;
Stephen Rothwell0d77e5a2005-06-23 00:10:14 -070034typedef s32 compat_timer_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
36typedef s32 compat_int_t;
37typedef s32 compat_long_t;
38typedef u32 compat_uint_t;
39typedef u32 compat_ulong_t;
40
41struct compat_timespec {
42 compat_time_t tv_sec;
43 s32 tv_nsec;
44};
45
46struct compat_timeval {
47 compat_time_t tv_sec;
48 s32 tv_usec;
49};
50
51struct compat_stat {
52 compat_dev_t st_dev;
53 s32 st_pad1[3];
54 compat_ino_t st_ino;
55 compat_mode_t st_mode;
56 compat_nlink_t st_nlink;
Ralf Baechle4ee13032005-10-29 19:32:40 +010057 __compat_uid_t st_uid;
58 __compat_gid_t st_gid;
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 compat_dev_t st_rdev;
60 s32 st_pad2[2];
61 compat_off_t st_size;
62 s32 st_pad3;
63 compat_time_t st_atime;
64 s32 st_atime_nsec;
65 compat_time_t st_mtime;
66 s32 st_mtime_nsec;
67 compat_time_t st_ctime;
68 s32 st_ctime_nsec;
69 s32 st_blksize;
70 s32 st_blocks;
71 s32 st_pad4[14];
72};
73
74struct compat_flock {
75 short l_type;
76 short l_whence;
77 compat_off_t l_start;
78 compat_off_t l_len;
79 s32 l_sysid;
80 compat_pid_t l_pid;
81 short __unused;
82 s32 pad[4];
83};
84
85#define F_GETLK64 33
86#define F_SETLK64 34
87#define F_SETLKW64 35
88
89struct compat_flock64 {
90 short l_type;
91 short l_whence;
92 compat_loff_t l_start;
93 compat_loff_t l_len;
94 compat_pid_t l_pid;
95};
96
97struct compat_statfs {
98 int f_type;
99 int f_bsize;
100 int f_frsize;
101 int f_blocks;
102 int f_bfree;
103 int f_files;
104 int f_ffree;
105 int f_bavail;
106 compat_fsid_t f_fsid;
107 int f_namelen;
108 int f_spare[6];
109};
110
111#define COMPAT_RLIM_INFINITY 0x7fffffffUL
112
113typedef u32 compat_old_sigset_t; /* at least 32 bits */
114
115#define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */
116#define _COMPAT_NSIG_BPW 32
117
118typedef u32 compat_sigset_word;
119
120#define COMPAT_OFF_T_MAX 0x7fffffff
121#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
122
123/*
124 * A pointer passed in from user mode. This should not
125 * be used for syscall parameters, just declare them
126 * as pointers because the syscall entry code will have
127 * appropriately comverted them already.
128 */
129typedef u32 compat_uptr_t;
130
131static inline void *compat_ptr(compat_uptr_t uptr)
132{
133 return (void *)(long)uptr;
134}
135
136static inline void *compat_alloc_user_space(long len)
137{
138 struct pt_regs *regs = (struct pt_regs *)
139 ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
140
141 return (void *) (regs->regs[29] - len);
142}
143#if defined (__MIPSEL__)
144#define __COMPAT_ENDIAN_SWAP__ 1
145#endif
146
147#endif /* _ASM_COMPAT_H */