Unionfs: coding style: take assignments out of "if" conditions
authorErez Zadok <ezk@cs.sunysb.edu>
Sat, 29 Sep 2007 05:36:57 +0000 (01:36 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Tue, 13 Jan 2009 02:31:18 +0000 (21:31 -0500)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
14 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/rename.c
fs/unionfs/subr.c
fs/unionfs/super.c
fs/unionfs/unlink.c

index f7da68798fb813d36b898ac6331c86e535029c11..6f2970da34b3d06270739ed5972a021dc52a82fd 100644 (file)
@@ -614,7 +614,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);
@@ -707,7 +708,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);
@@ -755,7 +757,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 */
@@ -793,7 +796,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 560919a17ce30b2ef2af5919a629719ad232ff6c..98bed0b75efaf7a54c676a98bfb90a14dedb665e 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 */
 
@@ -679,7 +681,8 @@ struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
 
        verify_locked(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 ed515400816b15d3337e594fabaeb40255f957f5..00647238bf18b014e14779fd539776de317d9bd6 100644 (file)
@@ -97,7 +97,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_path.dentry->d_inode;
@@ -200,7 +201,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;
 
        rdstate = UNIONFS_F(file)->rdstate;
index 8f4a304a66f227fe3f1eea95c59e52f75e109df2..7a28444ab36351ff2181881dcf7a58b54957eb57 100644 (file)
@@ -194,7 +194,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 3b582772cea59cbdd202e3a4c998a5e08f3d31f5..4e59ace59b759dd07283e27e98daf60f5773f1f9 100644 (file)
@@ -51,7 +51,8 @@ static int unionfs_create(struct inode *parent, struct dentry *dentry,
         * bit redundant as we don't allow branch 0 to be read-only at the
         * moment
         */
-       if ((err = is_robranch_super(dentry->d_sb, 0))) {
+       err = is_robranch_super(dentry->d_sb, 0);
+       if (err) {
                err = -EROFS;
                goto out;
        }
@@ -278,7 +279,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);
@@ -401,7 +403,8 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,
                 */
                lower_dir_dentry = lock_parent(whiteout_dentry);
 
-               if (!(err = is_robranch_super(dentry->d_sb, bstart)))
+               err = is_robranch_super(dentry->d_sb, bstart);
+               if (!err)
                        err = vfs_unlink(lower_dir_dentry->d_inode,
                                         whiteout_dentry);
                dput(whiteout_dentry);
@@ -455,7 +458,8 @@ static int unionfs_symlink(struct inode *dir, struct dentry *dentry,
 
                lower_dir_dentry = lock_parent(lower_dentry);
 
-               if (!(err = is_robranch_super(dentry->d_sb, bindex))) {
+               err = is_robranch_super(dentry->d_sb, bindex);
+               if (!err) {
                        mode = S_IALLUGO;
                        err = vfs_symlink(lower_dir_dentry->d_inode,
                                          lower_dentry, symname, mode);
@@ -556,7 +560,8 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode)
                lower_parent_dentry = lock_parent(whiteout_dentry);
 
                /* found a.wh.foo entry, remove it then do vfs_mkdir */
-               if (!(err = is_robranch_super(dentry->d_sb, bstart))) {
+               err = is_robranch_super(dentry->d_sb, bstart);
+               if (!err) {
                        args.unlink.parent = lower_parent_dentry->d_inode;
                        args.unlink.dentry = whiteout_dentry;
                        run_sioq(__unionfs_unlink, &args);
@@ -708,7 +713,8 @@ static int unionfs_mknod(struct inode *dir, struct dentry *dentry, int mode,
                lower_parent_dentry = lock_parent(whiteout_dentry);
 
                /* found a.wh.foo entry, remove it then do vfs_mkdir */
-               if (!(err = is_robranch_super(dentry->d_sb, bstart)))
+               err = is_robranch_super(dentry->d_sb, bstart);
+               if (!err)
                        err = vfs_unlink(lower_parent_dentry->d_inode,
                                         whiteout_dentry);
                dput(whiteout_dentry);
index a2c046b5b4cd3aa25de7f518cfed70fc07ed3579..a1904c9e46beaafa9285ca2df2fe269b7b27cd5f 100644 (file)
@@ -119,12 +119,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 2fe6aaa2e9258049373914c7f46ba71bc943b626..ffb0da1c4df24cd29228a61ce515c7fdb7baded5 100644 (file)
@@ -364,7 +364,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);
@@ -648,7 +649,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 */
@@ -738,13 +740,17 @@ static int __init init_unionfs_fs(void)
 
        pr_info("Registering unionfs " UNIONFS_VERSION "\n");
 
-       if (unlikely((err = unionfs_init_filldir_cache())))
+       err = unionfs_init_filldir_cache();
+       if (unlikely(err))
                goto out;
-       if (unlikely((err = unionfs_init_inode_cache())))
+       err = unionfs_init_inode_cache();
+       if (unlikely(err))
                goto out;
-       if (unlikely((err = unionfs_init_dentry_cache())))
+       err = unionfs_init_dentry_cache();
+       if (unlikely(err))
                goto out;
-       if (unlikely((err = init_sioq())))
+       err = init_sioq();
+       if (unlikely(err))
                goto out;
        err = register_filesystem(&unionfs_fs_type);
 out:
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 e96b6bc3a1155f8ac68e0d9d82a59f00564c6996..93ea588a4922d0b29ff146dde589fb13aad72d38 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 e6a2a3cbd28508bc49293e3d30b2fcb0013b5321..91d41d4ce8a80c4f991e06cb5c3a642cf7757b4d 100644 (file)
@@ -75,7 +75,8 @@ static int __unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
                }
 
                lower_wh_dir_dentry = lock_parent(lower_wh_dentry);
-               if (!(err = is_robranch_super(old_dentry->d_sb, bindex)))
+               err = is_robranch_super(old_dentry->d_sb, bindex);
+               if (!err)
                        err = vfs_unlink(lower_wh_dir_dentry->d_inode,
                                         lower_wh_dentry);
 
@@ -196,7 +197,8 @@ static int do_unionfs_rename(struct inode *old_dir,
                        continue;
 
                unlink_dir_dentry = lock_parent(unlink_dentry);
-               if (!(err = is_robranch_super(old_dir->i_sb, bindex)))
+               err = is_robranch_super(old_dir->i_sb, bindex);
+               if (!err)
                        err = vfs_unlink(unlink_dir_dentry->d_inode,
                                         unlink_dentry);
 
index ab409ce9a4a9cecfd8cdb2c13b09d4bdfb6cd136..d97086a123a0e99ee21dc85f67193aa1d280141c 100644 (file)
@@ -87,7 +87,8 @@ int create_whiteout(struct dentry *dentry, int start)
                if (unlikely(err < 0))
                        goto out;
                lower_dir_dentry = lock_parent(lower_wh_dentry);
-               if (!(err = is_robranch_super(dentry->d_sb, bindex)))
+               err = is_robranch_super(dentry->d_sb, bindex);
+               if (!err)
                        err = vfs_create(lower_dir_dentry->d_inode,
                                         lower_wh_dentry,
                                         ~current->fs->umask & S_IRWXUGO,
index 45dc66eafd048ac40f26d4becf8d5c34bb6c12f4..0da9181a07e5d504d36c91f919e464880e76139b 100644 (file)
@@ -372,7 +372,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 61a6fe1cf493c10889757a1760075993d68a91c8..a8de6725965162c273f9461826020fe4c3992172 100644 (file)
@@ -26,7 +26,8 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)
        int bindex;
        int err = 0;
 
-       if ((err = unionfs_partial_lookup(dentry)))
+       err = unionfs_partial_lookup(dentry);
+       if (err)
                goto out;
 
        bindex = dbstart(dentry);
@@ -39,7 +40,8 @@ static int unionfs_unlink_whiteout(struct inode *dir, struct dentry *dentry)
 
        /* avoid destroying the lower inode if the file is in use */
        dget(lower_dentry);
-       if (!(err = is_robranch_super(dentry->d_sb, bindex)))
+       err = is_robranch_super(dentry->d_sb, bindex);
+       if (!err)
                err = vfs_unlink(lower_dir_dentry->d_inode, lower_dentry);
        /* if vfs_unlink succeeded, update our inode's times */
        if (!err)
@@ -127,7 +129,8 @@ static int unionfs_rmdir_first(struct inode *dir, struct dentry *dentry,
 
        /* avoid destroying the lower inode if the file is in use */
        dget(lower_dentry);
-       if (!(err = is_robranch(dentry)))
+       err = is_robranch(dentry);
+       if (!err)
                err = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry);
        dput(lower_dentry);