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