aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/linux32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/linux32.c')
-rw-r--r--arch/mips/kernel/linux32.c101
1 files changed, 0 insertions, 101 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 2fefb14414b..aa2c55e3b55 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -63,41 +63,6 @@
63#define merge_64(r1, r2) ((((r2) & 0xffffffffUL) << 32) + ((r1) & 0xffffffffUL)) 63#define merge_64(r1, r2) ((((r2) & 0xffffffffUL) << 32) + ((r1) & 0xffffffffUL))
64#endif 64#endif
65 65
66/*
67 * Revalidate the inode. This is required for proper NFS attribute caching.
68 */
69
70int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
71{
72 struct compat_stat tmp;
73
74 if (!new_valid_dev(stat->dev) || !new_valid_dev(stat->rdev))
75 return -EOVERFLOW;
76
77 memset(&tmp, 0, sizeof(tmp));
78 tmp.st_dev = new_encode_dev(stat->dev);
79 tmp.st_ino = stat->ino;
80 if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino)
81 return -EOVERFLOW;
82 tmp.st_mode = stat->mode;
83 tmp.st_nlink = stat->nlink;
84 SET_UID(tmp.st_uid, stat->uid);
85 SET_GID(tmp.st_gid, stat->gid);
86 tmp.st_rdev = new_encode_dev(stat->rdev);
87 tmp.st_size = stat->size;
88 tmp.st_atime = stat->atime.tv_sec;
89 tmp.st_mtime = stat->mtime.tv_sec;
90 tmp.st_ctime = stat->ctime.tv_sec;
91#ifdef STAT_HAVE_NSEC
92 tmp.st_atime_nsec = stat->atime.tv_nsec;
93 tmp.st_mtime_nsec = stat->mtime.tv_nsec;
94 tmp.st_ctime_nsec = stat->ctime.tv_nsec;
95#endif
96 tmp.st_blocks = stat->blocks;
97 tmp.st_blksize = stat->blksize;
98 return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
99}
100
101asmlinkage unsigned long 66asmlinkage unsigned long
102sys32_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 67sys32_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
103 unsigned long flags, unsigned long fd, unsigned long pgoff) 68 unsigned long flags, unsigned long fd, unsigned long pgoff)
@@ -168,72 +133,6 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long __dummy,
168 return sys_ftruncate(fd, merge_64(a2, a3)); 133 return sys_ftruncate(fd, merge_64(a2, a3));
169} 134}
170 135
171static inline long
172get_tv32(struct timeval *o, struct compat_timeval __user *i)
173{
174 return (!access_ok(VERIFY_READ, i, sizeof(*i)) ||
175 (__get_user(o->tv_sec, &i->tv_sec) |
176 __get_user(o->tv_usec, &i->tv_usec)));
177}
178
179static inline long
180put_tv32(struct compat_timeval __user *o, struct timeval *i)
181{
182 return (!access_ok(VERIFY_WRITE, o, sizeof(*o)) ||
183 (__put_user(i->tv_sec, &o->tv_sec) |
184 __put_user(i->tv_usec, &o->tv_usec)));
185}
186
187extern struct timezone sys_tz;
188
189asmlinkage int
190sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
191{
192 if (tv) {
193 struct timeval ktv;
194 do_gettimeofday(&ktv);
195 if (put_tv32(tv, &ktv))
196 return -EFAULT;
197 }
198 if (tz) {
199 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
200 return -EFAULT;
201 }
202 return 0;
203}
204
205static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
206{
207 long usec;
208
209 if (!access_ok(VERIFY_READ, i, sizeof(*i)))
210 return -EFAULT;
211 if (__get_user(o->tv_sec, &i->tv_sec))
212 return -EFAULT;
213 if (__get_user(usec, &i->tv_usec))
214 return -EFAULT;
215 o->tv_nsec = usec * 1000;
216 return 0;
217}
218
219asmlinkage int
220sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
221{
222 struct timespec kts;
223 struct timezone ktz;
224
225 if (tv) {
226 if (get_ts32(&kts, tv))
227 return -EFAULT;
228 }
229 if (tz) {
230 if (copy_from_user(&ktz, tz, sizeof(ktz)))
231 return -EFAULT;
232 }
233
234 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
235}
236
237asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high, 136asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high,
238 unsigned int offset_low, loff_t __user * result, 137 unsigned int offset_low, loff_t __user * result,
239 unsigned int origin) 138 unsigned int origin)