head	1.1;
access;
symbols
	LKML-branch:1.1.0.2;
locks; strict;
comment	@# @;


1.1
date	2006.10.13.09.40.40;	author jsipek;	state dead;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2006.10.13.09.40.40;	author jsipek;	state Exp;
branches;
next	1.1.2.2;

1.1.2.2
date	2006.10.13.10.54.24;	author jsipek;	state Exp;
branches;
next	1.1.2.3;

1.1.2.3
date	2006.10.17.00.07.55;	author jsipek;	state Exp;
branches;
next	1.1.2.4;

1.1.2.4
date	2006.10.17.05.12.40;	author jsipek;	state Exp;
branches;
next	1.1.2.5;

1.1.2.5
date	2006.10.17.22.27.42;	author jsipek;	state dead;
branches;
next	;


desc
@@


1.1
log
@file stackfs-ecryptfs was initially added on branch LKML-branch.
@
text
@@


1.1.2.1
log
@Some generic bits for stackfs
@
text
@a0 210
diff -r cd0f5e65253f fs/ecryptfs/file.c
--- a/fs/ecryptfs/file.c	Fri Oct 13 05:25:03 2006 -0400
+++ b/fs/ecryptfs/file.c	Fri Oct 13 05:33:21 2006 -0400
@@@@ -30,6 +30,7 @@@@
 #include <linux/security.h>
 #include <linux/smp_lock.h>
 #include <linux/compat.h>
