summaryrefslogtreecommitdiffstats
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-09-01 11:39:13 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-09-04 19:05:15 -0400
commitbdd1d2d3d251c65b74ac4493e08db18971c09240 (patch)
tree71df247eeb367203c59a26eed8a384398c2d8131 /fs/read_write.c
parentc41fbad015dabb0a40ecca50c3ff5658eb6471ff (diff)
fs: fix kernel_read prototype
Use proper ssize_t and size_t types for the return value and count argument, move the offset last and make it an in/out argument like all other read/write helpers, and make the buf argument a void pointer to get rid of lots of casts in the callers. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r--fs/read_write.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 1ea862bc7efd..9cf1de855b7a 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -415,17 +415,15 @@ ssize_t __vfs_read(struct file *file, char __user *buf, size_t count,
415} 415}
416EXPORT_SYMBOL(__vfs_read); 416EXPORT_SYMBOL(__vfs_read);
417 417
418int kernel_read(struct file *file, loff_t offset, char *addr, 418ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
419 unsigned long count)
420{ 419{
421 mm_segment_t old_fs; 420 mm_segment_t old_fs;
422 loff_t pos = offset; 421 ssize_t result;
423 int result;
424 422
425 old_fs = get_fs(); 423 old_fs = get_fs();
426 set_fs(get_ds()); 424 set_fs(get_ds());
427 /* The cast to a user pointer is valid due to the set_fs() */ 425 /* The cast to a user pointer is valid due to the set_fs() */
428 result = vfs_read(file, (void __user *)addr, count, &pos); 426 result = vfs_read(file, (void __user *)buf, count, pos);
429 set_fs(old_fs); 427 set_fs(old_fs);
430 return result; 428 return result;
431} 429}