Skip to content

Commit

Permalink
fs: move kernel_read to fs/read_write.c
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Christoph Hellwig authored and Al Viro committed Sep 4, 2017
1 parent ac452ac commit c41fbad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
17 changes: 0 additions & 17 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,23 +885,6 @@ struct file *open_exec(const char *name)
}
EXPORT_SYMBOL(open_exec);

int kernel_read(struct file *file, loff_t offset,
char *addr, unsigned long count)
{
mm_segment_t old_fs;
loff_t pos = offset;
int result;

old_fs = get_fs();
set_fs(get_ds());
/* The cast to a user pointer is valid due to the set_fs() */
result = vfs_read(file, (void __user *)addr, count, &pos);
set_fs(old_fs);
return result;
}

EXPORT_SYMBOL(kernel_read);

int kernel_read_file(struct file *file, void **buf, loff_t *size,
loff_t max_size, enum kernel_read_file_id id)
{
Expand Down
16 changes: 16 additions & 0 deletions fs/read_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,22 @@ ssize_t __vfs_read(struct file *file, char __user *buf, size_t count,
}
EXPORT_SYMBOL(__vfs_read);

int kernel_read(struct file *file, loff_t offset, char *addr,
unsigned long count)
{
mm_segment_t old_fs;
loff_t pos = offset;
int result;

old_fs = get_fs();
set_fs(get_ds());
/* The cast to a user pointer is valid due to the set_fs() */
result = vfs_read(file, (void __user *)addr, count, &pos);
set_fs(old_fs);
return result;
}
EXPORT_SYMBOL(kernel_read);

ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
{
ssize_t ret;
Expand Down

0 comments on commit c41fbad

Please sign in to comment.