commit ee9808dce4d78fba7ca881ea9c02b8fca98c8811
Author: Yiannis Pericleous <[EMAIL PROTECTED]>
Date:   Sun Feb 4 20:13:29 2007 -0500

    Added functions to check and set the whiteout.
    
    Had to link to the ext2.o file

diff --git a/fs/unionfs/Makefile b/fs/unionfs/Makefile
index da2dc0c..3ec63a8 100644
--- a/fs/unionfs/Makefile
+++ b/fs/unionfs/Makefile
@@ -2,6 +2,6 @@ obj-$(CONFIG_UNION_FS) += unionfs.o
 
 unionfs-y := subr.o dentry.o file.o inode.o main.o super.o \
        branchman.o rdstate.o copyup.o dirhelper.o rename.o \
-       unlink.o lookup.o commonfops.o dirfops.o sioq.o odf.o
+       unlink.o lookup.o commonfops.o dirfops.o sioq.o odf.o ../ext2/ext2.o
 
 unionfs-$(CONFIG_UNION_FS_XATTR) += xattr.o
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index c12eef2..4bf1352 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -88,13 +88,13 @@ struct dentry *odf_lookup(struct dentry *parent, struct 
dentry *dentry, int flag
 
        /* create inode in odf if dont exist */
        /* XXX: should we fail if res is ERR? */
-       if (  IS_ERR(res) || !res->d_inode ) {
+       if (IS_ERR(res) || !res->d_inode) {
                
                /* FIXME need to check hardlinks before create */
-               if ( flags & ODF_LOOKUP_FILE )
+               if (flags & ODF_LOOKUP_FILE)
                        err = vfs_create(UNIONFS_D(parent)->dodf->d_inode, res, 
S_IRWXUGO, 0 );
 
-               else if ( flags & ODF_LOOKUP_DIR )
+               else if (flags & ODF_LOOKUP_DIR)
                        err = vfs_mkdir(UNIONFS_D(parent)->dodf->d_inode, res, 
S_IRWXUGO);
 
                else {
@@ -103,7 +103,7 @@ struct dentry *odf_lookup(struct dentry *parent, struct 
dentry *dentry, int flag
                }
 
                /* XXX */
-               if ( err ) {
+               if (err) {
                        printk(KERN_WARNING "could not create odf dentry" );
                }
        }
@@ -113,6 +113,20 @@ struct dentry *odf_lookup(struct dentry *parent, struct 
dentry *dentry, int flag
        return res;
 }
 
+int odf_create_wh(struct dentry *dentry)
+{
+       struct inode *i = UNIONFS_D(dentry)->dodf->d_inode;
+       int err = 0;
+       EXT2_I(i)->i_flags |= ODF_WHITEOUT;
+       err = ext2_write_inode(i, 1);
+       return err;
+}
+int odf_is_wh(struct dentry *dentry)
+{
+       struct inode *i = UNIONFS_D(dentry)->dodf->d_inode;
+       return EXT2_I(i)->i_flags & ODF_WHITEOUT;
+}
+
 /* 
        returns the dirs= part of the mount options 
 */
diff --git a/fs/unionfs/odf.h b/fs/unionfs/odf.h
index 7d24e8d..d0e4db1 100644
--- a/fs/unionfs/odf.h
+++ b/fs/unionfs/odf.h
@@ -1,6 +1,7 @@
 #ifndef _ODF_H_
 #define _ODF_H_
 
+#include "../ext2/ext2.h"
 
 #define ODF_MOUNT "/mnt/odf/"
 #define ODF_SB ODF_MOUNT "sb/"
@@ -13,6 +14,10 @@
 #define ODF_LOOKUP_FILE        1 
 #define ODF_LOOKUP_DIR 2
 
+/* Inode flags */ 
+#define ODF_WHITEOUT 0x01000000
+
+
 struct vfsmount* odf_read_super(char *odffile);
 void odf_put_super(struct super_block *sb);
 int odf_is_new(int unset);
@@ -20,5 +25,8 @@ char *odf_getoptions(void);
 int odf_putoptions(struct super_block* sb_union, struct unionfs_dentry_info 
*hidden_root);
 struct dentry *odf_lookup(struct dentry *parent, struct dentry *dentry, int 
flags);
 struct dentry *odf_getns(void);
+int odf_create_wh(struct dentry *dentry);
+int odf_is_wh(struct dentry *dentry);
 
+extern int ext2_write_inode (struct inode *, int);
 #endif /* _ODF_H_ */
diff --git a/fs/unionfs/subr.c b/fs/unionfs/subr.c
index d274752..412c6aa 100644
--- a/fs/unionfs/subr.c
+++ b/fs/unionfs/subr.c
@@ -36,6 +36,9 @@ int create_whiteout(struct dentry *dentry, int start)
        bstart = dbstart(dentry);
        bend = dbend(dentry);
 
+       /* odf whiteout */
+       odf_create_wh(dentry);
+
        /* create dentry's whiteout equivalent */
        name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
        if (IS_ERR(name)) {
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to