+#include <linux/stack_fs.h>
 #include "ecryptfs_kernel.h"
 
 /**
@@@@ -192,7 +193,7 @@@@ retry:
 		goto retry;
 	file->f_pos = lower_file->f_pos;
 	if (rc >= 0)
-		ecryptfs_copy_attr_atime(inode, lower_file->f_dentry->d_inode);
+		stackfs_copy_attr_atime(inode, lower_file->f_dentry->d_inode);
 	return rc;
 }
 
diff -r cd0f5e65253f fs/ecryptfs/inode.c
--- a/fs/ecryptfs/inode.c	Fri Oct 13 05:25:03 2006 -0400
+++ b/fs/ecryptfs/inode.c	Fri Oct 13 05:25:06 2006 -0400
@@@@ -30,6 +30,7 @@@@
 #include <linux/namei.h>
 #include <linux/mount.h>
 #include <linux/crypto.h>
+#include <linux/stack_fs.h>
 #include "ecryptfs_kernel.h"
 
 static struct dentry *lock_parent(struct dentry *dentry)
@@@@ -51,48 +52,6 @@@@ static void unlock_dir(struct dentry *di
 {
 	mutex_unlock(&dir->d_inode->i_mutex);
 	dput(dir);
-}
-
-void ecryptfs_copy_inode_size(struct inode *dst, const struct inode *src)
-{
-	i_size_write(dst, i_size_read((struct inode *)src));
-	dst->i_blocks = src->i_blocks;
-}
-
-void ecryptfs_copy_attr_atime(struct inode *dest, const struct inode *src)
-{
-	dest->i_atime = src->i_atime;
-}
-
-static void ecryptfs_copy_attr_times(struct inode *dest,
-				     const struct inode *src)
-{
-	dest->i_atime = src->i_atime;
-	dest->i_mtime = src->i_mtime;
-	dest->i_ctime = src->i_ctime;
-}
-
-static void ecryptfs_copy_attr_timesizes(struct inode *dest,
-					 const struct inode *src)
-{
-	dest->i_atime = src->i_atime;
-	dest->i_mtime = src->i_mtime;
-	dest->i_ctime = src->i_ctime;
-	ecryptfs_copy_inode_size(dest, src);
-}
-
-void ecryptfs_copy_attr_all(struct inode *dest, const struct inode *src)
-{
-	dest->i_mode = src->i_mode;
-	dest->i_nlink = src->i_nlink;
-	dest->i_uid = src->i_uid;
-	dest->i_gid = src->i_gid;
-	dest->i_rdev = src->i_rdev;
-	dest->i_atime = src->i_atime;
-	dest->i_mtime = src->i_mtime;
-	dest->i_ctime = src->i_ctime;
-	dest->i_blkbits = src->i_blkbits;
-	dest->i_flags = src->i_flags;
 }
 
 /**
@@@@ -171,8 +130,8 @@@@ ecryptfs_do_create(struct inode *directo
 		ecryptfs_printk(KERN_ERR, "Failure in ecryptfs_interpose\n");
 		goto out_lock;
 	}
-	ecryptfs_copy_attr_timesizes(directory_inode,
-				     lower_dir_dentry->d_inode);
+	stackfs_copy_attr_timesizes(directory_inode,
+				    lower_dir_dentry->d_inode);
 out_lock:
 	unlock_dir(lower_dir_dentry);
 out:
@@@@ -372,7 +331,7 @@@@ static struct dentry *ecryptfs_lookup(st
        		"d_name.name = [%s]\n", lower_dentry,
 		lower_dentry->d_name.name);
 	lower_inode = lower_dentry->d_inode;
-	ecryptfs_copy_attr_atime(dir, lower_dir_dentry->d_inode);
+	stackfs_copy_attr_atime(dir, lower_dir_dentry->d_inode);
 	BUG_ON(!atomic_read(&lower_dentry->d_count));
 	ecryptfs_set_dentry_private(dentry,
 				    kmem_cache_alloc(ecryptfs_dentry_info_cache,
@@@@ -478,7 +437,7 @@@@ static int ecryptfs_link(struct dentry *
 	rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb, 0);
 	if (rc)
 		goto out_lock;
-	ecryptfs_copy_attr_timesizes(dir, lower_new_dentry->d_inode);
+	stackfs_copy_attr_timesizes(dir, lower_new_dentry->d_inode);
 	old_dentry->d_inode->i_nlink =
 		ecryptfs_inode_to_lower(old_dentry->d_inode)->i_nlink;
 	i_size_write(new_dentry->d_inode, file_size_save);
@@@@ -503,7 +462,7 @@@@ static int ecryptfs_unlink(struct inode 
 		ecryptfs_printk(KERN_ERR, "Error in vfs_unlink\n");
 		goto out_unlock;
 	}
-	ecryptfs_copy_attr_times(dir, lower_dir_inode);
+	stackfs_copy_attr_times(dir, lower_dir_inode);
 	dentry->d_inode->i_nlink =
 		ecryptfs_inode_to_lower(dentry->d_inode)->i_nlink;
 	dentry->d_inode->i_ctime = dir->i_ctime;
@@@@ -542,7 +501,7 @@@@ static int ecryptfs_symlink(struct inode
 	rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
 	if (rc)
 		goto out_lock;
-	ecryptfs_copy_attr_timesizes(dir, lower_dir_dentry->d_inode);
+	stackfs_copy_attr_timesizes(dir, lower_dir_dentry->d_inode);
 out_lock:
 	unlock_dir(lower_dir_dentry);
 	dput(lower_dentry);
@@@@ -565,7 +524,7 @@@@ static int ecryptfs_mkdir(struct inode *
 	rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
 	if (rc)
 		goto out;
-	ecryptfs_copy_attr_timesizes(dir, lower_dir_dentry->d_inode);
+	stackfs_copy_attr_timesizes(dir, lower_dir_dentry->d_inode);
 	dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;
 out:
 	unlock_dir(lower_dir_dentry);
@@@@ -601,7 +560,7 @@@@ static int ecryptfs_rmdir(struct inode *
 		d_delete(tlower_dentry);
 		tlower_dentry = NULL;
 	}
-	ecryptfs_copy_attr_times(dir, lower_dir_dentry->d_inode);
+	stackfs_copy_attr_times(dir, lower_dir_dentry->d_inode);
 	dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;
 	unlock_dir(lower_dir_dentry);
 	if (!rc)
@@@@ -629,7 +588,7 @@@@ ecryptfs_mknod(struct inode *dir, struct
 	rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
 	if (rc)
 		goto out;
-	ecryptfs_copy_attr_timesizes(dir, lower_dir_dentry->d_inode);
+	stackfs_copy_attr_timesizes(dir, lower_dir_dentry->d_inode);
 out:
 	unlock_dir(lower_dir_dentry);
 	if (!dentry->d_inode)
@@@@ -658,9 +617,9 @@@@ ecryptfs_rename(struct inode *old_dir, s
 			lower_new_dir_dentry->d_inode, lower_new_dentry);
 	if (rc)
 		goto out_lock;
-	ecryptfs_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode);
+	stackfs_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode);
 	if (new_dir != old_dir)
-		ecryptfs_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode);
+		stackfs_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode);
 out_lock:
 	unlock_rename(lower_old_dir_dentry, lower_new_dir_dentry);
 	dput(lower_new_dentry);
@@@@ -714,8 +673,8 @@@@ ecryptfs_readlink(struct dentry *dentry,
 				rc = -EFAULT;
 		}
 		kfree(decoded_name);
-		ecryptfs_copy_attr_atime(dentry->d_inode,
-					 lower_dentry->d_inode);
+		stackfs_copy_attr_atime(dentry->d_inode,
+					lower_dentry->d_inode);
 	}
 out_free_lower_buf:
 	kfree(lower_buf);
@@@@ -945,7 +904,7 @@@@ static int ecryptfs_setattr(struct dentr
 	}
 	rc = notify_change(lower_dentry, ia);
 out:
-	ecryptfs_copy_attr_all(inode, lower_inode);
+	stackfs_copy_attr_all(inode, lower_inode);
 	return rc;
 }
 
diff -r cd0f5e65253f fs/ecryptfs/main.c
--- a/fs/ecryptfs/main.c	Fri Oct 13 05:25:03 2006 -0400
+++ b/fs/ecryptfs/main.c	Fri Oct 13 05:33:21 2006 -0400
@@@@ -35,6 +35,7 @@@@
 #include <linux/pagemap.h>
 #include <linux/key.h>
 #include <linux/parser.h>
+#include <linux/stack_fs.h>
 #include "ecryptfs_kernel.h"
 
 /**
@@@@ -115,10 +116,10 @@@@ int ecryptfs_interpose(struct dentry *lo
 		d_add(dentry, inode);
 	else
 		d_instantiate(dentry, inode);
-	ecryptfs_copy_attr_all(inode, lower_inode);
+	stackfs_copy_attr_all(inode, lower_inode);
 	/* This size will be overwritten for real files w/ headers and
 	 * other metadata */
-	ecryptfs_copy_inode_size(inode, lower_inode);
+	stackfs_copy_inode_size(inode, lower_inode);
 out:
 	return rc;
 }
@


1.1.2.2
log
@email text for stackfs and stackfs-ecryptfs
@
text
@a0 9
eCryptfs: Use stackfs's generic copy inode attr functions

From: Josef "Jeff" Sipek <jsipek@@cs.sunysb.edu>

Replace eCryptfs specific code & calls with the more generic stackfs
equivalents and remove the eCryptfs specific functions.

Signed-off-by: Josef "Jeff" Sipek <jsipek@@cs.sunysb.edu>

@


1.1.2.3
log
@Andrew's comments about fsstack
@
text
@d10 3
a12 3
diff -r b2cdce81ebad fs/ecryptfs/file.c
--- a/fs/ecryptfs/file.c	Mon Oct 16 19:28:08 2006 -0400
+++ b/fs/ecryptfs/file.c	Mon Oct 16 19:34:28 2006 -0400
d17 1
a17 1
+#include <linux/fs_stack.h>
d26 1
a26 1
+		fsstack_copy_attr_atime(inode, lower_file->f_dentry->d_inode);
d30 3
a32 3
diff -r b2cdce81ebad fs/ecryptfs/inode.c
--- a/fs/ecryptfs/inode.c	Mon Oct 16 19:28:08 2006 -0400
+++ b/fs/ecryptfs/inode.c	Mon Oct 16 19:37:12 2006 -0400
d37 1
a37 1
+#include <linux/fs_stack.h>
d96 2
a97 2
+	fsstack_copy_attr_times(directory_inode, lower_dir_dentry->d_inode);
+	fsstack_copy_inode_size(directory_inode, lower_dir_dentry->d_inode);
d106 1
a106 1
+	fsstack_copy_attr_atime(dir, lower_dir_dentry->d_inode);
d110 1
a110 1
@@@@ -478,7 +437,8 @@@@ static int ecryptfs_link(struct dentry *
d115 1
a115 2
+	fsstack_copy_attr_times(dir, lower_new_dentry->d_inode);
+	fsstack_copy_inode_size(dir, lower_new_dentry->d_inode);
d119 1
a119 1
@@@@ -503,7 +463,7 @@@@ static int ecryptfs_unlink(struct inode 
d124 1
a124 1
+	fsstack_copy_attr_times(dir, lower_dir_inode);
d128 1
a128 1
@@@@ -542,7 +502,8 @@@@ static int ecryptfs_symlink(struct inode
d133 1
a133 2
+	fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
+	fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode);
d137 1
a137 1
@@@@ -565,7 +526,8 @@@@ static int ecryptfs_mkdir(struct inode *
d142 1
a142 2
+	fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
+	fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode);
d146 1
a146 1
@@@@ -601,7 +563,7 @@@@ static int ecryptfs_rmdir(struct inode *
d151 1
a151 1
+	fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
d155 1
a155 1
@@@@ -629,7 +591,8 @@@@ ecryptfs_mknod(struct inode *dir, struct
d160 1
a160 2
+	fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
+	fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode);
d164 1
a164 1
@@@@ -658,9 +621,9 @@@@ ecryptfs_rename(struct inode *old_dir, s
d169 1
a169 1
+	fsstack_copy_attr_all(new_dir, lower_new_dir_dentry->d_inode);
d172 1
a172 1
+		fsstack_copy_attr_all(old_dir, lower_old_dir_dentry->d_inode);
d176 1
a176 1
@@@@ -714,8 +677,8 @@@@ ecryptfs_readlink(struct dentry *dentry,
d182 1
a182 1
+		fsstack_copy_attr_atime(dentry->d_inode,
d187 1
a187 1
@@@@ -945,7 +908,7 @@@@ static int ecryptfs_setattr(struct dentr
d192 1
a192 1
+	fsstack_copy_attr_all(inode, lower_inode);
d196 3
a198 3
diff -r b2cdce81ebad fs/ecryptfs/main.c
--- a/fs/ecryptfs/main.c	Mon Oct 16 19:28:08 2006 -0400
+++ b/fs/ecryptfs/main.c	Mon Oct 16 19:35:06 2006 -0400
d203 1
a203 1
+#include <linux/fs_stack.h>
d212 1
a212 1
+	fsstack_copy_attr_all(inode, lower_inode);
d216 1
a216 1
+	fsstack_copy_inode_size(inode, lower_inode);
@


1.1.2.4
log
@fsstack updates
@
text
@d1 1
a1 1
eCryptfs: Use fsstack's generic copy inode attr functions
d5 1
a5 1
Replace eCryptfs specific code & calls with the more generic fsstack
@


1.1.2.5
log
@fsstack is now in -mm
@
text
@@


