Unionfs: coding style: take assignments out of "if" conditions
authorErez Zadok <ezk@cs.sunysb.edu>
Sun, 18 Nov 2007 04:32:04 +0000 (23:32 -0500)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Thu, 1 May 2008 23:03:13 +0000 (19:03 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
12 files changed:
fs/unionfs/commonfops.c
fs/unionfs/copyup.c
fs/unionfs/dirfops.c
fs/unionfs/dirhelper.c
fs/unionfs/file.c
fs/unionfs/inode.c
fs/unionfs/lookup.c
fs/unionfs/main.c
fs/unionfs/mmap.c
fs/unionfs/rdstate.c
fs/unionfs/super.c
fs/unionfs/unlink.c

index 79bae96fa35ded5fb6d47777f6b3a193eaeafac8..7ab027772b71ae39d3495edb253d9d7e8a4e0cc9 100644 (file)
@@ -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);
 
index 0901e237df72d872d7f01e92dd2ea2daa84d7145..fe8f90bebb59ae5e208cf0a56c91172b9740b06e 100644 (file)
@@ -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;
        }
index 53a1f21938e7ba04d3ba6ef5373a2f7b0fff48e0..5a15acb92bb98800dca7225d92e7b5dbf7ea1b6e 100644 (file)
@@ -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);
index 5a703abb0afcd86f967d706e48357382eae24351..b7a6d7a5782c32f4fd9a3f2006bafa196e2d0b0f 100644 (file)
@@ -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);
index 923f1343175a889fe3a2d9a7c80dec4dd3f21442..126df5ef778753de3ae416bbde71f005190b4562 100644 (file)
@@ -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);
 
index 50ca92d057f2582bcac2dce21b14530d4227bd5c..cfa5df0af6bc8e120812809b992ecd3b4881e10d 100644 (file)
@@ -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);
index ec866ecdaf937a994faaef9b66e451b28ae9293b..12a701529a0fd2c34b4d7544260bd2917ed0e531 100644 (file)
@@ -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;
        }
index fc69ea1343ed49630a2224df0a078c1a585756f8..d6130cd45763b1fbb48edf064fd83e74fb4af981 100644 (file)
@@ -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 */
index 37ad76162158974729f3923e9863c498293a756e..ac1a0605c06724888f8c7b3a400ce460dc7243e9 100644 (file)
@@ -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);
 
index ffa1a98d391d931c9db96634f9d5de235042dd13..378a636be40c2e56a8ebe5975353de0d9e188f1a 100644 (file)
@@ -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)
index dbf8ea56f1ff9f8f1a3171dbe2ef6dd4bce1f552..1e9984b97e5b0777e4b6d4c18db7579ee297c218 100644 (file)
@@ -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);
index e4e3e345291874baad708afdcce42b03ebd8001d..91fb34a5291f66527415168c7cfe406947a375bc 100644 (file)
@@ -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);