commit c94dde7e82a3ad98a74e54cc2c6badd1a5a03436
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Mon Feb 5 13:21:45 2007 -0500

    More code cleanup as per jeff's comments
    
    Added functions for set/get opaqueness (now using bits 24-30 of i_flags)

diff --git a/fs/unionfs/main.c b/fs/unionfs/main.c
index b7d9ead..d3615b5 100644
--- a/fs/unionfs/main.c
+++ b/fs/unionfs/main.c
@@ -452,7 +452,7 @@ static struct unionfs_dentry_info 
*unionfs_parse_options(struct super_block *sb,
                        }
                        err = parse_dirs_option(sb, hidden_root_info, optarg);
                        if (err)
-                               dirsfound--; //goto out_error;
+                               goto out_error;
                        continue;
                }
 
@@ -566,7 +566,6 @@ static int unionfs_read_super(struct super_block *sb, void 
*raw_data,
                goto out;
        }
 
-
        UNIONFS_SB(sb)->bend = -1;
        atomic_set(&UNIONFS_SB(sb)->generation, 1);
        init_rwsem(&UNIONFS_SB(sb)->rwsem);
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index 5703006..3fde941 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -1415,6 +1415,65 @@ int __odf_set_opaque(struct dentry *d, int branch)
        return notify_change(d, &ia);
 }
 
+/*
+ * Checks if a dentry is opaque
+ * The dentry version takes a UnionFS dentry, the inode one an ODF inode
+ */
+int odf_is_opaque(struct dentry *dentry) 
+{
+       return odf_is_opaque_i(UNIONFS_D(dentry)->odf_info->dentry->d_inode);
+}
+int odf_is_opaque_i(struct inode *i) 
+{
+       if (!S_ISDIR(i->i_mode))
+               return 0;
+       return EXT2_I(i)->i_flags & ODF_OPAQUE;
+}
+/*
+ * Gets opaque branch of a dentry, -1 if not opaque
+ * The dentry version takes a UnionFS dentry, the inode one an ODF inode
+ */
+int odf_get_opaque(struct dentry *dentry) 
+{
+       return odf_get_opaque_i(UNIONFS_D(dentry)->odf_info->dentry->d_inode);
+}
+int odf_get_opaque_i(struct inode *i) 
+{
+       u32 res = 0;
+       if (!odf_is_opaque_i(i))
+               return -1;
+
+       /* get bits 26-30 */
+       res = EXT2_I(i)->i_flags;
+       res <<= 1;
+       res >>= (ODF_OPQ_BASE + 1);
+       return res;
+}
+
+/*
+ * Sets a dentry as opaque, if not use -1 for branch
+ * The dentry version takes a UnionFS dentry, the inode one an ODF inode
+ */
+int odf_set_opaque(struct dentry *dentry, int branch)
+{
+       return odf_set_opaque_i(UNIONFS_D(dentry)->odf_info->dentry->d_inode, 
branch);
+}
+int odf_set_opaque_i(struct inode *i, int branch) 
+{
+       u32 b = branch;
+       int err = 0;
+
+       if (branch < 0)
+               EXT2_I(i)->i_flags &= !ODF_OPAQUE;
+       else {
+               b <<= ODF_OPQ_BASE + 1;
+               b >>= 1;
+               EXT2_I(i)->i_flags |= (ODF_OPAQUE|b);
+       }
+       err = ext2_write_inode(i, 1);
+       return err;
+}
+
 /* 
  * checks the sb/content file exists 
  */
diff --git a/fs/unionfs/odf.h b/fs/unionfs/odf.h
index 92e37d6..cb63f8d 100644
--- a/fs/unionfs/odf.h
+++ b/fs/unionfs/odf.h
@@ -17,6 +17,10 @@
 #define ODF_OPTIONS_LEN 255
 #define ODF_INAME_LEN  10
 
+/* Some string constants */
+#define ODF_BRANCH_PATH 255
+#define ODF_OPTIONS_LEN 255
+
 /* Lookup flags (what to create if lookup fails) */
 #define ODF_LOOKUP_FILE        1 
 #define ODF_LOOKUP_DIR 2
@@ -136,5 +140,4 @@ static inline void odf_unlock(struct odf_dentry_info *odi)
 
 extern void generate_random_uuid(unsigned char uuid_out[16]);
 
-extern int ext2_write_inode (struct inode *, int);
 #endif /* _ODF_H_ */
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index f2b2037..7bfc369 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -136,16 +136,6 @@ struct unionfs_inode_info {
        struct inode vfs_inode;
 };
 
-/* odf dentry data */
-struct odf_dentry_info {
-       /* The odf dentry info should contain info on the location of 
-        * the data in the odf file. Right now i keep a dentry for easy
-        * lookup in the underlying ext2 
-        */
-       u64 inum;
-       struct dentry *dentry;
-};
-
 /* unionfs dentry data in memory */
 struct unionfs_dentry_info {
        /* The semaphore is used to lock the dentry as soon as we get into a
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to