Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1725151

[PATCH 04/17] fs: move kernel_read to fs/read_write.c

From Christoph Hellwig <hch@lst.de>
Newsgroups linux.kernel
Subject [PATCH 04/17] fs: move kernel_read to fs/read_write.c
Date 2017-09-01 17:40 +0200
Message-ID <ukWd4-6Xx-31@gated-at.bofh.it> (permalink)
References <ukWd4-6Xx-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

switch in-kernel read/write calls to kernel_read/write V2 Christoph Hellwig <hch@lst.de> - 2017-09-01 17:40 +0200
  [PATCH 01/17] ashmem: switch to ->read_iter Christoph Hellwig <hch@lst.de> - 2017-09-01 17:40 +0200
  [PATCH 06/17] fs: fix kernel_write prototype Christoph Hellwig <hch@lst.de> - 2017-09-01 17:40 +0200
  [PATCH 04/17] fs: move kernel_read to fs/read_write.c Christoph Hellwig <hch@lst.de> - 2017-09-01 17:40 +0200
  [PATCH 03/17] fs: move kernel_write to fs/read_write.c Christoph Hellwig <hch@lst.de> - 2017-09-01 17:40 +0200
  [PATCH 15/17] fs: unexport __vfs_read/__vfs_write Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 16/17] fs: unexport vfs_read and vfs_write Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 07/17] fs: make the buf argument to __kernel_write a void pointer Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 14/17] lustre: switch to kernel_write Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 02/17] autofs4: switch autofs4_write to __kernel_write Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 10/17] net/9p: switch p9_fd_read to kernel_write Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 09/17] mm/nommu: switch do_mmap_private to kernel_read Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 05/17] fs: fix kernel_read prototype Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 13/17] gadget/f_mass_storage: stop messing with the address limit Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 12/17] mconsole: switch to kernel_read Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 08/17] serial2002: switch serial2002_tty_write to kernel_{read/write} Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 17/17] fs: unexport vfs_readv and vfs_writev Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200
  [PATCH 11/17] btrfs: switch write_buf to kernel_write Christoph Hellwig <hch@lst.de> - 2017-09-01 17:50 +0200

csiph-web