Commit 0b93a92b authored by Al Viro's avatar Al Viro Committed by Jan Kara

udf: saner calling conventions for udf_new_inode()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent b2315096
...@@ -45,7 +45,7 @@ void udf_free_inode(struct inode *inode) ...@@ -45,7 +45,7 @@ void udf_free_inode(struct inode *inode)
udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1); udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1);
} }
struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) struct inode *udf_new_inode(struct inode *dir, umode_t mode)
{ {
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct udf_sb_info *sbi = UDF_SB(sb); 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,14 +55,12 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err)
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
struct udf_inode_info *dinfo = UDF_I(dir); struct udf_inode_info *dinfo = UDF_I(dir);
struct logicalVolIntegrityDescImpUse *lvidiu; struct logicalVolIntegrityDescImpUse *lvidiu;
int err;
inode = new_inode(sb); inode = new_inode(sb);
if (!inode) { if (!inode)
*err = -ENOMEM; return ERR_PTR(-ENOMEM);
return NULL;
}
*err = -ENOSPC;
iinfo = UDF_I(inode); iinfo = UDF_I(inode);
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) { 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,16 +78,16 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err)
} }
if (!iinfo->i_ext.i_data) { if (!iinfo->i_ext.i_data) {
iput(inode); iput(inode);
*err = -ENOMEM; return ERR_PTR(-ENOMEM);
return NULL;
} }
err = -ENOSPC;
block = udf_new_block(dir->i_sb, NULL, block = udf_new_block(dir->i_sb, NULL,
dinfo->i_location.partitionReferenceNum, dinfo->i_location.partitionReferenceNum,
start, err); start, &err);
if (*err) { if (err) {
iput(inode); iput(inode);
return NULL; return ERR_PTR(err);
} }
lvidiu = udf_sb_lvidiu(sb); lvidiu = udf_sb_lvidiu(sb);
...@@ -127,11 +125,9 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err) ...@@ -127,11 +125,9 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode, int *err)
if (unlikely(insert_inode_locked(inode) < 0)) { if (unlikely(insert_inode_locked(inode) < 0)) {
make_bad_inode(inode); make_bad_inode(inode);
iput(inode); iput(inode);
*err = -EIO; return ERR_PTR(-EIO);
return NULL;
} }
mark_inode_dirty(inode); mark_inode_dirty(inode);
*err = 0;
return inode; return inode;
} }
...@@ -582,13 +582,10 @@ static int udf_add_nondir(struct dentry *dentry, struct inode *inode) ...@@ -582,13 +582,10 @@ static int udf_add_nondir(struct dentry *dentry, struct inode *inode)
static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode, static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode,
bool excl) bool excl)
{ {
struct inode *inode; struct inode *inode = udf_new_inode(dir, mode);
int err;
inode = udf_new_inode(dir, mode, &err); if (IS_ERR(inode))
if (!inode) { return PTR_ERR(inode);
return err;
}
if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
inode->i_data.a_ops = &udf_adinicb_aops; 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,23 +600,18 @@ static int udf_create(struct inode *dir, struct dentry *dentry, umode_t mode,
static int udf_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) static int udf_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
{ {
struct inode *inode; struct inode *inode = udf_new_inode(dir, mode);
struct udf_inode_info *iinfo;
int err;
inode = udf_new_inode(dir, mode, &err); if (IS_ERR(inode))
if (!inode) return PTR_ERR(inode);
return err;
iinfo = UDF_I(inode); if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
inode->i_data.a_ops = &udf_adinicb_aops; inode->i_data.a_ops = &udf_adinicb_aops;
else else
inode->i_data.a_ops = &udf_aops; inode->i_data.a_ops = &udf_aops;
inode->i_op = &udf_file_inode_operations; inode->i_op = &udf_file_inode_operations;
inode->i_fop = &udf_file_operations; inode->i_fop = &udf_file_operations;
mark_inode_dirty(inode); mark_inode_dirty(inode);
d_tmpfile(dentry, inode); d_tmpfile(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
return 0; return 0;
...@@ -629,15 +621,13 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, ...@@ -629,15 +621,13 @@ static int udf_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
dev_t rdev) dev_t rdev)
{ {
struct inode *inode; struct inode *inode;
int err;
if (!old_valid_dev(rdev)) if (!old_valid_dev(rdev))
return -EINVAL; return -EINVAL;
err = -EIO; inode = udf_new_inode(dir, mode);
inode = udf_new_inode(dir, mode, &err); if (IS_ERR(inode))
if (!inode) return PTR_ERR(inode);
return err;
init_special_inode(inode, mode, rdev); init_special_inode(inode, mode, rdev);
return udf_add_nondir(dentry, inode); return udf_add_nondir(dentry, inode);
...@@ -652,10 +642,9 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ...@@ -652,10 +642,9 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
struct udf_inode_info *dinfo = UDF_I(dir); struct udf_inode_info *dinfo = UDF_I(dir);
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
err = -EIO; inode = udf_new_inode(dir, S_IFDIR | mode);
inode = udf_new_inode(dir, S_IFDIR | mode, &err); if (IS_ERR(inode))
if (!inode) return PTR_ERR(inode);
goto out;
iinfo = UDF_I(inode); iinfo = UDF_I(inode);
inode->i_op = &udf_dir_inode_operations; inode->i_op = &udf_dir_inode_operations;
...@@ -861,7 +850,7 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry) ...@@ -861,7 +850,7 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
static int udf_symlink(struct inode *dir, struct dentry *dentry, static int udf_symlink(struct inode *dir, struct dentry *dentry,
const char *symname) const char *symname)
{ {
struct inode *inode; struct inode *inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO);
struct pathComponent *pc; struct pathComponent *pc;
const char *compstart; const char *compstart;
struct extent_position epos = {}; struct extent_position epos = {};
...@@ -874,9 +863,8 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, ...@@ -874,9 +863,8 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
struct udf_inode_info *iinfo; struct udf_inode_info *iinfo;
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
inode = udf_new_inode(dir, S_IFLNK | S_IRWXUGO, &err); if (IS_ERR(inode))
if (!inode) return PTR_ERR(inode);
goto out;
iinfo = UDF_I(inode); iinfo = UDF_I(inode);
down_write(&iinfo->i_data_sem); down_write(&iinfo->i_data_sem);
......
...@@ -208,7 +208,7 @@ extern int udf_CS0toUTF8(struct ustr *, const struct ustr *); ...@@ -208,7 +208,7 @@ extern int udf_CS0toUTF8(struct ustr *, const struct ustr *);
/* ialloc.c */ /* ialloc.c */
extern void udf_free_inode(struct inode *); extern void udf_free_inode(struct inode *);
extern struct inode *udf_new_inode(struct inode *, umode_t, int *); extern struct inode *udf_new_inode(struct inode *, umode_t);
/* truncate.c */ /* truncate.c */
extern void udf_truncate_tail_extent(struct inode *); extern void udf_truncate_tail_extent(struct inode *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment