mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
fs: remove __vfs_write
Fold it into the two callers. Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
@@ -488,17 +488,6 @@ static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t __vfs_write(struct file *file, const char __user *p,
|
|
||||||
size_t count, loff_t *pos)
|
|
||||||
{
|
|
||||||
if (file->f_op->write)
|
|
||||||
return file->f_op->write(file, p, count, pos);
|
|
||||||
else if (file->f_op->write_iter)
|
|
||||||
return new_sync_write(file, p, count, pos);
|
|
||||||
else
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* caller is responsible for file_start_write/file_end_write */
|
/* caller is responsible for file_start_write/file_end_write */
|
||||||
ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos)
|
ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos)
|
||||||
{
|
{
|
||||||
@@ -516,7 +505,12 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t
|
|||||||
p = (__force const char __user *)buf;
|
p = (__force const char __user *)buf;
|
||||||
if (count > MAX_RW_COUNT)
|
if (count > MAX_RW_COUNT)
|
||||||
count = MAX_RW_COUNT;
|
count = MAX_RW_COUNT;
|
||||||
ret = __vfs_write(file, p, count, pos);
|
if (file->f_op->write)
|
||||||
|
ret = file->f_op->write(file, p, count, pos);
|
||||||
|
else if (file->f_op->write_iter)
|
||||||
|
ret = new_sync_write(file, p, count, pos);
|
||||||
|
else
|
||||||
|
ret = -EINVAL;
|
||||||
set_fs(old_fs);
|
set_fs(old_fs);
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
fsnotify_modify(file);
|
fsnotify_modify(file);
|
||||||
@@ -554,19 +548,23 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
|
|||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
ret = rw_verify_area(WRITE, file, pos, count);
|
ret = rw_verify_area(WRITE, file, pos, count);
|
||||||
if (!ret) {
|
if (ret)
|
||||||
if (count > MAX_RW_COUNT)
|
return ret;
|
||||||
count = MAX_RW_COUNT;
|
if (count > MAX_RW_COUNT)
|
||||||
file_start_write(file);
|
count = MAX_RW_COUNT;
|
||||||
ret = __vfs_write(file, buf, count, pos);
|
file_start_write(file);
|
||||||
if (ret > 0) {
|
if (file->f_op->write)
|
||||||
fsnotify_modify(file);
|
ret = file->f_op->write(file, buf, count, pos);
|
||||||
add_wchar(current, ret);
|
else if (file->f_op->write_iter)
|
||||||
}
|
ret = new_sync_write(file, buf, count, pos);
|
||||||
inc_syscw(current);
|
else
|
||||||
file_end_write(file);
|
ret = -EINVAL;
|
||||||
|
if (ret > 0) {
|
||||||
|
fsnotify_modify(file);
|
||||||
|
add_wchar(current, ret);
|
||||||
}
|
}
|
||||||
|
inc_syscw(current);
|
||||||
|
file_end_write(file);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user