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