diff options
Diffstat (limited to 'fs/compat.c')
| -rw-r--r-- | fs/compat.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/fs/compat.c b/fs/compat.c index 6490d2134ff3..e6d5d70cf3cf 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
| @@ -8,13 +8,14 @@ | |||
| 8 | * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com) | 8 | * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com) |
| 9 | * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) | 9 | * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) |
| 10 | * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs | 10 | * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs |
| 11 | * Copyright (C) 2003 Pavel Machek (pavel@suse.cz) | 11 | * Copyright (C) 2003 Pavel Machek (pavel@ucw.cz) |
| 12 | * | 12 | * |
| 13 | * This program is free software; you can redistribute it and/or modify | 13 | * This program is free software; you can redistribute it and/or modify |
| 14 | * it under the terms of the GNU General Public License version 2 as | 14 | * it under the terms of the GNU General Public License version 2 as |
| 15 | * published by the Free Software Foundation. | 15 | * published by the Free Software Foundation. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <linux/stddef.h> | ||
| 18 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
| 19 | #include <linux/linkage.h> | 20 | #include <linux/linkage.h> |
| 20 | #include <linux/compat.h> | 21 | #include <linux/compat.h> |
| @@ -266,7 +267,7 @@ asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_sta | |||
| 266 | error = user_path(pathname, &path); | 267 | error = user_path(pathname, &path); |
| 267 | if (!error) { | 268 | if (!error) { |
| 268 | struct kstatfs tmp; | 269 | struct kstatfs tmp; |
| 269 | error = vfs_statfs(path.dentry, &tmp); | 270 | error = vfs_statfs(&path, &tmp); |
| 270 | if (!error) | 271 | if (!error) |
| 271 | error = put_compat_statfs(buf, &tmp); | 272 | error = put_compat_statfs(buf, &tmp); |
| 272 | path_put(&path); | 273 | path_put(&path); |
| @@ -284,7 +285,7 @@ asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user | |||
| 284 | file = fget(fd); | 285 | file = fget(fd); |
| 285 | if (!file) | 286 | if (!file) |
| 286 | goto out; | 287 | goto out; |
| 287 | error = vfs_statfs(file->f_path.dentry, &tmp); | 288 | error = vfs_statfs(&file->f_path, &tmp); |
| 288 | if (!error) | 289 | if (!error) |
| 289 | error = put_compat_statfs(buf, &tmp); | 290 | error = put_compat_statfs(buf, &tmp); |
| 290 | fput(file); | 291 | fput(file); |
| @@ -334,7 +335,7 @@ asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t s | |||
| 334 | error = user_path(pathname, &path); | 335 | error = user_path(pathname, &path); |
| 335 | if (!error) { | 336 | if (!error) { |
| 336 | struct kstatfs tmp; | 337 | struct kstatfs tmp; |
| 337 | error = vfs_statfs(path.dentry, &tmp); | 338 | error = vfs_statfs(&path, &tmp); |
| 338 | if (!error) | 339 | if (!error) |
| 339 | error = put_compat_statfs64(buf, &tmp); | 340 | error = put_compat_statfs64(buf, &tmp); |
| 340 | path_put(&path); | 341 | path_put(&path); |
| @@ -355,7 +356,7 @@ asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct c | |||
| 355 | file = fget(fd); | 356 | file = fget(fd); |
| 356 | if (!file) | 357 | if (!file) |
| 357 | goto out; | 358 | goto out; |
| 358 | error = vfs_statfs(file->f_path.dentry, &tmp); | 359 | error = vfs_statfs(&file->f_path, &tmp); |
| 359 | if (!error) | 360 | if (!error) |
| 360 | error = put_compat_statfs64(buf, &tmp); | 361 | error = put_compat_statfs64(buf, &tmp); |
| 361 | fput(file); | 362 | fput(file); |
| @@ -378,7 +379,7 @@ asmlinkage long compat_sys_ustat(unsigned dev, struct compat_ustat __user *u) | |||
| 378 | sb = user_get_super(new_decode_dev(dev)); | 379 | sb = user_get_super(new_decode_dev(dev)); |
| 379 | if (!sb) | 380 | if (!sb) |
| 380 | return -EINVAL; | 381 | return -EINVAL; |
| 381 | err = vfs_statfs(sb->s_root, &sbuf); | 382 | err = statfs_by_dentry(sb->s_root, &sbuf); |
| 382 | drop_super(sb); | 383 | drop_super(sb); |
| 383 | if (err) | 384 | if (err) |
| 384 | return err; | 385 | return err; |
| @@ -891,8 +892,6 @@ asmlinkage long compat_sys_mount(char __user * dev_name, char __user * dir_name, | |||
| 891 | return retval; | 892 | return retval; |
| 892 | } | 893 | } |
| 893 | 894 | ||
| 894 | #define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de))) | ||
| 895 | |||
| 896 | struct compat_old_linux_dirent { | 895 | struct compat_old_linux_dirent { |
| 897 | compat_ulong_t d_ino; | 896 | compat_ulong_t d_ino; |
| 898 | compat_ulong_t d_offset; | 897 | compat_ulong_t d_offset; |
| @@ -981,7 +980,8 @@ static int compat_filldir(void *__buf, const char *name, int namlen, | |||
| 981 | struct compat_linux_dirent __user * dirent; | 980 | struct compat_linux_dirent __user * dirent; |
| 982 | struct compat_getdents_callback *buf = __buf; | 981 | struct compat_getdents_callback *buf = __buf; |
| 983 | compat_ulong_t d_ino; | 982 | compat_ulong_t d_ino; |
| 984 | int reclen = ALIGN(NAME_OFFSET(dirent) + namlen + 2, sizeof(compat_long_t)); | 983 | int reclen = ALIGN(offsetof(struct compat_linux_dirent, d_name) + |
| 984 | namlen + 2, sizeof(compat_long_t)); | ||
| 985 | 985 | ||
| 986 | buf->error = -EINVAL; /* only used if we fail.. */ | 986 | buf->error = -EINVAL; /* only used if we fail.. */ |
| 987 | if (reclen > buf->count) | 987 | if (reclen > buf->count) |
| @@ -1068,8 +1068,8 @@ static int compat_filldir64(void * __buf, const char * name, int namlen, loff_t | |||
| 1068 | { | 1068 | { |
| 1069 | struct linux_dirent64 __user *dirent; | 1069 | struct linux_dirent64 __user *dirent; |
| 1070 | struct compat_getdents_callback64 *buf = __buf; | 1070 | struct compat_getdents_callback64 *buf = __buf; |
| 1071 | int jj = NAME_OFFSET(dirent); | 1071 | int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1, |
| 1072 | int reclen = ALIGN(jj + namlen + 1, sizeof(u64)); | 1072 | sizeof(u64)); |
| 1073 | u64 off; | 1073 | u64 off; |
| 1074 | 1074 | ||
| 1075 | buf->error = -EINVAL; /* only used if we fail.. */ | 1075 | buf->error = -EINVAL; /* only used if we fail.. */ |
| @@ -1193,11 +1193,10 @@ out: | |||
| 1193 | if (iov != iovstack) | 1193 | if (iov != iovstack) |
| 1194 | kfree(iov); | 1194 | kfree(iov); |
| 1195 | if ((ret + (type == READ)) > 0) { | 1195 | if ((ret + (type == READ)) > 0) { |
| 1196 | struct dentry *dentry = file->f_path.dentry; | ||
| 1197 | if (type == READ) | 1196 | if (type == READ) |
| 1198 | fsnotify_access(dentry); | 1197 | fsnotify_access(file); |
| 1199 | else | 1198 | else |
| 1200 | fsnotify_modify(dentry); | 1199 | fsnotify_modify(file); |
| 1201 | } | 1200 | } |
| 1202 | return ret; | 1201 | return ret; |
| 1203 | } | 1202 | } |
