Skip to content

Commit ac452ac

Browse files
Christoph HellwigAl Viro
authored andcommitted
fs: move kernel_write to fs/read_write.c
Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 317d5a5 commit ac452ac

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

fs/read_write.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,24 @@ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t
496496
inc_syscw(current);
497497
return ret;
498498
}
499-
500499
EXPORT_SYMBOL(__kernel_write);
501500

501+
ssize_t kernel_write(struct file *file, const char *buf, size_t count,
502+
loff_t pos)
503+
{
504+
mm_segment_t old_fs;
505+
ssize_t res;
506+
507+
old_fs = get_fs();
508+
set_fs(get_ds());
509+
/* The cast to a user pointer is valid due to the set_fs() */
510+
res = vfs_write(file, (__force const char __user *)buf, count, &pos);
511+
set_fs(old_fs);
512+
513+
return res;
514+
}
515+
EXPORT_SYMBOL(kernel_write);
516+
502517
ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_t *pos)
503518
{
504519
ssize_t ret;

fs/splice.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -364,22 +364,6 @@ static ssize_t kernel_readv(struct file *file, const struct kvec *vec,
364364
return res;
365365
}
366366

367-
ssize_t kernel_write(struct file *file, const char *buf, size_t count,
368-
loff_t pos)
369-
{
370-
mm_segment_t old_fs;
371-
ssize_t res;
372-
373-
old_fs = get_fs();
374-
set_fs(get_ds());
375-
/* The cast to a user pointer is valid due to the set_fs() */
376-
res = vfs_write(file, (__force const char __user *)buf, count, &pos);
377-
set_fs(old_fs);
378-
379-
return res;
380-
}
381-
EXPORT_SYMBOL(kernel_write);
382-
383367
static ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
384368
struct pipe_inode_info *pipe, size_t len,
385369
unsigned int flags)

0 commit comments

Comments
 (0)