Skip to content

Commit c41fbad

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

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

fs/exec.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -885,23 +885,6 @@ struct file *open_exec(const char *name)
885885
}
886886
EXPORT_SYMBOL(open_exec);
887887

888-
int kernel_read(struct file *file, loff_t offset,
889-
char *addr, unsigned long count)
890-
{
891-
mm_segment_t old_fs;
892-
loff_t pos = offset;
893-
int result;
894-
895-
old_fs = get_fs();
896-
set_fs(get_ds());
897-
/* The cast to a user pointer is valid due to the set_fs() */
898-
result = vfs_read(file, (void __user *)addr, count, &pos);
899-
set_fs(old_fs);
900-
return result;
901-
}
902-
903-
EXPORT_SYMBOL(kernel_read);
904-
905888
int kernel_read_file(struct file *file, void **buf, loff_t *size,
906889
loff_t max_size, enum kernel_read_file_id id)
907890
{

fs/read_write.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,22 @@ ssize_t __vfs_read(struct file *file, char __user *buf, size_t count,
415415
}
416416
EXPORT_SYMBOL(__vfs_read);
417417

418+
int kernel_read(struct file *file, loff_t offset, char *addr,
419+
unsigned long count)
420+
{
421+
mm_segment_t old_fs;
422+
loff_t pos = offset;
423+
int result;
424+
425+
old_fs = get_fs();
426+
set_fs(get_ds());
427+
/* The cast to a user pointer is valid due to the set_fs() */
428+
result = vfs_read(file, (void __user *)addr, count, &pos);
429+
set_fs(old_fs);
430+
return result;
431+
}
432+
EXPORT_SYMBOL(kernel_read);
433+
418434
ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
419435
{
420436
ssize_t ret;

0 commit comments

Comments
 (0)