aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/dir.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2009-04-28 10:56:37 -0400
committerMiklos Szeredi <mszeredi@suse.cz>2009-04-28 10:56:37 -0400
commitc7b7143c6342b8751d47b03a025ac5c0ac1ae809 (patch)
tree9bb528e90ba682b96f5a34ff5ee777ab3c260aef /fs/fuse/dir.c
parent2106cb18930312af9325d3418e138569c5b903cc (diff)
fuse: clean up args in fuse_finish_open() and fuse_release_fill()
Move setting ff->fh, ff->nodeid and file->private_data outside fuse_finish_open(). Add ->open_flags member to struct fuse_file. This simplifies the argument passing to fuse_finish_open() and fuse_release_fill(), and paves the way for creating an open helper that doesn't need an inode pointer. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r--fs/fuse/dir.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 222584b34ce4..da87a3d8a8ea 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -365,9 +365,9 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
365 * Synchronous release for the case when something goes wrong in CREATE_OPEN 365 * Synchronous release for the case when something goes wrong in CREATE_OPEN
366 */ 366 */
367static void fuse_sync_release(struct fuse_conn *fc, struct fuse_file *ff, 367static void fuse_sync_release(struct fuse_conn *fc, struct fuse_file *ff,
368 u64 nodeid, int flags) 368 int flags)
369{ 369{
370 fuse_release_fill(ff, nodeid, flags, FUSE_RELEASE); 370 fuse_release_fill(ff, flags, FUSE_RELEASE);
371 ff->reserved_req->force = 1; 371 ff->reserved_req->force = 1;
372 fuse_request_send(fc, ff->reserved_req); 372 fuse_request_send(fc, ff->reserved_req);
373 fuse_put_request(fc, ff->reserved_req); 373 fuse_put_request(fc, ff->reserved_req);
@@ -445,12 +445,14 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
445 goto out_free_ff; 445 goto out_free_ff;
446 446
447 fuse_put_request(fc, req); 447 fuse_put_request(fc, req);
448 ff->fh = outopen.fh;
449 ff->nodeid = outentry.nodeid;
450 ff->open_flags = outopen.open_flags;
448 inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation, 451 inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation,
449 &outentry.attr, entry_attr_timeout(&outentry), 0); 452 &outentry.attr, entry_attr_timeout(&outentry), 0);
450 if (!inode) { 453 if (!inode) {
451 flags &= ~(O_CREAT | O_EXCL | O_TRUNC); 454 flags &= ~(O_CREAT | O_EXCL | O_TRUNC);
452 ff->fh = outopen.fh; 455 fuse_sync_release(fc, ff, flags);
453 fuse_sync_release(fc, ff, outentry.nodeid, flags);
454 fuse_send_forget(fc, forget_req, outentry.nodeid, 1); 456 fuse_send_forget(fc, forget_req, outentry.nodeid, 1);
455 return -ENOMEM; 457 return -ENOMEM;
456 } 458 }
@@ -460,11 +462,11 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
460 fuse_invalidate_attr(dir); 462 fuse_invalidate_attr(dir);
461 file = lookup_instantiate_filp(nd, entry, generic_file_open); 463 file = lookup_instantiate_filp(nd, entry, generic_file_open);
462 if (IS_ERR(file)) { 464 if (IS_ERR(file)) {
463 ff->fh = outopen.fh; 465 fuse_sync_release(fc, ff, flags);
464 fuse_sync_release(fc, ff, outentry.nodeid, flags);
465 return PTR_ERR(file); 466 return PTR_ERR(file);
466 } 467 }
467 fuse_finish_open(inode, file, ff, &outopen); 468 file->private_data = fuse_file_get(ff);
469 fuse_finish_open(inode, file);
468 return 0; 470 return 0;
469 471
470 out_free_ff: 472 out_free_ff: