fs: fix kernel_write prototype
Make the position an in/out argument like all the other read/write helpers and and make the buf argument a void pointer. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
bdd1d2d3d2
commit
e13ec939e9
|
@ -1395,7 +1395,7 @@ static ssize_t write_file(struct nandsim *ns, struct file *file, void *buf, size
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
noreclaim_flag = memalloc_noreclaim_save();
|
noreclaim_flag = memalloc_noreclaim_save();
|
||||||
tx = kernel_write(file, buf, count, pos);
|
tx = kernel_write(file, buf, count, &pos);
|
||||||
memalloc_noreclaim_restore(noreclaim_flag);
|
memalloc_noreclaim_restore(noreclaim_flag);
|
||||||
put_pages(ns);
|
put_pages(ns);
|
||||||
return tx;
|
return tx;
|
||||||
|
|
|
@ -896,13 +896,14 @@ static int core_alua_write_tpg_metadata(
|
||||||
u32 md_buf_len)
|
u32 md_buf_len)
|
||||||
{
|
{
|
||||||
struct file *file = filp_open(path, O_RDWR | O_CREAT | O_TRUNC, 0600);
|
struct file *file = filp_open(path, O_RDWR | O_CREAT | O_TRUNC, 0600);
|
||||||
|
loff_t pos = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (IS_ERR(file)) {
|
if (IS_ERR(file)) {
|
||||||
pr_err("filp_open(%s) for ALUA metadata failed\n", path);
|
pr_err("filp_open(%s) for ALUA metadata failed\n", path);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
ret = kernel_write(file, md_buf, md_buf_len, 0);
|
ret = kernel_write(file, md_buf, md_buf_len, &pos);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
pr_err("Error writing ALUA metadata file: %s\n", path);
|
pr_err("Error writing ALUA metadata file: %s\n", path);
|
||||||
fput(file);
|
fput(file);
|
||||||
|
|
|
@ -443,7 +443,7 @@ fd_do_prot_fill(struct se_device *se_dev, sector_t lba, sector_t nolb,
|
||||||
|
|
||||||
for (prot = 0; prot < prot_length;) {
|
for (prot = 0; prot < prot_length;) {
|
||||||
sector_t len = min_t(sector_t, bufsize, prot_length - prot);
|
sector_t len = min_t(sector_t, bufsize, prot_length - prot);
|
||||||
ssize_t ret = kernel_write(prot_fd, buf, len, pos + prot);
|
ssize_t ret = kernel_write(prot_fd, buf, len, &pos);
|
||||||
|
|
||||||
if (ret != len) {
|
if (ret != len) {
|
||||||
pr_err("vfs_write to prot file failed: %zd\n", ret);
|
pr_err("vfs_write to prot file failed: %zd\n", ret);
|
||||||
|
|
|
@ -1974,6 +1974,7 @@ static int __core_scsi3_write_aptpl_to_file(
|
||||||
char path[512];
|
char path[512];
|
||||||
u32 pr_aptpl_buf_len;
|
u32 pr_aptpl_buf_len;
|
||||||
int ret;
|
int ret;
|
||||||
|
loff_t pos = 0;
|
||||||
|
|
||||||
memset(path, 0, 512);
|
memset(path, 0, 512);
|
||||||
|
|
||||||
|
@ -1993,7 +1994,7 @@ static int __core_scsi3_write_aptpl_to_file(
|
||||||
|
|
||||||
pr_aptpl_buf_len = (strlen(buf) + 1); /* Add extra for NULL */
|
pr_aptpl_buf_len = (strlen(buf) + 1); /* Add extra for NULL */
|
||||||
|
|
||||||
ret = kernel_write(file, buf, pr_aptpl_buf_len, 0);
|
ret = kernel_write(file, buf, pr_aptpl_buf_len, &pos);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
pr_debug("Error writing APTPL metadata file: %s\n", path);
|
pr_debug("Error writing APTPL metadata file: %s\n", path);
|
||||||
|
|
|
@ -47,7 +47,7 @@ int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data,
|
||||||
lower_file = ecryptfs_inode_to_private(ecryptfs_inode)->lower_file;
|
lower_file = ecryptfs_inode_to_private(ecryptfs_inode)->lower_file;
|
||||||
if (!lower_file)
|
if (!lower_file)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
rc = kernel_write(lower_file, data, size, offset);
|
rc = kernel_write(lower_file, data, size, &offset);
|
||||||
mark_inode_dirty_sync(ecryptfs_inode);
|
mark_inode_dirty_sync(ecryptfs_inode);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -512,8 +512,8 @@ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(__kernel_write);
|
EXPORT_SYMBOL(__kernel_write);
|
||||||
|
|
||||||
ssize_t kernel_write(struct file *file, const char *buf, size_t count,
|
ssize_t kernel_write(struct file *file, const void *buf, size_t count,
|
||||||
loff_t pos)
|
loff_t *pos)
|
||||||
{
|
{
|
||||||
mm_segment_t old_fs;
|
mm_segment_t old_fs;
|
||||||
ssize_t res;
|
ssize_t res;
|
||||||
|
@ -521,7 +521,7 @@ ssize_t kernel_write(struct file *file, const char *buf, size_t count,
|
||||||
old_fs = get_fs();
|
old_fs = get_fs();
|
||||||
set_fs(get_ds());
|
set_fs(get_ds());
|
||||||
/* The cast to a user pointer is valid due to the set_fs() */
|
/* The cast to a user pointer is valid due to the set_fs() */
|
||||||
res = vfs_write(file, (__force const char __user *)buf, count, &pos);
|
res = vfs_write(file, (__force const char __user *)buf, count, pos);
|
||||||
set_fs(old_fs);
|
set_fs(old_fs);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -2779,7 +2779,7 @@ extern int kernel_read_file_from_path(char *, void **, loff_t *, loff_t,
|
||||||
extern int kernel_read_file_from_fd(int, void **, loff_t *, loff_t,
|
extern int kernel_read_file_from_fd(int, void **, loff_t *, loff_t,
|
||||||
enum kernel_read_file_id);
|
enum kernel_read_file_id);
|
||||||
extern ssize_t kernel_read(struct file *, void *, size_t, loff_t *);
|
extern ssize_t kernel_read(struct file *, void *, size_t, loff_t *);
|
||||||
extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t);
|
extern ssize_t kernel_write(struct file *, const void *, size_t, loff_t *);
|
||||||
extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *);
|
extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *);
|
||||||
extern struct file * open_exec(const char *);
|
extern struct file * open_exec(const char *);
|
||||||
|
|
||||||
|
|
|
@ -1017,6 +1017,7 @@ static ssize_t bin_intvec(struct file *file,
|
||||||
size_t length = newlen / sizeof(*vec);
|
size_t length = newlen / sizeof(*vec);
|
||||||
char *str, *end;
|
char *str, *end;
|
||||||
int i;
|
int i;
|
||||||
|
loff_t pos = 0;
|
||||||
|
|
||||||
str = buffer;
|
str = buffer;
|
||||||
end = str + BUFSZ;
|
end = str + BUFSZ;
|
||||||
|
@ -1030,7 +1031,7 @@ static ssize_t bin_intvec(struct file *file,
|
||||||
str += scnprintf(str, end - str, "%lu\t", value);
|
str += scnprintf(str, end - str, "%lu\t", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = kernel_write(file, buffer, str - buffer, 0);
|
result = kernel_write(file, buffer, str - buffer, &pos);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
goto out_kfree;
|
goto out_kfree;
|
||||||
}
|
}
|
||||||
|
@ -1089,6 +1090,7 @@ static ssize_t bin_ulongvec(struct file *file,
|
||||||
size_t length = newlen / sizeof(*vec);
|
size_t length = newlen / sizeof(*vec);
|
||||||
char *str, *end;
|
char *str, *end;
|
||||||
int i;
|
int i;
|
||||||
|
loff_t pos = 0;
|
||||||
|
|
||||||
str = buffer;
|
str = buffer;
|
||||||
end = str + BUFSZ;
|
end = str + BUFSZ;
|
||||||
|
@ -1102,7 +1104,7 @@ static ssize_t bin_ulongvec(struct file *file,
|
||||||
str += scnprintf(str, end - str, "%lu\t", value);
|
str += scnprintf(str, end - str, "%lu\t", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = kernel_write(file, buffer, str - buffer, 0);
|
result = kernel_write(file, buffer, str - buffer, &pos);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
goto out_kfree;
|
goto out_kfree;
|
||||||
}
|
}
|
||||||
|
@ -1192,6 +1194,7 @@ static ssize_t bin_dn_node_address(struct file *file,
|
||||||
__le16 dnaddr;
|
__le16 dnaddr;
|
||||||
char buf[15];
|
char buf[15];
|
||||||
int len;
|
int len;
|
||||||
|
loff_t pos = 0;
|
||||||
|
|
||||||
result = -EINVAL;
|
result = -EINVAL;
|
||||||
if (newlen != sizeof(dnaddr))
|
if (newlen != sizeof(dnaddr))
|
||||||
|
@ -1205,7 +1208,7 @@ static ssize_t bin_dn_node_address(struct file *file,
|
||||||
le16_to_cpu(dnaddr) >> 10,
|
le16_to_cpu(dnaddr) >> 10,
|
||||||
le16_to_cpu(dnaddr) & 0x3ff);
|
le16_to_cpu(dnaddr) & 0x3ff);
|
||||||
|
|
||||||
result = kernel_write(file, buf, len, 0);
|
result = kernel_write(file, buf, len, &pos);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,7 @@ int big_key_preparse(struct key_preparsed_payload *prep)
|
||||||
* File content is stored encrypted with randomly generated key.
|
* File content is stored encrypted with randomly generated key.
|
||||||
*/
|
*/
|
||||||
size_t enclen = ALIGN(datalen, crypto_skcipher_blocksize(big_key_skcipher));
|
size_t enclen = ALIGN(datalen, crypto_skcipher_blocksize(big_key_skcipher));
|
||||||
|
loff_t pos = 0;
|
||||||
|
|
||||||
/* prepare aligned data to encrypt */
|
/* prepare aligned data to encrypt */
|
||||||
data = kmalloc(enclen, GFP_KERNEL);
|
data = kmalloc(enclen, GFP_KERNEL);
|
||||||
|
@ -179,7 +180,7 @@ int big_key_preparse(struct key_preparsed_payload *prep)
|
||||||
goto err_enckey;
|
goto err_enckey;
|
||||||
}
|
}
|
||||||
|
|
||||||
written = kernel_write(file, data, enclen, 0);
|
written = kernel_write(file, data, enclen, &pos);
|
||||||
if (written != enclen) {
|
if (written != enclen) {
|
||||||
ret = written;
|
ret = written;
|
||||||
if (written >= 0)
|
if (written >= 0)
|
||||||
|
|
Loading…
Reference in New Issue