aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/file.c
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2006-01-17 01:14:45 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-17 02:15:31 -0500
commit361b1eb55ea84181505c7f0674ca1205da1127ab (patch)
treef0151b501120447eeb67d73e90142c079c7650e4 /fs/fuse/file.c
parent9b9a04693fa2d9e60933154e4c4aca83c219ef0a (diff)
[PATCH] fuse: READ request initialization
Add a separate function for filling in the READ request. This will make it possible to send asynchronous READ requests as well as synchronous ones. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r--fs/fuse/file.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 043d5b36846d..4a0b0f9a2179 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -250,19 +250,16 @@ static int fuse_fsync(struct file *file, struct dentry *de, int datasync)
250 return fuse_fsync_common(file, de, datasync, 0); 250 return fuse_fsync_common(file, de, datasync, 0);
251} 251}
252 252
253size_t fuse_send_read_common(struct fuse_req *req, struct file *file, 253void fuse_read_fill(struct fuse_req *req, struct file *file,
254 struct inode *inode, loff_t pos, size_t count, 254 struct inode *inode, loff_t pos, size_t count, int opcode)
255 int isdir)
256{ 255{
257 struct fuse_conn *fc = get_fuse_conn(inode);
258 struct fuse_file *ff = file->private_data; 256 struct fuse_file *ff = file->private_data;
259 struct fuse_read_in inarg; 257 struct fuse_read_in *inarg = &req->misc.read_in;
260 258
261 memset(&inarg, 0, sizeof(struct fuse_read_in)); 259 inarg->fh = ff->fh;
262 inarg.fh = ff->fh; 260 inarg->offset = pos;
263 inarg.offset = pos; 261 inarg->size = count;
264 inarg.size = count; 262 req->in.h.opcode = opcode;
265 req->in.h.opcode = isdir ? FUSE_READDIR : FUSE_READ;
266 req->in.h.nodeid = get_node_id(inode); 263 req->in.h.nodeid = get_node_id(inode);
267 req->inode = inode; 264 req->inode = inode;
268 req->file = file; 265 req->file = file;
@@ -273,14 +270,15 @@ size_t fuse_send_read_common(struct fuse_req *req, struct file *file,
273 req->out.argvar = 1; 270 req->out.argvar = 1;
274 req->out.numargs = 1; 271 req->out.numargs = 1;
275 req->out.args[0].size = count; 272 req->out.args[0].size = count;
276 request_send(fc, req);
277 return req->out.args[0].size;
278} 273}
279 274
280static size_t fuse_send_read(struct fuse_req *req, struct file *file, 275static size_t fuse_send_read(struct fuse_req *req, struct file *file,
281 struct inode *inode, loff_t pos, size_t count) 276 struct inode *inode, loff_t pos, size_t count)
282{ 277{
283 return fuse_send_read_common(req, file, inode, pos, count, 0); 278 struct fuse_conn *fc = get_fuse_conn(inode);
279 fuse_read_fill(req, file, inode, pos, count, FUSE_READ);
280 request_send(fc, req);
281 return req->out.args[0].size;
284} 282}
285 283
286static int fuse_readpage(struct file *file, struct page *page) 284static int fuse_readpage(struct file *file, struct page *page)