aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-06-10 14:22:04 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-14 08:33:49 -0400
commit96b7e579addd3cdc806c1667bf5b6b126070827c (patch)
treebe156dbcf449d2408627676a63a5be758eca0ea6 /fs/open.c
parente45198a6ac24bd2c4ad4a43b670c2f1a23dd2df3 (diff)
switch do_dentry_open() to returning int
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/fs/open.c b/fs/open.c
index d51c1b71b062..1241c597d317 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -667,10 +667,10 @@ int open_check_o_direct(struct file *f)
667 return 0; 667 return 0;
668} 668}
669 669
670static struct file *do_dentry_open(struct dentry *dentry, struct vfsmount *mnt, 670static int do_dentry_open(struct dentry *dentry, struct vfsmount *mnt,
671 struct file *f, 671 struct file *f,
672 int (*open)(struct inode *, struct file *), 672 int (*open)(struct inode *, struct file *),
673 const struct cred *cred) 673 const struct cred *cred)
674{ 674{
675 static const struct file_operations empty_fops = {}; 675 static const struct file_operations empty_fops = {};
676 struct inode *inode; 676 struct inode *inode;
@@ -699,7 +699,7 @@ static struct file *do_dentry_open(struct dentry *dentry, struct vfsmount *mnt,
699 699
700 if (unlikely(f->f_mode & FMODE_PATH)) { 700 if (unlikely(f->f_mode & FMODE_PATH)) {
701 f->f_op = &empty_fops; 701 f->f_op = &empty_fops;
702 return f; 702 return 0;
703 } 703 }
704 704
705 f->f_op = fops_get(inode->i_fop); 705 f->f_op = fops_get(inode->i_fop);
@@ -726,7 +726,7 @@ static struct file *do_dentry_open(struct dentry *dentry, struct vfsmount *mnt,
726 726
727 file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping); 727 file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping);
728 728
729 return f; 729 return 0;
730 730
731cleanup_all: 731cleanup_all:
732 fops_put(f->f_op); 732 fops_put(f->f_op);
@@ -749,7 +749,7 @@ cleanup_all:
749cleanup_file: 749cleanup_file:
750 dput(dentry); 750 dput(dentry);
751 mntput(mnt); 751 mntput(mnt);
752 return ERR_PTR(error); 752 return error;
753} 753}
754 754
755static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, 755static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
@@ -757,17 +757,19 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
757 int (*open)(struct inode *, struct file *), 757 int (*open)(struct inode *, struct file *),
758 const struct cred *cred) 758 const struct cred *cred)
759{ 759{
760 struct file *res = do_dentry_open(dentry, mnt, f, open, cred); 760 int error;
761 if (!IS_ERR(res)) { 761 error = do_dentry_open(dentry, mnt, f, open, cred);
762 int error = open_check_o_direct(f); 762 if (!error) {
763 error = open_check_o_direct(f);
763 if (error) { 764 if (error) {
764 fput(res); 765 fput(f);
765 res = ERR_PTR(error); 766 f = ERR_PTR(error);
766 } 767 }
767 } else { 768 } else {
768 put_filp(f); 769 put_filp(f);
770 f = ERR_PTR(error);
769 } 771 }
770 return res; 772 return f;
771} 773}
772 774
773/** 775/**
@@ -785,19 +787,17 @@ int finish_open(struct file *file, struct dentry *dentry,
785 int (*open)(struct inode *, struct file *), 787 int (*open)(struct inode *, struct file *),
786 int *opened) 788 int *opened)
787{ 789{
788 struct file *res; 790 int error;
789 BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */ 791 BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */
790 792
791 mntget(file->f_path.mnt); 793 mntget(file->f_path.mnt);
792 dget(dentry); 794 dget(dentry);
793 795
794 res = do_dentry_open(dentry, file->f_path.mnt, file, open, current_cred()); 796 error = do_dentry_open(dentry, file->f_path.mnt, file, open, current_cred());
795 if (!IS_ERR(res)) { 797 if (!error)
796 *opened |= FILE_OPENED; 798 *opened |= FILE_OPENED;
797 return 0;
798 }
799 799
800 return PTR_ERR(res); 800 return error;
801} 801}
802EXPORT_SYMBOL(finish_open); 802EXPORT_SYMBOL(finish_open);
803 803