aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-06-22 04:39:14 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-14 08:33:35 -0400
commitd95852777bc8ba6b3ad3397d495c5f9dd8ca8383 (patch)
tree96e9d8b1d33c4f6f7b5ba5be0fa4fd8f77c7a67f /fs/fuse
parent3d8a00d2099ebc6d5a6e95fadaf861709d9919a8 (diff)
make ->atomic_open() return int
Change of calling conventions: old new NULL 1 file 0 ERR_PTR(-ve) -ve Caller *knows* that struct file *; no need to return it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/dir.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 345f78ee5c9d..8a9ca09e87d4 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -369,9 +369,9 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
369 * If the filesystem doesn't support this, then fall back to separate 369 * If the filesystem doesn't support this, then fall back to separate
370 * 'mknod' + 'open' requests. 370 * 'mknod' + 'open' requests.
371 */ 371 */
372static struct file *fuse_create_open(struct inode *dir, struct dentry *entry, 372static int fuse_create_open(struct inode *dir, struct dentry *entry,
373 struct opendata *od, unsigned flags, 373 struct opendata *od, unsigned flags,
374 umode_t mode, int *opened) 374 umode_t mode, int *opened)
375{ 375{
376 int err; 376 int err;
377 struct inode *inode; 377 struct inode *inode;
@@ -452,12 +452,14 @@ static struct file *fuse_create_open(struct inode *dir, struct dentry *entry,
452 fuse_invalidate_attr(dir); 452 fuse_invalidate_attr(dir);
453 file = finish_open(od, entry, generic_file_open, opened); 453 file = finish_open(od, entry, generic_file_open, opened);
454 if (IS_ERR(file)) { 454 if (IS_ERR(file)) {
455 err = PTR_ERR(file);
455 fuse_sync_release(ff, flags); 456 fuse_sync_release(ff, flags);
456 } else { 457 } else {
457 file->private_data = fuse_file_get(ff); 458 file->private_data = fuse_file_get(ff);
458 fuse_finish_open(inode, file); 459 fuse_finish_open(inode, file);
460 err = 0;
459 } 461 }
460 return file; 462 return err;
461 463
462out_free_ff: 464out_free_ff:
463 fuse_file_free(ff); 465 fuse_file_free(ff);
@@ -466,23 +468,22 @@ out_put_request:
466out_put_forget_req: 468out_put_forget_req:
467 kfree(forget); 469 kfree(forget);
468out_err: 470out_err:
469 return ERR_PTR(err); 471 return err;
470} 472}
471 473
472static int fuse_mknod(struct inode *, struct dentry *, umode_t, dev_t); 474static int fuse_mknod(struct inode *, struct dentry *, umode_t, dev_t);
473static struct file *fuse_atomic_open(struct inode *dir, struct dentry *entry, 475static int fuse_atomic_open(struct inode *dir, struct dentry *entry,
474 struct opendata *od, unsigned flags, 476 struct opendata *od, unsigned flags,
475 umode_t mode, int *opened) 477 umode_t mode, int *opened)
476{ 478{
477 int err; 479 int err;
478 struct fuse_conn *fc = get_fuse_conn(dir); 480 struct fuse_conn *fc = get_fuse_conn(dir);
479 struct file *file;
480 struct dentry *res = NULL; 481 struct dentry *res = NULL;
481 482
482 if (d_unhashed(entry)) { 483 if (d_unhashed(entry)) {
483 res = fuse_lookup(dir, entry, NULL); 484 res = fuse_lookup(dir, entry, NULL);
484 if (IS_ERR(res)) 485 if (IS_ERR(res))
485 return ERR_CAST(res); 486 return PTR_ERR(res);
486 487
487 if (res) 488 if (res)
488 entry = res; 489 entry = res;
@@ -497,24 +498,22 @@ static struct file *fuse_atomic_open(struct inode *dir, struct dentry *entry,
497 if (fc->no_create) 498 if (fc->no_create)
498 goto mknod; 499 goto mknod;
499 500
500 file = fuse_create_open(dir, entry, od, flags, mode, opened); 501 err = fuse_create_open(dir, entry, od, flags, mode, opened);
501 if (PTR_ERR(file) == -ENOSYS) { 502 if (err == -ENOSYS) {
502 fc->no_create = 1; 503 fc->no_create = 1;
503 goto mknod; 504 goto mknod;
504 } 505 }
505out_dput: 506out_dput:
506 dput(res); 507 dput(res);
507 return file; 508 return err;
508 509
509mknod: 510mknod:
510 err = fuse_mknod(dir, entry, mode, 0); 511 err = fuse_mknod(dir, entry, mode, 0);
511 if (err) { 512 if (err)
512 file = ERR_PTR(err);
513 goto out_dput; 513 goto out_dput;
514 }
515no_open: 514no_open:
516 finish_no_open(od, res); 515 finish_no_open(od, res);
517 return NULL; 516 return 1;
518} 517}
519 518
520/* 519/*