Unionfs ODF: coding standards
authorErez Zadok <ezk@cs.sunysb.edu>
Mon, 19 Nov 2007 02:48:00 +0000 (21:48 -0500)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Thu, 1 May 2008 23:03:19 +0000 (19:03 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 files changed:
fs/unionfs/commonfops.c
fs/unionfs/config.c
fs/unionfs/config.h
fs/unionfs/copyup.c
fs/unionfs/dirfops.c
fs/unionfs/dirhelper.c
fs/unionfs/export.c
fs/unionfs/inode.c
fs/unionfs/lookup.c
fs/unionfs/main.c
fs/unionfs/odf.c
fs/unionfs/rename.c
fs/unionfs/sioq.c
fs/unionfs/sioq.h
fs/unionfs/super.c
fs/unionfs/union.h
fs/unionfs/unlink.c

index b8fcdca1276c31aff3a8fe8fafefbabd4994447c..bd55ec611f1c2913a6bee72a85bb776706dac37b 100644 (file)
@@ -124,8 +124,8 @@ int unionfs_silly_rename(struct dentry *dentry, struct dentry *lower_dentry)
                counter++;
                sprintf(suffix, "%*.*x", countersize, countersize, counter);
 
-               printk(KERN_DEBUG "unionfs: trying to rename %s to %s\n",
-                      lower_dentry->d_name.name, name);
+               pr_debug("unionfs: trying to rename %s to %s\n",
+                        lower_dentry->d_name.name, name);
 
                tmp_dentry = lookup_one_len(name, lower_dentry->d_parent,
                                            strlen(name));
index ec1c1998c577870d6875f83bdf56e1a9e27e5676..a6f8dfa18091759d7b5405037dfdf362010e0b45 100644 (file)
@@ -58,7 +58,7 @@ static struct unionfs_attributes unionfs_attributes = {
        .thresh_i_low = &unionfs_attr_thresh_i_low,
 };
 
-extern struct unionfs_attributes *get_attributes(void)
+struct unionfs_attributes *get_attributes(void)
 {
        return &unionfs_attributes;
 }
@@ -66,8 +66,14 @@ extern struct unionfs_attributes *get_attributes(void)
 
 #ifndef CONFIG_CONFIGFS_FS
 
-void unionfs_config_exit(void) {};
-int unionfs_config_init(void) {return 0;};
+inline void unionfs_config_exit(void)
+{
+       return;
+}
+inline int unionfs_config_init(void)
+{
+       return 0;
+}
 
 #else  /* configfs specific code starts here */
 
@@ -117,18 +123,18 @@ static ssize_t unionfs_write_num(struct unionfs_config_attr *attr,
                return -EINVAL;
 
        if (tmp > attr->unionfs_attr->max || tmp < attr->unionfs_attr->min) {
-               printk("unionfs: attribute out of range (%d - %d)\n",
+               printk(KERN_ERR "unionfs: attribute out of range (%d - %d)\n",
                       attr->unionfs_attr->min, attr->unionfs_attr->max);
                return -ERANGE;
        }
 
        /* if min/max depends on another val, check if its valid */
-       switch(attr->depend_mode) {
+       switch (attr->depend_mode) {
 
        case DEPEND_MAX:
                if (tmp >= attr->depended->val) {
-                       printk("unionfs: the value must be lower than the "
-                              "value of %s\n", attr->depended->name);
+                       printk(KERN_ERR "unionfs: the value must be lower "
+                              "than the value of %s\n", attr->depended->name);
                        return -ERANGE;
                }
                break;
index 232671a7f76a05e109d2a77234d716770cc23e5f..08a7a5f5d72cd974c5c3386924d0f2e25866da30 100644 (file)
 #define TIMEOUT_MIN 1
 #define TIMEOUT_MAX 1000000
 #define TIMEOUT_DEF 30
-#define TIMEOUT_INFO "defaults to %d seconds.  Controls the interval when " \
-       "the ODF\ncleanup thread will wake up."
+#define TIMEOUT_INFO ("defaults to %d seconds.  Controls the interval when " \
+                     "the ODF\ncleanup thread will wake up.")
 #define THRESH_BH "block_high_thresh"
 #define THRESH_BH_MIN 1
 #define THRESH_BH_MAX 99
 #define THRESH_BH_DEF 80
-#define THRESH_BH_INFO "defaults to %d%%.  The threshold of consumed disk " \
-       "blocks in\n/odf, above which we begin cleaning.  Must be higher " \
-       "than the value of\n" THRESH_BL
+#define THRESH_BH_INFO ("defaults to %d%%.  The threshold of consumed disk " \
+                       "blocks in\n/odf, above which we begin cleaning.  " \
+                       "Must be higher than the value of\n" THRESH_BL)
 #define THRESH_BL "block_low_thresh"
 #define THRESH_BL_MIN 1
 #define THRESH_BL_MAX 99
 #define THRESH_BL_DEF 70
-#define THRESH_BL_INFO "defaults to %d%%.  The threshold of consumed disk " \
-       "blocks in\n/odf, we try to bring the system to after we begin " \
-       "cleaning.  Must be\nlower the value of " THRESH_BH
+#define THRESH_BL_INFO ("defaults to %d%%.  The threshold of consumed disk " \
+                       "blocks in\n/odf, we try to bring the system to " \
+                       "after we begin cleaning.  Must be\nlower the " \
+                       "value of " THRESH_BH)
 #define THRESH_IH "inode_high_thresh"
 #define THRESH_IH_MIN 1
 #define THRESH_IH_MAX 99
 #define THRESH_IH_DEF 80
-#define THRESH_IH_INFO "defaults to %d%%.  The threshold of consumed inodes" \
-       " in /odf,\nabove which we begin cleaning.  Must be higher than the " \
-       "value of " THRESH_IL
+#define THRESH_IH_INFO ("defaults to %d%%.  The threshold of consumed inodes" \
+                       " in /odf,\nabove which we begin cleaning.  Must " \
+                       "be higher than the value of " THRESH_IL)
 #define THRESH_IL "inode_low_thresh"
 #define THRESH_IL_MIN 1
 #define THRESH_IL_MAX 99
 #define THRESH_IL_DEF 70
-#define THRESH_IL_INFO "defaults to %d%%.  The threshold of consumed inodes" \
-       " in /odf,\nwe try to bring the system to after we begin cleaning. " \
-       " Must be lower than\nthe value of " THRESH_IH
+#define THRESH_IL_INFO ("defaults to %d%%.  The threshold of consumed inodes" \
+                       " in /odf,\nwe try to bring the system to after we " \
+                       "begin cleaning. Must be lower than\nthe value of " \
+                       THRESH_IH)
 #define HELP_NAME "help"
 
 struct unionfs_attribute {
index fe8f90bebb59ae5e208cf0a56c91172b9740b06e..2ea88d9d79260639b8cd1fd9791a95698da5d74b 100644 (file)
@@ -460,8 +460,8 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,
                goto out_unlink;
 
        /* Set permissions. */
-       if ((err = copyup_permissions(sb, old_lower_dentry,
-                                     new_lower_dentry)))
+       err = copyup_permissions(sb, old_lower_dentry, new_lower_dentry);
+       if (err)
                goto out_unlink;
 
 #ifdef CONFIG_UNION_FS_XATTR
@@ -475,7 +475,7 @@ int copyup_dentry(struct inode *dir, struct dentry *dentry, int bstart,
        if (!d_deleted(dentry))
                unionfs_reinterpose(dentry);
 
-#if 0
+#ifdef ODF_POSSIBLY_REDUNDANT_CODE
        /* XXX: why was this commented out? */
        err = odf_copyup_link(sb, old_lower_dentry, new_lower_dentry,
                              old_bindex, new_bindex);
index 92f91d2afb7070592291d6ab8e597b7a1f443cca..7d51cbe0c653b540a6ce73b9e2cc17d9db7f07f5 100644 (file)
@@ -43,7 +43,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
        /* Get the odf/ic file */
        /* FIXME: this should be saved somewhere, also check mtime */
        odf_cache = odf_ic_cache_dentry(file->f_path.dentry);
-       if (IS_ERR(odf_cache)){
+       if (IS_ERR(odf_cache)) {
                err = PTR_ERR(odf_cache);
                odf_cache = NULL;
                goto out;
@@ -77,7 +77,7 @@ static int unionfs_readdir(struct file *file, void *dirent, filldir_t filldir)
        odf_file = dentry_open(odf_cache,
                               UNIONFS_SB(file->f_path.dentry->d_sb)->odf.mnt,
                               O_RDONLY);
-       if (IS_ERR(odf_file)){
+       if (IS_ERR(odf_file)) {
                err = PTR_ERR(odf_file);
                mntput(UNIONFS_SB(file->f_path.dentry->d_sb)->odf.mnt);
                dput(odf_cache);
index 5036cec07f311eff7872253bda6431f5d5cd8cba..c3cc9a3e0a4976cc9e1b71692a295fe326970316 100644 (file)
@@ -111,8 +111,7 @@ static int cleanup_util_callback(void *dirent, const char *name, int namelen,
                BUG_ON(d_type != DT_REG);
                err = vfs_unlink(buf->dir->d_inode, dentry);
                dput(dentry);
-       }
-       else if (d_type == DT_DIR) {
+       } else if (d_type == DT_DIR) {
                /* add all dir dentries to the dentry stack */
                dentry = lookup_one_len(name, buf->dir, namelen);
                if (IS_ERR(dentry)) {
@@ -148,7 +147,7 @@ static int readdir_util_callback(void *dirent, const char *name, int namelen,
                buf->filldir_called++;
 
        if (name[0] == '.' &&
-           (namelen == 1 || (name[1] == '.' && namelen == 2))){
+           (namelen == 1 || (name[1] == '.' && namelen == 2))) {
                if (buf->mode != RD_CACHE_ODF)
                        goto out;
                else
@@ -163,7 +162,7 @@ static int readdir_util_callback(void *dirent, const char *name, int namelen,
 
        /* check odf */
        odf_dentry = odf_lookup_name(buf->dir, name, namelen, 0);
-       if (IS_ERR(odf_dentry)){
+       if (IS_ERR(odf_dentry)) {
                if (PTR_ERR(odf_dentry) == -ENOENT) {
                        odf_dentry = NULL;
                        not_in_odf = 1;
@@ -319,7 +318,8 @@ int odf_cache_dir(struct dentry *d_upper, struct dentry *d_odf,
        sb = d_upper->d_sb;
        unionfs_read_lock(sb);
 
-       if ((err = unionfs_partial_lookup(d_upper)))
+       err = unionfs_partial_lookup(d_upper);
+       if (err)
                goto out_sb;
 
 retry:
@@ -332,7 +332,7 @@ retry:
         * after -ENOSPC
         */
        if (i_odf && i_size_read(i_odf) && !cleaned) {
-               if(timespec_compare(&i_odf->i_mtime,mtime) >= 0)
+               if (timespec_compare(&i_odf->i_mtime, mtime) >= 0)
                        goto out;
        }
        dget(d_odf);
@@ -349,7 +349,7 @@ retry:
        odf_file = dentry_open(d_odf,
                               UNIONFS_SB(sb)->odf.mnt,
                               O_TRUNC|O_CREAT|O_WRONLY);
-       if (IS_ERR(odf_file)){
+       if (IS_ERR(odf_file)) {
                err = PTR_ERR(odf_file);
                dput(d_odf);
                mntput(UNIONFS_SB(sb)->odf.mnt);
@@ -694,7 +694,7 @@ cleanup_loop:
                err = 1;
 out:
        BUG_ON(stack.n < 0);
-       while(stack.n)
+       while (stack.n)
                dput(__odf_dstack_pop(&stack));
 
        kfree(buf);
index 0e1db379adb9fa54a5f31052af88158a550c78f2..535039083e1e4799e634fdf163ccae9bf76e2ac3 100644 (file)
@@ -114,8 +114,7 @@ static struct dentry *__get_parent(struct super_block *sb,
                                 * and mntget/put properly. -ezk
                                 */
                        }
-               }
-               else
+               } else
                        strncpy(name, d->d_name.name, d->d_name.len);
 
                dput(d);
@@ -134,7 +133,7 @@ static struct dentry *__get_parent(struct super_block *sb,
 
 out:
        BUG_ON(stack.n < 0);
-       while(stack.n)
+       while (stack.n)
                dput(__odf_dstack_pop(&stack));
        kfree(stack.item);
        kfree(name);
@@ -219,7 +218,7 @@ static int unionfs_get_name(struct dentry *dentry, char *name,
                goto out;
 
        odf_cache = odf_ic_cache_dentry(dentry);
-       if (IS_ERR(odf_cache)){
+       if (IS_ERR(odf_cache)) {
                err = PTR_ERR(odf_cache);
                odf_cache = NULL;
                goto out;
@@ -239,7 +238,7 @@ static int unionfs_get_name(struct dentry *dentry, char *name,
        mntget(UNIONFS_SB(dentry->d_sb)->odf.mnt);
        file = dentry_open(odf_cache, UNIONFS_SB(dentry->d_sb)->odf.mnt,
                           O_RDONLY);
-       if (IS_ERR(file)){
+       if (IS_ERR(file)) {
                err = PTR_ERR(file);
                mntput(UNIONFS_SB(dentry->d_sb)->odf.mnt);
                dput(odf_cache);
index ce293b84b12d7ec1d71325198b8f617640d56fec..e4ca03a784f69327c89208dbc8a2433421aba869 100644 (file)
@@ -389,7 +389,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, bstart))) {
+       err = is_robranch_super(dentry->d_sb, bstart);
+       if (!err) {
                mode = S_IALLUGO;
                err = vfs_symlink(lower_dir_dentry->d_inode,
                                  lower_dentry, symname, mode);
@@ -451,9 +452,9 @@ static int unionfs_mkdir(struct inode *parent, struct dentry *dentry, int mode)
        }
 
        bindex = 0; /* always create at branch 0 */
-       bend = dbend(dentry);
+       bend = dbend(dentry);
 
-       if (is_robranch_super(dentry->d_sb, bindex)){
+       if (is_robranch_super(dentry->d_sb, bindex)) {
                err = -EROFS;
                goto out;
        }
index 12a701529a0fd2c34b4d7544260bd2917ed0e531..2b156d6c94aa145e9c8d335ba547793da3504fea 100644 (file)
@@ -96,7 +96,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
        name = dentry->d_name.name;
        namelen = dentry->d_name.len;
 
-       if (nd == NULL){
+       if (nd == NULL) {
                memset(&new_nd, 0, sizeof(struct nameidata));
                nd = &new_nd;
        }
@@ -106,14 +106,14 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
        bend = dbend(parent_dentry);
 
        /* check if whiteout here */
-       if (dentry && UNIONFS_D(dentry) && UNIONFS_D(dentry->d_parent)){
+       if (dentry && UNIONFS_D(dentry) && UNIONFS_D(dentry->d_parent)) {
                err = odf_lookup(dentry->d_parent, dentry, 0);
                if (err)
                        goto out;
 
                if (UNIONFS_D(dentry)->odf.dentry) {
                        /* return negative dentry if a whiteout */
-                       if (UNIONFS_D(dentry)->odf.whiteout){
+                       if (UNIONFS_D(dentry)->odf.whiteout) {
                                bindex = 0;
                                goto out_negative;
                        }
@@ -286,7 +286,7 @@ out_positive:
        if (lookupmode == INTERPOSE_PARTIAL) {
                err = odf_lookup(parent_dentry, dentry, 0);
                if (UNIONFS_D(dentry)->odf.dentry &&
-                   UNIONFS_D(dentry)->odf.whiteout){
+                   UNIONFS_D(dentry)->odf.whiteout) {
                        err = -ENOENT;
                        goto out_drop;
                }
@@ -313,7 +313,7 @@ out_positive:
        d_interposed = unionfs_interpose(dentry, dentry->d_sb, lookupmode);
        if (IS_ERR(d_interposed))
                err = PTR_ERR(d_interposed);
-       else if(d_interposed)
+       else if (d_interposed)
                dentry = d_interposed;
 
        if (err)
index d6130cd45763b1fbb48edf064fd83e74fb4af981..0686c81b0fc8ae4187f94144059d57df9919c7ae 100644 (file)
@@ -135,13 +135,14 @@ struct dentry *unionfs_interpose(struct dentry *dentry, struct super_block *sb,
                /* get unique inode number for unionfs */
                if (!UNIONFS_D(dentry)->odf.dentry)
                        err = odf_lookup(dentry->d_parent, dentry, odf_flag);
-               if (err){
-                       printk("unionfs_interpose: odf failed to create "
+               if (err) {
+                       printk(KERN_ERR
+                              "unionfs_interpose: odf failed to create "
                               "dentry: %s, %d\n", dentry->d_name.name, err);
                        goto out;
                }
                /* check whiteouts and opaqueness */
-               if (UNIONFS_D(dentry)->odf.whiteout){
+               if (UNIONFS_D(dentry)->odf.whiteout) {
                        err = -ENOENT;
                        goto out;
                }
@@ -693,7 +694,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,
                if (err)
                        goto out_free_odf;
 
-               err = odf_write_sb_data(odf,UNIONFS_SB(sb)->data,
+               err = odf_write_sb_data(odf, UNIONFS_SB(sb)->data,
                                        lower_root_info->lower_paths,
                                        lower_root_info->bend -
                                        lower_root_info->bstart + 1);
index 826b80cf05ab44d07b446282556fca8ceff9a9f1..5a2972aad0536bcd9efb7fb26950e8def4ec502e 100644 (file)
@@ -17,8 +17,8 @@
  * Create a directory in odf
  * Fails if the directory already exists
  */
-static inline struct dentry * __odf_create_dir(struct dentry *parent,
-                                              char *name)
+static inline struct dentry *__odf_create_dir(struct dentry *parent,
+                                             char *name)
 {
        struct dentry *dentry = NULL;
        int err;
@@ -50,28 +50,28 @@ int __odf_create_hierarchy(struct dentry *odf_root)
        int err = 0;
 
        dentry = __odf_create_dir(odf_root, ODF_NS);
-       if (IS_ERR(dentry)){
+       if (IS_ERR(dentry)) {
                err = PTR_ERR(dentry);
                dentry = NULL;
                goto out;
        }
        dput(dentry);
        dentry = __odf_create_dir(odf_root, ODF_IC);
-       if (IS_ERR(dentry)){
+       if (IS_ERR(dentry)) {
                err = PTR_ERR(dentry);
                dentry = NULL;
                goto out;
        }
        dput(dentry);
        dentry = __odf_create_dir(odf_root, ODF_RC);
-       if (IS_ERR(dentry)){
+       if (IS_ERR(dentry)) {
                err = PTR_ERR(dentry);
                dentry = NULL;
                goto out;
        }
        dput(dentry);
        dentry = __odf_create_dir(odf_root, ODF_SR);
-       if (IS_ERR(dentry)){
+       if (IS_ERR(dentry)) {
                err = PTR_ERR(dentry);
                dentry = NULL;
                goto out;
@@ -83,7 +83,7 @@ int __odf_create_hierarchy(struct dentry *odf_root)
                dentry = NULL;
                goto out;
        }
-       if (unlikely(dentry->d_inode)){
+       if (unlikely(dentry->d_inode)) {
                err = -EEXIST;
                goto out;
        }
@@ -153,28 +153,28 @@ int odf_read_super(struct super_block *sb, char *data)
        }
 
        osi->ns = odf_getdir(nd.dentry, ODF_NS, sizeof(ODF_NS) - 1);
-       if (IS_ERR(osi->ns)){
+       if (IS_ERR(osi->ns)) {
                err = PTR_ERR(osi->ns);
                osi->ns = NULL;
                goto out_free;
        }
 
        osi->rc = odf_getdir(nd.dentry, ODF_RC, sizeof(ODF_RC) - 1);
-       if (IS_ERR(osi->rc)){
+       if (IS_ERR(osi->rc)) {
                err = PTR_ERR(osi->rc);
                osi->rc = NULL;
                goto out_free;
        }
 
        osi->ic = odf_getdir(nd.dentry, ODF_IC, sizeof(ODF_IC) - 1);
-       if (IS_ERR(osi->ic)){
+       if (IS_ERR(osi->ic)) {
                err = PTR_ERR(osi->ic);
                osi->ic = NULL;
                goto out_free;
        }
 
        osi->sr = odf_getdir(nd.dentry, ODF_SR, sizeof(ODF_SR) - 1);
-       if (IS_ERR(osi->sr)){
+       if (IS_ERR(osi->sr)) {
                err = PTR_ERR(osi->sr);
                osi->sr = NULL;
                goto out_free;
@@ -201,8 +201,9 @@ int odf_read_super(struct super_block *sb, char *data)
        }
        sioa->cleanup.odf = osi;
        sioa->cleanup.attr = get_attributes();
-       sioa->cleanup.flags = (options & ODF_OPT_KEEPCACHE)?
-               ODF_CLEAN_DEFAULT:ODF_CLEAN_SR|ODF_CLEAN_FULL;
+       sioa->cleanup.flags = ((options & ODF_OPT_KEEPCACHE) ?
+                              ODF_CLEAN_DEFAULT :
+                              ODF_CLEAN_SR|ODF_CLEAN_FULL);
        osi->cleanup = sioa;
        osi->mnt = nd.mnt;
        mntget(osi->mnt);
@@ -281,8 +282,7 @@ struct dentry *odf_getdir(struct dentry *d_odf, const char *name, int len)
        else if (!dentry->d_inode) {
                dput(dentry);
                dentry = ERR_PTR(-EINVAL);
-       }
-       else if (!S_ISDIR(dentry->d_inode->i_mode)) {
+       } else if (!S_ISDIR(dentry->d_inode->i_mode)) {
                dput(dentry);
                dentry = ERR_PTR(-EINVAL);
        }
@@ -342,7 +342,7 @@ int odf_parse_options(const char *options, char **odf_path)
                                err = -EINVAL;
                                goto out_error;
                        }
-                       *odf_path = kzalloc(strlen(optarg) + 1,GFP_KERNEL);
+                       *odf_path = kzalloc(strlen(optarg) + 1, GFP_KERNEL);
                        strcpy(*odf_path, optarg);
                }
 
@@ -391,7 +391,7 @@ int odf_reclaim(struct dentry *dentry, int sr)
        else
                new_dir = UNIONFS_SB(dentry->d_sb)->odf.rc;
        new_name = kzalloc(ODF_INAME_LEN, GFP_KERNEL);
-       if (!new_name){
+       if (!new_name) {
                err = -ENOMEM;
                goto out;
        }
@@ -478,7 +478,7 @@ int odf_rename(struct dentry *old_dentry, struct dentry *new_dentry)
                goto out;
 
        if (UNIONFS_D(old_dentry)->odf.dentry == NULL) {
-               printk("rename attempt %s to %s not in odf\n",
+               printk(KERN_ERR "rename attempt %s to %s not in odf\n",
                       old_dentry->d_name.name,
                       new_dentry->d_name.name);
                goto out;
@@ -596,19 +596,19 @@ struct dentry *__link_add_dirent(struct file *link_file, struct dentry *dentry)
                /* file is new, fill in copyup info with 0's */
                link_file->f_pos = 0;
                le32 = 0;
-               err = link_file->f_op->write(link_file, (char*)&le32,
+               err = link_file->f_op->write(link_file, (char *)&le32,
                                             sizeof(__le32),
                                             &link_file->f_pos);
-               if (err != sizeof(__le32)){
+               if (err != sizeof(__le32)) {
                        err = -EIO;
                        goto out;
                }
 
                le64 = 0;
-               err = link_file->f_op->write(link_file, (char*)&le64,
+               err = link_file->f_op->write(link_file, (char *)&le64,
                                             sizeof(__le64),
                                             &link_file->f_pos);
-               if (err != sizeof(__le64)){
+               if (err != sizeof(__le64)) {
                        err = -EIO;
                        goto out;
                }
@@ -619,10 +619,10 @@ struct dentry *__link_add_dirent(struct file *link_file, struct dentry *dentry)
 
                while (link_file->f_pos < size) {
 
-                       err = link_file->f_op->read(link_file, (char*)&le32,
+                       err = link_file->f_op->read(link_file, (char *)&le32,
                                                    sizeof(__le32),
                                                    &link_file->f_pos);
-                       if (err != sizeof(__le32)){
+                       if (err != sizeof(__le32)) {
                                err = -EIO;
                                goto out;
                        }
@@ -636,15 +636,15 @@ struct dentry *__link_add_dirent(struct file *link_file, struct dentry *dentry)
                        }
                        err = link_file->f_op->read(link_file, name,
                                                    len, &link_file->f_pos);
-                       if (err != sizeof(len)){
+                       if (err != sizeof(len)) {
                                err = -EIO;
                                goto out;
                        }
 
-                       err = link_file->f_op->read(link_file, (char*)&le64,
+                       err = link_file->f_op->read(link_file, (char *)&le64,
                                                    sizeof(__le64),
                                                    &link_file->f_pos);
-                       if (err != sizeof(__le64)){
+                       if (err != sizeof(__le64)) {
                                err = -EIO;
                                goto out;
                        }
@@ -653,7 +653,7 @@ struct dentry *__link_add_dirent(struct file *link_file, struct dentry *dentry)
                        /* check if this is our dirent */
                        if (ino == dentry->d_parent->d_inode->i_ino &&
                            dentry->d_name.len == len &&
-                           !strncmp(dentry->d_name.name, name, len)){
+                           !strncmp(dentry->d_name.name, name, len)) {
                                err = 0;
                                goto out;
                        }
@@ -663,24 +663,24 @@ struct dentry *__link_add_dirent(struct file *link_file, struct dentry *dentry)
 
        /* write the dirent in the file */
        le32 = cpu_to_le32(dentry->d_name.len);
-       err = link_file->f_op->write(link_file, (char*)&le32,
+       err = link_file->f_op->write(link_file, (char *)&le32,
                                     sizeof(__le32), &link_file->f_pos);
-       if (err != sizeof(__le32)){
+       if (err != sizeof(__le32)) {
                err = -EIO;
                goto out;
        }
 
        err = link_file->f_op->write(link_file, dentry->d_name.name,
                                     dentry->d_name.len, &link_file->f_pos);
-       if (err != dentry->d_name.len){
+       if (err != dentry->d_name.len) {
                err = -EIO;
                goto out;
        }
 
        le64 = cpu_to_le64(dentry->d_parent->d_inode->i_ino);
-       err = link_file->f_op->write(link_file, (char*)&le64,
+       err = link_file->f_op->write(link_file, (char *)&le64,
                                     sizeof(__le64), &link_file->f_pos);
-       if (err != sizeof(__le64)){
+       if (err != sizeof(__le64)) {
                err = -EIO;
                goto out;
        }
@@ -716,7 +716,7 @@ int odf_copyup_link(struct super_block *sb, struct dentry *old_dentry,
        if (old_dentry->d_inode->i_nlink <= 1)
                return 0;
 
-       name = kmalloc(UUID_LEN * 2 + 1,GFP_KERNEL);
+       name = kmalloc(UUID_LEN * 2 + 1, GFP_KERNEL);
        if (!name) {
                err = -ENOMEM;
                goto out;
@@ -724,7 +724,7 @@ int odf_copyup_link(struct super_block *sb, struct dentry *old_dentry,
 
        /* update the old link info file with the copyup info */
        uuid = odf_get_branch_uuid(osi, old_branch);
-       sprintf(name,"%x%x%x%x", *(unsigned int *) uuid,
+       sprintf(name, "%x%x%x%x", *(unsigned int *) uuid,
                *(unsigned int *) uuid + 4,
                *(unsigned int *) uuid + 8,
                *(unsigned int *) uuid + 12);
@@ -756,7 +756,7 @@ int odf_copyup_link(struct super_block *sb, struct dentry *old_dentry,
 
        /* write destination branch id */
        le32 = cpu_to_le32(branch_id(sb, new_branch));
-       err = link_file->f_op->write(link_file, (char*)&le32,
+       err = link_file->f_op->write(link_file, (char *)&le32,
                                     sizeof(__le32), &link_file->f_pos);
        if (err != sizeof(__le32)) {
                err = -EIO;
@@ -766,7 +766,7 @@ int odf_copyup_link(struct super_block *sb, struct dentry *old_dentry,
 
        /* write destination lower inode ino */
        le64 = cpu_to_le64(new_dentry->d_inode->i_ino);
-       err = link_file->f_op->write(link_file, (char*)&le64,
+       err = link_file->f_op->write(link_file, (char *)&le64,
                                     sizeof(__le64), &link_file->f_pos);
        if (err != sizeof(__le64)) {
                err = -EIO;
@@ -813,7 +813,7 @@ int __check_link_copyup(struct file *link_file, struct dentry *dentry,
        set_fs(KERNEL_DS);
 
        link_file->f_pos = 0;
-       err = link_file->f_op->read(link_file, (char*)&le32,
+       err = link_file->f_op->read(link_file, (char *)&le32,
                                    sizeof(__le32), &link_file->f_pos);
        if (err == sizeof(__le32))
                bid = le32_to_cpu(le32);
@@ -824,7 +824,7 @@ int __check_link_copyup(struct file *link_file, struct dentry *dentry,
                goto out_fs;
        }
 
-       err = link_file->f_op->read(link_file, (char*)&le64,
+       err = link_file->f_op->read(link_file, (char *)&le64,
                                    sizeof(__le64), &link_file->f_pos);
        if (err == sizeof(__le64))
                ino = le64_to_cpu(le64);
@@ -862,20 +862,20 @@ skip:
 
                link_file->f_pos = 0;
                le32 = 0;
-               err = link_file->f_op->write(link_file, (char*)&le32,
+               err = link_file->f_op->write(link_file, (char *)&le32,
                                             sizeof(__le32),
                                             &link_file->f_pos);
-               if (err != sizeof(__le32)){
+               if (err != sizeof(__le32)) {
                        set_fs(oldfs);
                        err = -EIO;
                        goto out;
                }
 
                le64 = 0;
-               err = link_file->f_op->write(link_file, (char*)&le64,
+               err = link_file->f_op->write(link_file, (char *)&le64,
                                             sizeof(__le64),
                                             &link_file->f_pos);
-               if (err != sizeof(__le64)){
+               if (err != sizeof(__le64)) {
                        set_fs(oldfs);
                        err = -EIO;
                        goto out;
@@ -883,14 +883,12 @@ skip:
 
                set_fs(oldfs);
                err = 0;
-       }
-
-       /*
-        * case 1:
-        * - Normal case, dst to the left of src and not ro
-        * - create parent hierarchy and link in the dst branch
-        */
-       else if (branch_dst < branch_src && !dst_ro) {
+       } else if (branch_dst < branch_src && !dst_ro) {
+               /*
+                * case 1:
+                * - Normal case, dst to the left of src and not ro
+                * - create parent hierarchy and link in the dst branch
+                */
 
                /* create parent hierarchy, then link */
                BUG_ON(unionfs_lower_dentry_idx(dentry, branch_dst));
@@ -909,36 +907,31 @@ skip:
                        goto out;
                }
                /* now link */
-       }
-
-       /*
-        * case 2:
-        * - dst is the same as src branch and not ro
-        * - unlink old file and straight link with copied up
-        */
-       else if (branch_dst == branch_src && !dst_ro) {
+       } else if (branch_dst == branch_src && !dst_ro) {
+               /*
+                * case 2:
+                * - dst is the same as src branch and not ro
+                * - unlink old file and straight link with copied up
+                */
                ;
-       }
-
-       /*
-        * case 3:
-        *
-        * - dst to the right of src, because of moving branches, so if the
-        * file was already copied up before the branch manipulation; it
-        * would now be lower by the old non-copied up version of the file.
-        *
-        * - Do nothing!
-        */
-       else if (branch_dst < branch_src) {
+       } else if (branch_dst < branch_src) {
+               /*
+                * case 3:
+                *
+                * - dst to the right of src, because of moving branches, so
+                * if the file was already copied up before the branch
+                * manipulation; it would now be lower by the old non-copied
+                * up version of the file.
+                *
+                * - Do nothing!
+                */
                ;
-       }
-
-       /*
-        * case 4:
-        * - dst branch is ro
-        * - copyup again!
-        */
-       else if (dst_ro) {
+       } else if (dst_ro) {
+               /*
+                * case 4:
+                * - dst branch is ro
+                * - copyup again!
+                */
                ;
        }
 
@@ -1018,9 +1011,9 @@ int odf_lookup(struct dentry *parent, struct dentry *dentry, int flags)
            !(flags & ODF_LOOKUP_WH)) {
 
                /* get/create the link info file for lower fs */
-               name = kmalloc(UUID_LEN * 2 + 1,GFP_KERNEL);
+               name = kmalloc(UUID_LEN * 2 + 1, GFP_KERNEL);
                uuid = odf_get_branch_uuid(osi, bstart);
-               sprintf(name,"%x%x%x%x", *(unsigned int *) uuid,
+               sprintf(name, "%x%x%x%x", *(unsigned int *) uuid,
                        *(unsigned int *) uuid + 4,
                        *(unsigned int *) uuid + 8,
                        *(unsigned int *) uuid + 12);
@@ -1047,7 +1040,7 @@ int odf_lookup(struct dentry *parent, struct dentry *dentry, int flags)
 
                /* check if link was copied up and act appropriately */
 
-#if 0
+#ifdef ODF_IS_CODE_REDUNDADNT
                /*
                 * XXX: Leave this out until Jeff's modifications to
                 * path_lookup (FIXME)
@@ -1091,7 +1084,7 @@ out:
 struct dentry *odf_lookup_name(struct dentry *parent, const char *name,
                               int len, int flags)
 {
-        return __odf_lookup(parent, NULL, name, len, flags, NULL);
+       return __odf_lookup(parent, NULL, name, len, flags, NULL);
 }
 
 /*
@@ -1141,13 +1134,13 @@ struct dentry *__odf_lookup(struct dentry *parent,
        odf_dentry = lookup_one_len(name, odf_parent, len);
 
        if (IS_ERR(odf_dentry)) {
-               printk("odf_lookup: failed to lookup %s\n", name);
+               printk(KERN_ERR "odf_lookup: failed to lookup %s\n", name);
                goto out;
        }
 
        /* if create flags are set, remove existing whiteout */
        if (odf_dentry->d_inode && (flags & ODF_LOOKUP_RMV_WH)) {
-               if (__odf_is_wh(osi, odf_dentry)){
+               if (__odf_is_wh(osi, odf_dentry)) {
                        vfs_unlink(odf_i_dir, odf_dentry);
                        dput(odf_dentry);
                        odf_dentry = lookup_one_len(name, odf_parent, len);
@@ -1161,26 +1154,23 @@ struct dentry *__odf_lookup(struct dentry *parent,
        /* create an entry in the odf if don't exist */
        if (!odf_dentry->d_inode) {
 
-               if (name[0]=='.')
-                       BUG_ON(len==1 || (name[1]=='.'&&len==2));
-       retry:
+               if (name[0] == '.')
+                       BUG_ON(len == 1 || (name[1] == '.' && len == 2));
+retry:
                /* FIXME need to check hardlinks before create */
                if (link && (flags & ODF_LOOKUP_FILE)) {
                        /* link to the given dentry */
                        vfs_link(link, odf_dentry->d_parent->d_inode,
                                 odf_dentry);
-               }
-               else if (flags & ODF_LOOKUP_FILE) {
+               } else if (flags & ODF_LOOKUP_FILE) {
                        current->fsuid = 0;
                        current->fsgid = 0;
                        err = vfs_create(odf_i_dir, odf_dentry, S_IRWXUGO, 0);
-               }
-               else if (flags & ODF_LOOKUP_WH) {
+               } else if (flags & ODF_LOOKUP_WH) {
                        current->fsuid = 0;
                        current->fsgid = 0;
                        err = vfs_link(osi->whiteout, odf_i_dir, odf_dentry);
-               }
-               else if (flags & ODF_LOOKUP_DIR) {
+               } else if (flags & ODF_LOOKUP_DIR) {
                        current->fsuid = 0;
                        current->fsgid = 0;
                        err = vfs_mkdir(odf_i_dir, odf_dentry, S_IRWXUGO);
@@ -1291,7 +1281,7 @@ struct dentry *odf_ic_dentry(struct odf_sb_info *osi, u64 ino, char *name,
        current->fsuid = 0;
        current->fsgid = 0;
 
-       memset(tmp_name,0,6);
+       memset(tmp_name, 0, 6);
        sprintf(tmp_name, "%x", breakdown[0]);
 
        /* look for/create the ##/##/##/## hierarchy */
@@ -1307,7 +1297,7 @@ struct dentry *odf_ic_dentry(struct odf_sb_info *osi, u64 ino, char *name,
                        goto out;
        }
        for (i = 1; i < 4; i++) {
-               memset(tmp_name,0,6);
+               memset(tmp_name, 0, 6);
                sprintf(tmp_name, "%x", breakdown[i]);
                dirs[i] = lookup_one_len(tmp_name, dirs[i-1],
                                         strlen(tmp_name));
@@ -1365,34 +1355,34 @@ int odf_write_dirent(struct file *filp, const char *name, int namelen,
 
        /* odf dirent magic */
        le32 = cpu_to_le32(ODF_DIRENT_MAGIC);
-       err = filp->f_op->write(filp, (char*)&le32,
+       err = filp->f_op->write(filp, (char *)&le32,
                                sizeof(__le32), &filp->f_pos);
        if (err != sizeof(__le32))
                goto out;
 
        /* inode */
        le64 = cpu_to_le64(ino);
-       err = filp->f_op->write(filp, (char*)&le64,
+       err = filp->f_op->write(filp, (char *)&le64,
                                sizeof(__le64), &filp->f_pos);
        if (err != sizeof(__le64))
                goto out;
 
        /* name length */
        le16 = cpu_to_le16(namelen);
-       err = filp->f_op->write(filp, (char*)&le16,
+       err = filp->f_op->write(filp, (char *)&le16,
                                sizeof(__le16), &filp->f_pos);
        if (err != sizeof(__le16))
                goto out;
 
        /* type */
        byte = (unsigned char)d_type;
-       err =filp->f_op->write(filp, (char*)&byte,
-                              sizeof(unsigned char), &filp->f_pos);
+       err = filp->f_op->write(filp, (char *)&byte,
+                               sizeof(unsigned char), &filp->f_pos);
        if (err != sizeof(unsigned char))
                goto out;
 
        /* name */
-       err = filp->f_op->write(filp, (char*)name,
+       err = filp->f_op->write(filp, (char *)name,
                                namelen, &filp->f_pos);
        if (err != namelen)
                goto out;
@@ -1422,7 +1412,7 @@ int odf_read_dirent(struct file *filp, char **name, int *namelen,
        set_fs(KERNEL_DS);
 
        /* dirent magic */
-       err = filp->f_op->read(filp, (char*)&le32,
+       err = filp->f_op->read(filp, (char *)&le32,
                               sizeof(__le32), &filp->f_pos);
        if (err != sizeof(__le32)) {
                err = -EIO;
@@ -1436,7 +1426,7 @@ int odf_read_dirent(struct file *filp, char **name, int *namelen,
        }
 
        /* inode */
-       err = filp->f_op->read(filp, (char*)&le64,
+       err = filp->f_op->read(filp, (char *)&le64,
                               sizeof(__le64), &filp->f_pos);
        if (err != sizeof(__le64)) {
                err = -EIO;
@@ -1445,7 +1435,7 @@ int odf_read_dirent(struct file *filp, char **name, int *namelen,
        *ino = le64_to_cpu(le64);
 
        /* name length */
-       err = filp->f_op->read(filp, (char*)&le16,
+       err = filp->f_op->read(filp, (char *)&le16,
                               sizeof(__le16), &filp->f_pos);
        if (err != sizeof(__le16)) {
                err = -EIO;
@@ -1458,7 +1448,7 @@ int odf_read_dirent(struct file *filp, char **name, int *namelen,
        }
 
        /* type */
-       err = filp->f_op->read(filp, (char*)&byte,
+       err = filp->f_op->read(filp, (char *)&byte,
                               sizeof(unsigned char), &filp->f_pos);
        if (err != sizeof(unsigned char)) {
                err = -EIO;
@@ -1472,7 +1462,7 @@ int odf_read_dirent(struct file *filp, char **name, int *namelen,
                err = -ENOMEM;
                goto out;
        }
-       err = filp->f_op->read(filp, (char*)(*name),
+       err = filp->f_op->read(filp, (char *)(*name),
                               *namelen, &filp->f_pos);
        if (err != *namelen) {
                err = -EIO;
@@ -1496,7 +1486,7 @@ int odf_purge_dir_cache(struct dentry *dentry)
        gid_t oldgid = current->fsgid;
 
        odf_cache = odf_ic_cache_dentry(dentry);
-       if (IS_ERR(odf_cache)){
+       if (IS_ERR(odf_cache)) {
                err = PTR_ERR(odf_cache);
                odf_cache = NULL;
                goto out;
@@ -1573,8 +1563,7 @@ int odf_remove(struct dentry *dentry, int flags)
        if (__odf_is_wh(&UNIONFS_SB(dentry->d_sb)->odf, odf_dentry)) {
                if (flags & ODF_RMV_WH)
                        rmv = 1;
-       }
-       else if (flags & ODF_RMV_NOTWH)
+       } else if (flags & ODF_RMV_NOTWH)
                rmv = 1;
 
        if (!rmv)
@@ -1788,7 +1777,7 @@ int odf_write_sb_data(struct odf_sb_info *osi, struct unionfs_data *data,
        /* version */
        le32 = ODF_VERSION;
        le32 = cpu_to_le32(le32);
-       err = file->f_op->write(file, (char*)&le32, sizeof(__le32),
+       err = file->f_op->write(file, (char *)&le32, sizeof(__le32),
                                &file->f_pos);
        if (err != sizeof(__le32)) {
                err = -EIO;
@@ -1797,7 +1786,7 @@ int odf_write_sb_data(struct odf_sb_info *osi, struct unionfs_data *data,
 
        /* number of branches */
        le32 = cpu_to_le32(branches);
-       err = file->f_op->write(file, (char*)&le32, sizeof(__le32),
+       err = file->f_op->write(file, (char *)&le32, sizeof(__le32),
                                &file->f_pos);
        if (err != sizeof(__le32)) {
                err = -EIO;
@@ -1817,7 +1806,7 @@ int odf_write_sb_data(struct odf_sb_info *osi, struct unionfs_data *data,
 
                /* write branch ids */
                le32 = cpu_to_le32(data[bindex].branch_id);
-               err = file->f_op->write(file, (char*)&le32, sizeof(__le32),
+               err = file->f_op->write(file, (char *)&le32, sizeof(__le32),
                                        &file->f_pos);
                if (err != sizeof(__le32)) {
                        err = -EIO;
@@ -1826,7 +1815,7 @@ int odf_write_sb_data(struct odf_sb_info *osi, struct unionfs_data *data,
 
                /* path length */
                le32 = cpu_to_le32(len);
-               err = file->f_op->write(file, (char*)&le32, sizeof(__le32),
+               err = file->f_op->write(file, (char *)&le32, sizeof(__le32),
                                        &file->f_pos);
                if (err != sizeof(__le32)) {
                        err = -EIO;
@@ -1842,7 +1831,7 @@ int odf_write_sb_data(struct odf_sb_info *osi, struct unionfs_data *data,
 
                /* permissions */
                le32 = cpu_to_le32(data[bindex].branchperms);
-               err = file->f_op->write(file, (char*)&le32, sizeof(__le32),
+               err = file->f_op->write(file, (char *)&le32, sizeof(__le32),
                                        &file->f_pos);
                if (err != sizeof(__le32)) {
                        err = -EIO;
@@ -1861,7 +1850,7 @@ int odf_write_sb_data(struct odf_sb_info *osi, struct unionfs_data *data,
 
 out_close:
        set_fs(oldfs);
-       filp_close(file,NULL);
+       filp_close(file, NULL);
 out:
        kfree(branch_path);
        kfree(branch_entry);
@@ -1893,8 +1882,8 @@ char *odf_read_sb_data(struct odf_sb_info *odf_sb, int **bid)
        }
 
        ptr = options;
-       sprintf(ptr,"dirs=");
-       ptr+=strlen(ptr);
+       sprintf(ptr, "dirs=");
+       ptr += strlen(ptr);
 
        d_content = odf_sb->sb;
        if (IS_ERR(d_content) || !d_content) {
@@ -1922,7 +1911,7 @@ char *odf_read_sb_data(struct odf_sb_info *odf_sb, int **bid)
        set_fs(KERNEL_DS);
 
        /* version */
-       err = file->f_op->read(file, (char*)&le32, sizeof(__le32),
+       err = file->f_op->read(file, (char *)&le32, sizeof(__le32),
                               &file->f_pos);
        if (err != sizeof(__le32)) {
                err = -EIO;
@@ -1941,7 +1930,7 @@ char *odf_read_sb_data(struct odf_sb_info *odf_sb, int **bid)
        }
 
        /* branch count */
-       err = file->f_op->read(file, (char*)&le32, sizeof(__le32),
+       err = file->f_op->read(file, (char *)&le32, sizeof(__le32),
                               &file->f_pos);
        if (err != sizeof(__le32)) {
                err = -EIO;
@@ -1970,7 +1959,7 @@ char *odf_read_sb_data(struct odf_sb_info *odf_sb, int **bid)
        i = 0;
        while (i < count) {
                /* branch id */
-               err = file->f_op->read(file, (char*)&le32, sizeof(__le32),
+               err = file->f_op->read(file, (char *)&le32, sizeof(__le32),
                                       &file->f_pos);
                if (err != sizeof(__le32)) {
                        err = -EIO;
@@ -1979,7 +1968,7 @@ char *odf_read_sb_data(struct odf_sb_info *odf_sb, int **bid)
                (*bid)[i] = le32_to_cpu(le32);
 
                /* path length */
-               err = file->f_op->read(file, (char*)&le32, sizeof(__le32),
+               err = file->f_op->read(file, (char *)&le32, sizeof(__le32),
                                       &file->f_pos);
                if (err != sizeof(__le32)) {
                        err = -EIO;
@@ -1999,7 +1988,7 @@ char *odf_read_sb_data(struct odf_sb_info *odf_sb, int **bid)
                }
 
                /* permissions */
-               err = file->f_op->read(file, (char*)&le32, sizeof(__le32),
+               err = file->f_op->read(file, (char *)&le32, sizeof(__le32),
                                       &file->f_pos);
                if (err != sizeof(__le32)) {
                        err = -EIO;
@@ -2008,7 +1997,7 @@ char *odf_read_sb_data(struct odf_sb_info *odf_sb, int **bid)
                perms = le32_to_cpu(le32);
 
                /* branch UUID */
-               err = file->f_op->read(file, (char*)uuid, UUID_LEN,
+               err = file->f_op->read(file, (char *)uuid, UUID_LEN,
                                       &file->f_pos);
                if (err != UUID_LEN) {
                        err = -EIO;
@@ -2017,23 +2006,23 @@ char *odf_read_sb_data(struct odf_sb_info *odf_sb, int **bid)
                memcpy(odf_sb->branch_uuids + i * UUID_LEN, uuid, UUID_LEN);
 
                /* add the branch permissions to the options string */
-               ptr+=len;
+               ptr += len;
                if (perms == MAY_READ)
-                       sprintf(ptr,"=ro:");
+                       sprintf(ptr, "=ro:");
                else if (perms == (MAY_READ | MAY_WRITE))
-                       sprintf(ptr,"=rw:");
-               ptr+=strlen(ptr);
+                       sprintf(ptr, "=rw:");
+               ptr += strlen(ptr);
                i++;
        }
 
        *(ptr - 1) = '\0'; /* remove trailing ':' */
        err = 0;
        set_fs(oldfs);
-       filp_close(file,NULL);
+       filp_close(file, NULL);
        goto out;
 out_close:
        set_fs(oldfs);
-       filp_close(file,NULL);
+       filp_close(file, NULL);
        kfree(odf_sb->branch_uuids);
        odf_sb->branch_uuids = NULL;
 out_err:
index 330812df3f7ae3af54556796f404d7cc4a49f66d..f57b1f549b0a97fa246c41d00aae3b39880dda59 100644 (file)
@@ -33,8 +33,8 @@ int copyup_empty_dir(struct inode *parent, struct dentry *dentry, int mode)
                lower_dentry = create_parents(parent, dentry,
                                              dentry->d_name.name, bindex);
                if (!lower_dentry || IS_ERR(lower_dentry)) {
-                       printk(KERN_DEBUG "lower dentry NULL for "
-                              "bindex = %d\n", bindex);
+                       pr_debug("lower dentry NULL for "
+                                "bindex = %d\n", bindex);
                        err = PTR_ERR(lower_dentry);
                        goto out;
                }
@@ -230,8 +230,7 @@ static int do_unionfs_rename(struct inode *old_dir,
                        if (err)
                                goto revert;
                }
-       }
-       else if (err && old_bstart == 0) {
+       } else if (err && old_bstart == 0) {
                if (bindex == 0)
                        /* no changes made, no need to revert, just fail */
                        goto out;
@@ -380,13 +379,12 @@ int unionfs_rename(struct inode *old_dir, struct dentry *old_dentry,
         * since it will cause us problems when we copyup
         */
        lower = unionfs_lower_dentry_idx(new_dentry, 0);
-       if (lower && lower->d_inode ) {
+       if (lower && lower->d_inode) {
                if (UNIONFS_D(new_dentry)->odf.whiteout) {
                        err = unionfs_force_rm(new_dentry, &lower, 0);
                        if (err)
                                goto out;
-               }
-               else if (S_ISDIR(new_dentry->d_inode->i_mode)) {
+               } else if (S_ISDIR(new_dentry->d_inode->i_mode)) {
                        /* remove it only if logically empty */
                        err = check_empty(new_dentry, NULL);
                        if (err)
@@ -448,7 +446,9 @@ out:
                    atomic_read(&new_dentry->d_inode->i_count) < 2) {
                        int bindex;
                        struct inode *i = new_dentry->d_inode;
-                       for (bindex = ibstart(i); bindex <= ibend(i); bindex++) {
+                       for (bindex = ibstart(i);
+                            bindex <= ibend(i);
+                            bindex++) {
                                if (unionfs_lower_inode_idx(i, bindex))
                                        iput(unionfs_lower_inode_idx(i,
                                                                     bindex));
index f389d7cec20c132a21b4158d8ef0a674cafba76d..b9fbeef4a954d3dc47dcb4c086444cc3a0168448 100644 (file)
@@ -59,7 +59,7 @@ int __run_sioa(void *args)
 {
        struct sioa_args *sioa_args = (struct sioa_args *)args;
        sioa_args->process = current;
-       while (!sioa_args->complete){
+       while (!sioa_args->complete) {
                sioa_args->work(args);
                if (sioa_args->waiting) {
                        complete(&sioa_args->comp_work);
@@ -86,7 +86,7 @@ int __run_sioa(void *args)
  * terminates if done, otherwise repeats the loop.  The done function should
  * return 0 if not done.
  */
-void run_sioa(struct sioa_args *args, void (*work) (void*),
+void run_sioa(struct sioa_args *args, void (*work) (void *),
              signed long timeout)
 {
        init_completion(&args->comp_thread);
@@ -96,7 +96,7 @@ void run_sioa(struct sioa_args *args, void (*work) (void*),
        args->process = NULL;
        args->timeout = timeout;
        args->work = work;
-       kernel_thread(__run_sioa, args, 0);
+       kthread_run(__run_sioa, args, "unionfs_odfd");
 }
 
 /*
index 0494084337e485531763695b06a48801a11d990a..46b91c74bf8652913e0b47c232c3cae220eb4a70 100644 (file)
@@ -74,8 +74,8 @@ struct sioa_args {
        struct completion comp_work;
        struct task_struct *process;
        signed long timeout;
-       void (*work) (void*);
-       struct mutex lock;
+       void (*work) (void *);
+       struct mutex lock;      /* synchronize multiple threads */
        int waiting;
        int complete;
 
@@ -87,7 +87,7 @@ struct sioa_args {
 extern int __init init_sioq(void);
 extern void stop_sioq(void);
 extern void run_sioq(work_func_t func, struct sioq_args *args);
-extern void run_sioa(struct sioa_args *args, void (*work) (void*),
+extern void run_sioa(struct sioa_args *args, void (*work) (void *),
                     signed long timeout);
 extern void wake_up_and_wait_sioa(struct sioa_args *args);
 extern void wake_up_sioa(struct sioa_args *args);
index afc972bb243f30f73e1d939791bba122fa33db9e..6b0fe56ea9d45dde99c476e0ca859c70234c4285 100644 (file)
@@ -704,8 +704,8 @@ out_no_change:
 
        /* first we need to update the uuids */
        err = odf_update_uuids(odf, UNIONFS_D(sb->s_root)->lower_paths,
-                              cur_branches, new_lower_paths, new_branches );
-       if(err)
+                              cur_branches, new_lower_paths, new_branches);
+       if (err)
                goto out_release;
 
        err = odf_write_sb_data(odf, new_data, new_lower_paths, new_branches);
index a2f12b9fd4f2f13411480e3d12709a3f8c108123..de07ebdc12b765619f937728bf77a6642ad5cec5 100644 (file)
@@ -47,6 +47,7 @@
 #include <linux/mman.h>
 #include <linux/backing-dev.h>
 #include <linux/exportfs.h>
+#include <linux/kthread.h>
 
 #include <asm/system.h>
 
@@ -81,9 +82,11 @@ extern struct address_space_operations unionfs_aops;
 
 #if defined(CONFIG_EXPORTFS) || defined(CONFIG_EXPORTFS_MODULE)
 extern struct export_operations unionfs_export_ops;
-#define init_export_op(sb)      ({(sb)->s_export_op = &unionfs_export_ops;})
+#define init_export_op(sb)     do { \
+                               (sb)->s_export_op = &unionfs_export_ops; \
+                               } while (0)
 #else /* not (CONFIG_EXPORTFS || CONFIG_EXPORTFS_MODULE) */
-#define init_export_op(sb)      /* */
+#define init_export_op(sb)     do {} while (0)
 #endif /* not (CONFIG_EXPORTFS || CONFIG_EXPORTFS_MODULE) */
 
 /* file private data. */
@@ -536,9 +539,9 @@ static inline void unionfs_mntput(struct dentry *dentry, int bindex)
  * get_parent
  */
 struct dentry_stack {
-        struct dentry **item;
-        int n;
-        int size;
+       struct dentry **item;
+       int n;
+       int size;
 };
 
 int __odf_dstack_resize(struct dentry_stack *stack);
@@ -554,9 +557,9 @@ static inline void __odf_dstack_init(struct dentry_stack *stack, int size)
 static inline int __odf_dstack_push(struct dentry_stack *stack,
                                    struct dentry *dentry)
 {
-        stack->item[stack->n++] = dentry;
-        if (stack->n == stack->size)
-                return __odf_dstack_resize(stack);
+       stack->item[stack->n++] = dentry;
+       if (stack->n == stack->size)
+               return __odf_dstack_resize(stack);
        return 0;
 }
 
index 91fb34a5291f66527415168c7cfe406947a375bc..637dc75b3565b8cfdb38ac00214aef4da8bd36e7 100644 (file)
@@ -45,7 +45,8 @@ static int unionfs_do_unlink(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);
                else
@@ -154,7 +155,8 @@ static int unionfs_do_rmdir(struct inode *dir, struct dentry *dentry)
        int err = 0;
        struct iattr attr;
 
-       if ((err = unionfs_partial_lookup(dentry)))
+       err = unionfs_partial_lookup(dentry);
+       if (err)
                goto out;
 
        bstart = dbstart(dentry);
@@ -169,7 +171,8 @@ static int unionfs_do_rmdir(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_rmdir(lower_dir_dentry->d_inode,
                                        lower_dentry);
                else