diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-09-04 09:47:41 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2014-09-04 15:37:41 -0400 |
commit | 0b93a92be4cb48f22b78c95dea84089a1e72f860 (patch) | |
tree | fb5dadbd11612851334291dcb8943cf770af66b0 | |
parent | b231509616feb911c2a7a8814d58c0014ef5b17f (diff) |
udf: saner calling conventions for udf_new_inode()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | fs/udf/ialloc.c | 24 | ||||
-rw-r--r-- | fs/udf/namei.c | 44 | ||||
-rw-r--r-- | fs/udf/udfdecl.h | 2 |
3 files changed, 27 insertions, 43 deletions
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 598f33bdcd26..e77db621ec89 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -45,7 +45,7 @@ void udf_free_inode(struct inode *inode) | |||
45 | udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); | 45 | udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); |
46 | } | 46 | } |
47 | 47 | ||
48 | struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | 48 | struct inode *udf_new_inode(struct inode *dir, umode_t mode) |
49 | { | 49 | { |
50 | struct super_block *sb = dir->i_sb; | 50 | struct super_block *sb = dir->i_sb; |
51 | struct udf_sb_info *sbi = UDF_SB(sb); | 51 | struct udf_sb_info *sbi = UDF_SB(sb); |
@@ -55,14 +55,12 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | |||
55 | struct udf_inode_info *iinfo; | 55 | struct udf_inode_info *iinfo; |
56 | struct udf_inode_info *dinfo = UDF_I(dir); | 56 | struct udf_inode_info *dinfo = UDF_I(dir); |
57 | struct logicalVolIntegrityDescImpUse *lvidiu; | 57 | struct logicalVolIntegrityDescImpUse *lvidiu; |
58 | int err; | ||
58 | 59 | ||
59 | inode = new_inode(sb); | 60 | inode = new_inode(sb); |
60 | 61 | ||
61 | if (!inode) { | 62 | if (!inode) |
62 | *err = -ENOMEM; | 63 | return ERR_PTR(-ENOMEM); |
63 | return NULL; | ||
64 | } | ||
65 | *err = -ENOSPC; | ||
66 | 64 | ||
67 | iinfo = UDF_I(inode); | 65 | iinfo = UDF_I(inode); |
68 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { | 66 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { |
@@ -80,16 +78,16 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | |||
80 | } | 78 | } |
81 | if (!iinfo->i_ext.i_data) { | 79 | if (!iinfo->i_ext.i_data) { |
82 | iput(inode); | 80 | iput(inode); |
83 | *err = -ENOMEM; | 81 | return ERR_PTR(-ENOMEM); |
84 | return NULL; | ||
85 | } | 82 | } |
86 | 83 | ||
84 | err = -ENOSPC; | ||
87 | block = udf_new_block(dir->i_sb, NULL, | 85 | block = udf_new_block(dir->i_sb, NULL, |
88 | dinfo->i_location.partitionReferenceNum, | 86 | dinfo->i_location.partitionReferenceNum, |
89 | start, err); | 87 | start, &err); |
90 | if (*err) { | 88 | if (err) { |
91 | iput(inode); | 89 | iput(inode); |
92 | return NULL; | 90 | return ERR_PTR(err); |
93 | } | 91 | } |
94 | 92 | ||
95 | lvidiu = udf_sb_lvidiu(sb); | 93 | lvidiu = udf_sb_lvidiu(sb); |
@@ -127,11 +125,9 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) | |||
127 | if (unlikely(insert_inode_locked(inode) < 0)) { | 125 | if (unlikely(insert_inode_locked(inode) < 0)) { |
128 | make_bad_inode(inode); | 126 | make_bad_inode(inode); |
129 | iput(inode); | 127 | iput(inode); |
130 | *err = -EIO; | 128 | return ERR_PTR(-EIO); |
131 | return NULL; | ||
132 | } | 129 | } |
133 | mark_inode_dirty(inode); | 130 | mark_inode_dirty(inode); |
134 | 131 | ||
135 | *err = 0; | ||
136 | return inode; | 132 | return inode; |
137 | } | 133 | } |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index d106fdd1bef7..c12e260fd6c4 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -582,13 +582,10 @@ static int udf_add_nondir(struct dentry *dentry, struct inode *inode) | |||
582 | static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode, | 582 | static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode, |
583 | bool excl) | 583 | bool excl) |
584 | { | 584 | { |
585 | struct inode *inode; | 585 | struct inode *inode = udf_new_inode(dir, mode); |
586 | int err; | ||
587 | 586 | ||
588 | inode = udf_new_inode(dir, mode, &err); | 587 | if (IS_ERR(inode)) |
589 | if (!inode) { | 588 | return PTR_ERR(inode); |
590 | return err; | ||
591 | } | ||
592 | 589 | ||
593 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | 590 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
594 | inode->i_data.a_ops = &udf_adinicb_aops; | 591 | inode->i_data.a_ops = &udf_adinicb_aops; |
@@ -603,23 +600,18 @@ static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
603 | 600 | ||
604 | static int udf_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | 601 | static int udf_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) |
605 | { | 602 | { |
606 | struct inode *inode; | 603 | struct inode *inode = udf_new_inode(dir, mode); |
607 | struct udf_inode_info *iinfo; | ||
608 | int err; | ||
609 | 604 | ||
610 | inode = udf_new_inode(dir, mode, &err); | 605 | if (IS_ERR(inode)) |
611 | if (!inode) | 606 | return PTR_ERR(inode); |
612 | return err; | ||
613 | 607 | ||
614 | iinfo = UDF_I(inode); | 608 | if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) |
615 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
616 | inode->i_data.a_ops = &udf_adinicb_aops; | 609 | inode->i_data.a_ops = &udf_adinicb_aops; |
617 | else | 610 | else |
618 | inode->i_data.a_ops = &udf_aops; | 611 | inode->i_data.a_ops = &udf_aops; |
619 | inode->i_op = &udf_file_inode_operations; | 612 | inode->i_op = &udf_file_inode_operations; |
620 | inode->i_fop = &udf_file_operations; | 613 | inode->i_fop = &udf_file_operations; |
621 | mark_inode_dirty(inode); | 614 | mark_inode_dirty(inode); |
622 | |||
623 | d_tmpfile(dentry, inode); | 615 | d_tmpfile(dentry, inode); |
624 | unlock_new_inode(inode); | 616 | unlock_new_inode(inode); |
625 | return 0; | 617 | return 0; |
@@ -629,15 +621,13 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, | |||
629 | dev_t rdev) | 621 | dev_t rdev) |
630 | { | 622 | { |
631 | struct inode *inode; | 623 | struct inode *inode; |
632 | int err; | ||
633 | 624 | ||
634 | if (!old_valid_dev(rdev)) | 625 | if (!old_valid_dev(rdev)) |
635 | return -EINVAL; | 626 | return -EINVAL; |
636 | 627 | ||
637 | err = -EIO; | 628 | inode = udf_new_inode(dir, mode); |
638 | inode = udf_new_inode(dir, mode, &err); | 629 | if (IS_ERR(inode)) |
639 | if (!inode) | 630 | return PTR_ERR(inode); |
640 | return err; | ||
641 | 631 | ||
642 | init_special_inode(inode, mode, rdev); | 632 | init_special_inode(inode, mode, rdev); |
643 | return udf_add_nondir(dentry, inode); | 633 | return udf_add_nondir(dentry, inode); |
@@ -652,10 +642,9 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
652 | struct udf_inode_info *dinfo = UDF_I(dir); | 642 | struct udf_inode_info *dinfo = UDF_I(dir); |
653 | struct udf_inode_info *iinfo; | 643 | struct udf_inode_info *iinfo; |
654 | 644 | ||
655 | err = -EIO; | 645 | inode = udf_new_inode(dir, S_IFDIR | mode); |
656 | inode = udf_new_inode(dir, S_IFDIR | mode, &err); | 646 | if (IS_ERR(inode)) |
657 | if (!inode) | 647 | return PTR_ERR(inode); |
658 | goto out; | ||
659 | 648 | ||
660 | iinfo = UDF_I(inode); | 649 | iinfo = UDF_I(inode); |
661 | inode->i_op = &udf_dir_inode_operations; | 650 | inode->i_op = &udf_dir_inode_operations; |
@@ -861,7 +850,7 @@ out: | |||
861 | static int udf_symlink(struct inode *dir, struct dentry *dentry, | 850 | static int udf_symlink(struct inode *dir, struct dentry *dentry, |
862 | const char *symname) | 851 | const char *symname) |
863 | { | 852 | { |
864 | struct inode *inode; | 853 | struct inode *inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO); |
865 | struct pathComponent *pc; | 854 | struct pathComponent *pc; |
866 | const char *compstart; | 855 | const char *compstart; |
867 | struct extent_position epos = {}; | 856 | struct extent_position epos = {}; |
@@ -874,9 +863,8 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, | |||
874 | struct udf_inode_info *iinfo; | 863 | struct udf_inode_info *iinfo; |
875 | struct super_block *sb = dir->i_sb; | 864 | struct super_block *sb = dir->i_sb; |
876 | 865 | ||
877 | inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err); | 866 | if (IS_ERR(inode)) |
878 | if (!inode) | 867 | return PTR_ERR(inode); |
879 | goto out; | ||
880 | 868 | ||
881 | iinfo = UDF_I(inode); | 869 | iinfo = UDF_I(inode); |
882 | down_write(&iinfo->i_data_sem); | 870 | down_write(&iinfo->i_data_sem); |
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index 41a8115c9345..742557be9936 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
@@ -208,7 +208,7 @@ extern int udf_CS0toUTF8(struct ustr *, const struct ustr *); | |||
208 | 208 | ||
209 | /* ialloc.c */ | 209 | /* ialloc.c */ |
210 | extern void udf_free_inode(struct inode *); | 210 | extern void udf_free_inode(struct inode *); |
211 | extern struct inode *udf_new_inode(struct inode *, umode_t, int *); | 211 | extern struct inode *udf_new_inode(struct inode *, umode_t); |
212 | 212 | ||
213 | /* truncate.c */ | 213 | /* truncate.c */ |
214 | extern void udf_truncate_tail_extent(struct inode *); | 214 | extern void udf_truncate_tail_extent(struct inode *); |