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>
This commit is contained in:
Christoph Hellwig 2017-09-01 17:39:13 +02:00 committed by Al Viro
parent c41fbad015
commit bdd1d2d3d2
17 changed files with 69 additions and 71 deletions

View file

@ -922,8 +922,7 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size,
pos = 0;
while (pos < i_size) {
bytes = kernel_read(file, pos, (char *)(*buf) + pos,
i_size - pos);
bytes = kernel_read(file, *buf + pos, i_size - pos, &pos);
if (bytes < 0) {
ret = bytes;
goto out;
@ -931,7 +930,6 @@ int kernel_read_file(struct file *file, void **buf, loff_t *size,
if (bytes == 0)
break;
pos += bytes;
}
if (pos != i_size) {
@ -1524,6 +1522,7 @@ static void bprm_fill_uid(struct linux_binprm *bprm)
int prepare_binprm(struct linux_binprm *bprm)
{
int retval;
loff_t pos = 0;
bprm_fill_uid(bprm);
@ -1534,7 +1533,7 @@ int prepare_binprm(struct linux_binprm *bprm)
bprm->cred_prepared = 1;
memset(bprm->buf, 0, BINPRM_BUF_SIZE);
return kernel_read(bprm->file, 0, bprm->buf, BINPRM_BUF_SIZE);
return kernel_read(bprm->file, bprm->buf, BINPRM_BUF_SIZE, &pos);
}
EXPORT_SYMBOL(prepare_binprm);