commit 9645810b4317ce19f485d843489fbe662a6fd44b
Author: Erez Zadok <[EMAIL PROTECTED]>
Date: Sat Nov 17 23:32:04 2007 -0500
Unionfs: coding style: take assignments out of "if" conditions
Signed-off-by: Erez Zadok <[EMAIL PROTECTED]>
diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 79bae96..7ab0277 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -706,7 +706,8 @@ int unionfs_file_release(struct inode *inode, struct file
*file)
* This is important for open-but-unlinked files, as well as mmap
* support.
*/
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
fileinfo = UNIONFS_F(file);
@@ -783,7 +784,8 @@ static int unionfs_ioctl_queryfile(struct file *file,
unsigned int cmd,
unionfs_lock_dentry(dentry);
orig_bstart = dbstart(dentry);
orig_bend = dbend(dentry);
- if ((err = unionfs_partial_lookup(dentry)))
+ err = unionfs_partial_lookup(dentry);
+ if (err)
goto out;
bstart = dbstart(dentry);
bend = dbend(dentry);
@@ -831,7 +833,8 @@ long unionfs_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
/* check if asked for local commands */
@@ -869,7 +872,8 @@ int unionfs_flush(struct file *file, fl_owner_t id)
unionfs_read_lock(dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
diff --git a/fs/unionfs/copyup.c b/fs/unionfs/copyup.c
index 0901e23..fe8f90b 100644
--- a/fs/unionfs/copyup.c
+++ b/fs/unionfs/copyup.c
@@ -394,7 +394,8 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry,
int bstart,
sb = dir->i_sb;
- if ((err = is_robranch_super(sb, new_bindex)))
+ err = is_robranch_super(sb, new_bindex);
+ if (err)
goto out;
/* Create the directory structure above this dentry. */
@@ -465,7 +466,8 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry,
int bstart,
#ifdef CONFIG_UNION_FS_XATTR
/* Selinux uses extended attributes for permissions. */
- if ((err = copyup_xattrs(old_lower_dentry, new_lower_dentry)))
+ err = copyup_xattrs(old_lower_dentry, new_lower_dentry);
+ if (err)
goto out_unlink;
#endif /* CONFIG_UNION_FS_XATTR */
@@ -692,7 +694,8 @@ struct dentry *create_parents(struct inode *dir, struct
dentry *dentry,
kmalloc_size = malloc_sizes[0].cs_size;
num_dentry = kmalloc_size / sizeof(struct dentry *);
- if ((err = is_robranch_super(dir->i_sb, bindex))) {
+ err = is_robranch_super(dir->i_sb, bindex);
+ if (err) {
lower_dentry = ERR_PTR(err);
goto out;
}
diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index 53a1f21..5a15acb 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -34,7 +34,8 @@ static int unionfs_readdir(struct file *file, void *dirent,
filldir_t filldir)
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, false))))
+ err = unionfs_file_revalidate(file, false);
+ if (unlikely(err))
goto out;
inode = file->f_dentry->d_inode;
@@ -137,7 +138,8 @@ static loff_t unionfs_dir_llseek(struct file *file, loff_t
offset, int origin)
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, false))))
+ err = unionfs_file_revalidate(file, false);
+ if (unlikely(err))
goto out;
err = generic_file_llseek(file, offset, origin);
diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index 5a703ab..b7a6d7a 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -223,7 +223,8 @@ int check_empty(struct dentry *dentry, struct
unionfs_dir_state **namelist)
BUG_ON(!S_ISDIR(dentry->d_inode->i_mode));
- if ((err = unionfs_partial_lookup(dentry)))
+ err = unionfs_partial_lookup(dentry);
+ if (err)
goto out;
bstart = dbstart(dentry);
diff --git a/fs/unionfs/file.c b/fs/unionfs/file.c
index 923f134..126df5e 100644
--- a/fs/unionfs/file.c
+++ b/fs/unionfs/file.c
@@ -24,7 +24,8 @@ static ssize_t unionfs_read(struct file *file, char __user
*buf,
int err;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, false))))
+ err = unionfs_file_revalidate(file, false);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
@@ -47,7 +48,8 @@ static ssize_t unionfs_aio_read(struct kiocb *iocb, const
struct iovec *iov,
struct file *file = iocb->ki_filp;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, false))))
+ err = unionfs_file_revalidate(file, false);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
@@ -72,7 +74,8 @@ static ssize_t unionfs_write(struct file *file, const char
__user *buf,
int err = 0;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
@@ -104,7 +107,8 @@ static int unionfs_mmap(struct file *file, struct
vm_area_struct *vma)
/* This might be deferred to mmap's writepage */
willwrite = ((vma->vm_flags | VM_SHARED | VM_WRITE) == vma->vm_flags);
- if (unlikely((err = unionfs_file_revalidate(file, willwrite))))
+ err = unionfs_file_revalidate(file, willwrite);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
@@ -150,7 +154,8 @@ int unionfs_fsync(struct file *file, struct dentry *dentry,
int datasync)
int err = -EINVAL;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
@@ -197,7 +202,8 @@ int unionfs_fasync(int fd, struct file *file, int flag)
int err = 0;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
diff --git a/fs/unionfs/inode.c b/fs/unionfs/inode.c
index 50ca92d..cfa5df0 100644
--- a/fs/unionfs/inode.c
+++ b/fs/unionfs/inode.c
@@ -256,7 +256,8 @@ static int unionfs_link(struct dentry *old_dentry, struct
inode *dir,
BUG_ON(dbstart(old_dentry) != dbstart(new_dentry));
lower_dir_dentry = lock_parent(lower_new_dentry);
- if (!(err = is_robranch(old_dentry)))
+ err = is_robranch(old_dentry);
+ if (!err)
err = vfs_link(lower_old_dentry, lower_dir_dentry->d_inode,
lower_new_dentry);
unlock_dir(lower_dir_dentry);
diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c
index ec866ec..12a7015 100644
--- a/fs/unionfs/lookup.c
+++ b/fs/unionfs/lookup.c
@@ -67,12 +67,14 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
case INTERPOSE_PARTIAL:
break;
case INTERPOSE_LOOKUP:
- if (unlikely((err = new_dentry_private_data(dentry))))
+ err = new_dentry_private_data(dentry);
+ if (unlikely(err))
goto out;
break;
default:
/* default: can only be INTERPOSE_REVAL/REVAL_NEG */
- if (unlikely((err = realloc_dentry_private_data(dentry))))
+ err = realloc_dentry_private_data(dentry);
+ if (unlikely(err))
goto out;
break;
}
diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index fc69ea1..d6130cd 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -384,7 +384,8 @@ static int parse_dirs_option(struct super_block *sb, struct
unionfs_dentry_info
goto out;
}
- if ((err = check_branch(&nd))) {
+ err = check_branch(&nd);
+ if (err) {
printk(KERN_ERR "unionfs: lower directory "
"'%s' is not a valid branch\n", name);
path_release(&nd);
@@ -738,7 +739,8 @@ static int unionfs_read_super(struct super_block *sb, void
*raw_data,
/* link the upper and lower dentries */
sb->s_root->d_fsdata = NULL;
- if (unlikely((err = new_dentry_private_data(sb->s_root))))
+ err = new_dentry_private_data(sb->s_root);
+ if (unlikely(err))
goto out_freedpd;
/* Set the lower dentries for s_root */
diff --git a/fs/unionfs/mmap.c b/fs/unionfs/mmap.c
index 37ad761..ac1a060 100644
--- a/fs/unionfs/mmap.c
+++ b/fs/unionfs/mmap.c
@@ -211,7 +211,8 @@ static int unionfs_readpage(struct file *file, struct page
*page)
int err;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, false))))
+ err = unionfs_file_revalidate(file, false);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
@@ -275,7 +276,8 @@ static int unionfs_commit_write(struct file *file, struct
page *page,
BUG_ON(file == NULL);
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
diff --git a/fs/unionfs/rdstate.c b/fs/unionfs/rdstate.c
index ffa1a98..378a636 100644
--- a/fs/unionfs/rdstate.c
+++ b/fs/unionfs/rdstate.c
@@ -72,7 +72,8 @@ static int guesstimate_hash_size(struct inode *inode)
return UNIONFS_I(inode)->hashsize;
for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
- if (!(lower_inode = unionfs_lower_inode_idx(inode, bindex)))
+ lower_inode = unionfs_lower_inode_idx(inode, bindex);
+ if (!lower_inode)
continue;
if (lower_inode->i_size == DENTPAGE)
diff --git a/fs/unionfs/super.c b/fs/unionfs/super.c
index dbf8ea5..1e9984b 100644
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -365,7 +365,8 @@ found_insertion_point:
* because this code base doesn't support stacking unionfs: the ODF
* code base supports that correctly.
*/
- if ((err = check_branch(&nd))) {
+ err = check_branch(&nd);
+ if (err) {
printk(KERN_ERR "unionfs: lower directory "
"\"%s\" is not a valid branch\n", optarg);
path_release(&nd);
diff --git a/fs/unionfs/unlink.c b/fs/unionfs/unlink.c
index e4e3e34..91fb34a 100644
--- a/fs/unionfs/unlink.c
+++ b/fs/unionfs/unlink.c
@@ -29,7 +29,8 @@ static int unionfs_do_unlink(struct inode *dir, struct dentry
*dentry)
opaque = odf_get_opaque(dentry->d_parent);
- if ((err = unionfs_partial_lookup(dentry)))
+ err = unionfs_partial_lookup(dentry);
+ if (err)
goto out;
bstart = dbstart(dentry);
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs