diff options
author | Christoph Hellwig <hch@lst.de> | 2017-09-01 17:39:13 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-09-04 19:05:15 -0400 |
commit | bdd1d2d3d251c65b74ac4493e08db18971c09240 (patch) | |
tree | 71df247eeb367203c59a26eed8a384398c2d8131 /fs/read_write.c | |
parent | c41fbad015dabb0a40ecca50c3ff5658eb6471ff (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.c | 8 |
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, } EXPORT_SYMBOL(__vfs_read); -int kernel_read(struct file *file, loff_t offset, char *addr, - unsigned long count) +ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos) { mm_segment_t old_fs; - loff_t pos = offset; - int result; + ssize_t 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); + result = vfs_read(file, (void __user *)buf, count, pos); set_fs(old_fs); return result; } |