Unionfs: port to 3.4
authorErez Zadok <ezk@cs.sunysb.edu>
Sun, 24 Nov 2013 19:28:37 +0000 (14:28 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Sun, 24 Nov 2013 19:28:37 +0000 (14:28 -0500)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/commonfops.c
fs/unionfs/main.c
fs/unionfs/union.h

index 71cacfe9f9282176d67a9e4e4f7a7b8de812d494..970b252b7d8847525d4815fd1d9367a891687c2a 100644 (file)
 
 #include "union.h"
 
+#define __NFDBITS      (8 * sizeof(unsigned long))
+#define __FDSET_LONGS  (__FD_SETSIZE/__NFDBITS)
+static inline void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
+{
+       unsigned long __tmp = __fd / __NFDBITS;
+       unsigned long __rem = __fd % __NFDBITS;
+       __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
+}
+static inline void __FD_ZERO(__kernel_fd_set *__p)
+{
+       unsigned long *__tmp = __p->fds_bits;
+       int __i;
+
+       if (__builtin_constant_p(__FDSET_LONGS)) {
+               switch (__FDSET_LONGS) {
+               case 16:
+                       __tmp[ 0] = 0; __tmp[ 1] = 0;
+                       __tmp[ 2] = 0; __tmp[ 3] = 0;
+                       __tmp[ 4] = 0; __tmp[ 5] = 0;
+                       __tmp[ 6] = 0; __tmp[ 7] = 0;
+                       __tmp[ 8] = 0; __tmp[ 9] = 0;
+                       __tmp[10] = 0; __tmp[11] = 0;
+                       __tmp[12] = 0; __tmp[13] = 0;
+                       __tmp[14] = 0; __tmp[15] = 0;
+                       return;
+
+               case 8:
+                       __tmp[ 0] = 0; __tmp[ 1] = 0;
+                       __tmp[ 2] = 0; __tmp[ 3] = 0;
+                       __tmp[ 4] = 0; __tmp[ 5] = 0;
+                       __tmp[ 6] = 0; __tmp[ 7] = 0;
+                       return;
+
+               case 4:
+                       __tmp[ 0] = 0; __tmp[ 1] = 0;
+                       __tmp[ 2] = 0; __tmp[ 3] = 0;
+                       return;
+               }
+       }
+       __i = __FDSET_LONGS;
+       while (__i) {
+               __i--;
+               *__tmp = 0;
+               __tmp++;
+       }
+}
+
+
 /*
  * 1) Copyup the file
  * 2) Rename the file to '.unionfs<original inode#><counter>' - obviously
@@ -781,14 +829,14 @@ static int unionfs_ioctl_queryfile(struct file *file, struct dentry *parent,
        bstart = dbstart(dentry);
        bend = dbend(dentry);
 
-       FD_ZERO(&branchlist);
+       __FD_ZERO(&branchlist);
 
        for (bindex = bstart; bindex <= bend; bindex++) {
                lower_dentry = unionfs_lower_dentry_idx(dentry, bindex);
                if (!lower_dentry)
                        continue;
                if (likely(lower_dentry->d_inode))
-                       FD_SET(bindex, &branchlist);
+                       __FD_SET(bindex, &branchlist);
                /* purge any lower objects after partial_lookup */
                if (bindex < orig_bstart || bindex > orig_bend) {
                        dput(lower_dentry);
index ee78f1d90c9601996b56735aeb3242d7c9940e34..bf7b72bc8e2687c3ccaf80240f4b63e8f3904fe0 100644 (file)
@@ -599,7 +599,7 @@ static int unionfs_read_super(struct super_block *sb, void *raw_data,
                err = PTR_ERR(inode);
                goto out_dput;
        }
-       sb->s_root = d_alloc_root(inode);
+       sb->s_root = d_make_root(inode);
        if (unlikely(!sb->s_root)) {
                err = -ENOMEM;
                goto out_iput;
index 8e7fcfba7b5d6315f35ca60e34f8b5b410ee6518..f074970581bd4afbebbcbccf04cff6eecec6deff 100644 (file)
@@ -48,8 +48,6 @@
 #include <linux/splice.h>
 #include <linux/sched.h>
 
-#include <asm/system.h>
-
 #include <linux/union_fs.h>
 
 /* the file system name */