Fold it into the two callers.
Unified · Split
| @@ -419,17 +419,6 @@ static ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, lo · 418 unmodified lines | |||
| 419 | return ret; | 419 | return ret; |
| 420 | } | 420 | } |
| 421 | 421 | ||
| 422 | ssize_t __vfs_read(struct file *file, char __user *buf, size_t count, | ||
| 423 | loff_t *pos) | ||
| 424 | { | ||
| 425 | if (file->f_op->read) | ||
| 426 | return file->f_op->read(file, buf, count, pos); | ||
| 427 | else if (file->f_op->read_iter) | ||
| 428 | return new_sync_read(file, buf, count, pos); | ||
| 429 | else | ||
| 430 | return -EINVAL; | ||
| 431 | } | ||
| 432 | |||
| 433 | ssize_t __kernel_read(struct file *file, void *buf, size_t count, loff_t *pos) | 422 | ssize_t __kernel_read(struct file *file, void *buf, size_t count, loff_t *pos) |
| 434 | { | 423 | { |
| 435 | mm_segment_t old_fs = get_fs(); | 424 | mm_segment_t old_fs = get_fs(); |
| @@ -443,7 +432,12 @@ ssize_t __kernel_read(struct file *file, void *buf, size_t count, loff_t *pos) · 7 unmodified lines | |||
| 443 | if (count > MAX_RW_COUNT) | 432 | if (count > MAX_RW_COUNT) |
| 444 | count = MAX_RW_COUNT; | 433 | count = MAX_RW_COUNT; |
| 445 | set_fs(KERNEL_DS); | 434 | set_fs(KERNEL_DS); |
| 446 | ret = __vfs_read(file, (void __user *)buf, count, pos); | 435 | if (file->f_op->read) |
| 436 | ret = file->f_op->read(file, (void __user *)buf, count, pos); | ||
| 437 | else if (file->f_op->read_iter) | ||
| 438 | ret = new_sync_read(file, (void __user *)buf, count, pos); | ||
| 439 | else | ||
| 440 | ret = -EINVAL; | ||
| 447 | set_fs(old_fs); | 441 | set_fs(old_fs); |
| 448 | if (ret > 0) { | 442 | if (ret > 0) { |
| 449 | fsnotify_access(file); | 443 | fsnotify_access(file); |
| @@ -476,17 +470,22 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos) · 26 unmodified lines | |||
| 476 | return -EFAULT; | 470 | return -EFAULT; |
| 477 | 471 | ||
| 478 | ret = rw_verify_area(READ, file, pos, count); | 472 | ret = rw_verify_area(READ, file, pos, count); |
| 479 | if (!ret) { | 473 | if (ret) |
| 480 | if (count > MAX_RW_COUNT) | 474 | return ret; |
| 481 | count = MAX_RW_COUNT; | 475 | if (count > MAX_RW_COUNT) |
| 482 | ret = __vfs_read(file, buf, count, pos); | 476 | count = MAX_RW_COUNT; |
| 483 | if (ret > 0) { | ||
| 484 | fsnotify_access(file); | ||
| 485 | add_rchar(current, ret); | ||
| 486 | } | ||
| 487 | inc_syscr(current); | ||
| 488 | } | ||
| 489 | 477 | ||
| 478 | if (file->f_op->read) | ||
| 479 | ret = file->f_op->read(file, buf, count, pos); | ||
| 480 | else if (file->f_op->read_iter) | ||
| 481 | ret = new_sync_read(file, buf, count, pos); | ||
| 482 | else | ||
| 483 | ret = -EINVAL; | ||
| 484 | if (ret > 0) { | ||
| 485 | fsnotify_access(file); | ||
| 486 | add_rchar(current, ret); | ||
| 487 | } | ||
| 488 | inc_syscr(current); | ||
| 490 | return ret; | 489 | return ret; |
| 491 | } | 490 | } |
| 492 | 491 | ||
| @@ -1917,7 +1917,6 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, · 1916 unmodified lines | |||
| 1917 | struct iovec *fast_pointer, | 1917 | struct iovec *fast_pointer, |
| 1918 | struct iovec **ret_pointer); | 1918 | struct iovec **ret_pointer); |
| 1919 | 1919 | ||
| 1920 | extern ssize_t __vfs_read(struct file *, char __user *, size_t, loff_t *); | ||
| 1921 | extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); | 1920 | extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); |
| 1922 | extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *); | 1921 | extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *); |
| 1923 | extern ssize_t vfs_readv(struct file *, const struct iovec __user *, | 1922 | extern ssize_t vfs_readv(struct file *, const struct iovec __user *, |