9p: consolidate read/write functions
Currently there are two separate versions of read and write. One for dealing with user buffers and the other for dealing with kernel buffers. There is a tremendous amount of code duplication in the otherwise identical versions of these functions. This patch adds an additional user buffer parameter to read and write and conditionalizes handling of the buffer on whether the kernel buffer or the user buffer is populated. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
This commit is contained in:
@@ -136,7 +136,7 @@ v9fs_file_read(struct file *filp, char __user * data, size_t count,
|
||||
|
||||
P9_DPRINTK(P9_DEBUG_VFS, "\n");
|
||||
fid = filp->private_data;
|
||||
ret = p9_client_uread(fid, data, *offset, count);
|
||||
ret = p9_client_read(fid, NULL, data, *offset, count);
|
||||
if (ret > 0)
|
||||
*offset += ret;
|
||||
|
||||
@@ -164,7 +164,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
|
||||
(int)count, (int)*offset);
|
||||
|
||||
fid = filp->private_data;
|
||||
ret = p9_client_uwrite(fid, data, *offset, count);
|
||||
ret = p9_client_write(fid, NULL, data, *offset, count);
|
||||
if (ret > 0) {
|
||||
invalidate_inode_pages2_range(inode->i_mapping, *offset,
|
||||
*offset+ret);
|
||||
|
Reference in New Issue
Block a user