diff options
Diffstat (limited to 'fs/compat.c')
-rw-r--r-- | fs/compat.c | 56 |
1 files changed, 15 insertions, 41 deletions
diff --git a/fs/compat.c b/fs/compat.c index ce982f6e8c80..13fb08d096c4 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <linux/nfsd/syscall.h> | 44 | #include <linux/nfsd/syscall.h> |
45 | #include <linux/personality.h> | 45 | #include <linux/personality.h> |
46 | #include <linux/rwsem.h> | 46 | #include <linux/rwsem.h> |
47 | #include <linux/acct.h> | 47 | #include <linux/tsacct_kern.h> |
48 | #include <linux/mm.h> | 48 | #include <linux/mm.h> |
49 | 49 | ||
50 | #include <net/sock.h> /* siocdevprivate_ioctl */ | 50 | #include <net/sock.h> /* siocdevprivate_ioctl */ |
@@ -52,11 +52,12 @@ | |||
52 | #include <asm/uaccess.h> | 52 | #include <asm/uaccess.h> |
53 | #include <asm/mmu_context.h> | 53 | #include <asm/mmu_context.h> |
54 | #include <asm/ioctls.h> | 54 | #include <asm/ioctls.h> |
55 | 55 | #include "internal.h" | |
56 | extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); | ||
57 | 56 | ||
58 | int compat_log = 1; | 57 | int compat_log = 1; |
59 | 58 | ||
59 | extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); | ||
60 | |||
60 | int compat_printk(const char *fmt, ...) | 61 | int compat_printk(const char *fmt, ...) |
61 | { | 62 | { |
62 | va_list ap; | 63 | va_list ap; |
@@ -69,6 +70,8 @@ int compat_printk(const char *fmt, ...) | |||
69 | return ret; | 70 | return ret; |
70 | } | 71 | } |
71 | 72 | ||
73 | #include "read_write.h" | ||
74 | |||
72 | /* | 75 | /* |
73 | * Not all architectures have sys_utime, so implement this in terms | 76 | * Not all architectures have sys_utime, so implement this in terms |
74 | * of sys_utimes. | 77 | * of sys_utimes. |
@@ -313,9 +316,6 @@ out: | |||
313 | #define IOCTL_HASHSIZE 256 | 316 | #define IOCTL_HASHSIZE 256 |
314 | static struct ioctl_trans *ioctl32_hash_table[IOCTL_HASHSIZE]; | 317 | static struct ioctl_trans *ioctl32_hash_table[IOCTL_HASHSIZE]; |
315 | 318 | ||
316 | extern struct ioctl_trans ioctl_start[]; | ||
317 | extern int ioctl_table_size; | ||
318 | |||
319 | static inline unsigned long ioctl32_hash(unsigned long cmd) | 319 | static inline unsigned long ioctl32_hash(unsigned long cmd) |
320 | { | 320 | { |
321 | return (((cmd >> 6) ^ (cmd >> 4) ^ cmd)) % IOCTL_HASHSIZE; | 321 | return (((cmd >> 6) ^ (cmd >> 4) ^ cmd)) % IOCTL_HASHSIZE; |
@@ -838,8 +838,6 @@ static int do_nfs4_super_data_conv(void *raw_data) | |||
838 | return 0; | 838 | return 0; |
839 | } | 839 | } |
840 | 840 | ||
841 | extern int copy_mount_options (const void __user *, unsigned long *); | ||
842 | |||
843 | #define SMBFS_NAME "smbfs" | 841 | #define SMBFS_NAME "smbfs" |
844 | #define NCPFS_NAME "ncpfs" | 842 | #define NCPFS_NAME "ncpfs" |
845 | #define NFS4_NAME "nfs4" | 843 | #define NFS4_NAME "nfs4" |
@@ -1153,9 +1151,6 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, | |||
1153 | const struct compat_iovec __user *uvector, | 1151 | const struct compat_iovec __user *uvector, |
1154 | unsigned long nr_segs, loff_t *pos) | 1152 | unsigned long nr_segs, loff_t *pos) |
1155 | { | 1153 | { |
1156 | typedef ssize_t (*io_fn_t)(struct file *, char __user *, size_t, loff_t *); | ||
1157 | typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, loff_t *); | ||
1158 | |||
1159 | compat_ssize_t tot_len; | 1154 | compat_ssize_t tot_len; |
1160 | struct iovec iovstack[UIO_FASTIOV]; | 1155 | struct iovec iovstack[UIO_FASTIOV]; |
1161 | struct iovec *iov=iovstack, *vector; | 1156 | struct iovec *iov=iovstack, *vector; |
@@ -1238,39 +1233,18 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, | |||
1238 | fnv = NULL; | 1233 | fnv = NULL; |
1239 | if (type == READ) { | 1234 | if (type == READ) { |
1240 | fn = file->f_op->read; | 1235 | fn = file->f_op->read; |
1241 | fnv = file->f_op->readv; | 1236 | fnv = file->f_op->aio_read; |
1242 | } else { | 1237 | } else { |
1243 | fn = (io_fn_t)file->f_op->write; | 1238 | fn = (io_fn_t)file->f_op->write; |
1244 | fnv = file->f_op->writev; | 1239 | fnv = file->f_op->aio_write; |
1245 | } | ||
1246 | if (fnv) { | ||
1247 | ret = fnv(file, iov, nr_segs, pos); | ||
1248 | goto out; | ||
1249 | } | 1240 | } |
1250 | 1241 | ||
1251 | /* Do it by hand, with file-ops */ | 1242 | if (fnv) |
1252 | ret = 0; | 1243 | ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, |
1253 | vector = iov; | 1244 | pos, fnv); |
1254 | while (nr_segs > 0) { | 1245 | else |
1255 | void __user * base; | 1246 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); |
1256 | size_t len; | ||
1257 | ssize_t nr; | ||
1258 | |||
1259 | base = vector->iov_base; | ||
1260 | len = vector->iov_len; | ||
1261 | vector++; | ||
1262 | nr_segs--; | ||
1263 | |||
1264 | nr = fn(file, base, len, pos); | ||
1265 | 1247 | ||
1266 | if (nr < 0) { | ||
1267 | if (!ret) ret = nr; | ||
1268 | break; | ||
1269 | } | ||
1270 | ret += nr; | ||
1271 | if (nr != len) | ||
1272 | break; | ||
1273 | } | ||
1274 | out: | 1248 | out: |
1275 | if (iov != iovstack) | 1249 | if (iov != iovstack) |
1276 | kfree(iov); | 1250 | kfree(iov); |
@@ -1298,7 +1272,7 @@ compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec, unsign | |||
1298 | goto out; | 1272 | goto out; |
1299 | 1273 | ||
1300 | ret = -EINVAL; | 1274 | ret = -EINVAL; |
1301 | if (!file->f_op || (!file->f_op->readv && !file->f_op->read)) | 1275 | if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read)) |
1302 | goto out; | 1276 | goto out; |
1303 | 1277 | ||
1304 | ret = compat_do_readv_writev(READ, file, vec, vlen, &file->f_pos); | 1278 | ret = compat_do_readv_writev(READ, file, vec, vlen, &file->f_pos); |
@@ -1321,7 +1295,7 @@ compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec, unsig | |||
1321 | goto out; | 1295 | goto out; |
1322 | 1296 | ||
1323 | ret = -EINVAL; | 1297 | ret = -EINVAL; |
1324 | if (!file->f_op || (!file->f_op->writev && !file->f_op->write)) | 1298 | if (!file->f_op || (!file->f_op->aio_write && !file->f_op->write)) |
1325 | goto out; | 1299 | goto out; |
1326 | 1300 | ||
1327 | ret = compat_do_readv_writev(WRITE, file, vec, vlen, &file->f_pos); | 1301 | ret = compat_do_readv_writev(WRITE, file, vec, vlen, &file->f_pos); |