lkml.org 
[lkml]   [2017]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 04/17] fs: move kernel_read to fs/read_write.c
Date
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/exec.c | 17 -----------------
fs/read_write.c | 16 ++++++++++++++++
2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 62175cbcc801..8adcc5eaa175 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -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)
{
diff --git a/fs/read_write.c b/fs/read_write.c
index 417dbe199505..1ea862bc7efd 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -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;
--
2.11.0
\
 
 \ /
  Last update: 2017-09-01 17:47    [W:0.089 / U:0.236 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site