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


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

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

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

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

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

1.1.2.5
date	2006.12.04.08.20.49;	author jsipek;	state Exp;
branches;
next	1.1.2.6;

1.1.2.6
date	2007.01.05.08.33.49;	author jsipek;	state dead;
branches;
next	;


desc
@@


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


1.1.2.1
log
@Move patches already in mm into a subdir
@
text
@a0 232
eCryptfs: Use fsstack's generic copy inode attr functions

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

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

Signed-off-by: Josef "Jeff" Sipek <jsipek@@cs.sunysb.edu>
Cc: Michael Halcrow <mhalcrow@@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@@osdl.org>
---

 fs/ecryptfs/file.c  |    3 +
 fs/ecryptfs/inode.c |   75 ++++++++++--------------------------------
 fs/ecryptfs/main.c  |    5 +-
 3 files changed, 24 insertions(+), 59 deletions(-)

diff -puN fs/ecryptfs/file.c~ecryptfs-use-fsstacks-generic-copy-inode-attr fs/ecryptfs/file.c
--- a/fs/ecryptfs/file.c~ecryptfs-use-fsstacks-generic-copy-inode-attr
+++ a/fs/ecryptfs/file.c
@@@@ -30,6 +30,7 @@@@
 #include <linux/security.h>
 #include <linux/smp_lock.h>
 #include <linux/compat.h>
+#include <linux/fs_stack.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);
+		fsstack_copy_attr_atime(inode, lower_file->f_dentry->d_inode);
 	return rc;
 }
 
diff -puN fs/ecryptfs/inode.c~ecryptfs-use-fsstacks-generic-copy-inode-attr fs/ecryptfs/inode.c
--- a/fs/ecryptfs/inode.c~ecryptfs-use-fsstacks-generic-copy-inode-attr
+++ a/fs/ecryptfs/inode.c
@@@@ -30,6 +30,7 @@@@
 #include <linux/namei.h>
 #include <linux/mount.h>
 #include <linux/crypto.h>
+#include <linux/fs_stack.h>
 #include "ecryptfs_kernel.h"
 
 static struct dentry *lock_parent(struct dentry *dentry)
@@@@ -53,48 +54,6 @@@@ static void unlock_dir(struct dentry *di
 	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;
-}
-
 /**
  * ecryptfs_create_underlying_file
  * @@lower_dir_inode: inode of the parent in the lower fs of the new file
@@@@ -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);
+	fsstack_copy_attr_times(directory_inode, lower_dir_dentry->d_inode);
+	fsstack_copy_inode_size(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);
+	fsstack_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,8 @@@@ 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);
+	fsstack_copy_attr_times(dir, lower_new_dentry->d_inode);
+	fsstack_copy_inode_size(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 +463,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);
+	fsstack_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 +502,8 @@@@ 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);
+	fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
+	fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode);
 out_lock:
 	unlock_dir(lower_dir_dentry);
 	dput(lower_dentry);
@@@@ -565,7 +526,8 @@@@ 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);
+	fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
+	fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode);
 	dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;
 out:
 	unlock_dir(lower_dir_dentry);
@@@@ -601,7 +563,7 @@@@ static int ecryptfs_rmdir(struct inode *
 		d_delete(tlower_dentry);
 		tlower_dentry = NULL;
 	}
-	ecryptfs_copy_attr_times(dir, lower_dir_dentry->d_inode);
+	fsstack_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 +591,8 @@@@ 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);
+	fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
+	fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode);
 out:
 	unlock_dir(lower_dir_dentry);
 	if (!dentry->d_inode)
@@@@ -658,9 +621,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);
+	fsstack_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);
+		fsstack_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 +677,8 @@@@ ecryptfs_readlink(struct dentry *dentry,
 				rc = -EFAULT;
 		}
 		kfree(decoded_name);
-		ecryptfs_copy_attr_atime(dentry->d_inode,
-					 lower_dentry->d_inode);
+		fsstack_copy_attr_atime(dentry->d_inode,
+					lower_dentry->d_inode);
 	}
 out_free_lower_buf:
 	kfree(lower_buf);
@@@@ -945,7 +908,7 @@@@ static int ecryptfs_setattr(struct dentr
 	}
 	rc = notify_change(lower_dentry, ia);
 out:
-	ecryptfs_copy_attr_all(inode, lower_inode);
+	fsstack_copy_attr_all(inode, lower_inode);
 	return rc;
 }
 
diff -puN fs/ecryptfs/main.c~ecryptfs-use-fsstacks-generic-copy-inode-attr fs/ecryptfs/main.c
--- a/fs/ecryptfs/main.c~ecryptfs-use-fsstacks-generic-copy-inode-attr
+++ a/fs/ecryptfs/main.c
@@@@ -35,6 +35,7 @@@@
 #include <linux/pagemap.h>
 #include <linux/key.h>
 #include <linux/parser.h>
+#include <linux/fs_stack.h>
 #include "ecryptfs_kernel.h"
 
 /**
@@@@ -112,10 +113,10 @@@@ int ecryptfs_interpose(struct dentry *lo
 		d_add(dentry, inode);
 	else
 		d_instantiate(dentry, inode);
-	ecryptfs_copy_attr_all(inode, lower_inode);
+	fsstack_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);
+	fsstack_copy_inode_size(inode, lower_inode);
 out:
 	return rc;
 }

@


1.1.2.2
log
@Git generates slightly different diffs - same information, just little
different
@
text
@d11 1
d13 9
a21 5
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index a92ef05..a961a0c 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@@@ -30,6 +30,7 @@@@ #include <linux/pagemap.h>
d38 4
a41 5
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index ff4865d..9af7ed3 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@@@ -30,6 +30,7 @@@@ #include <linux/dcache.h>
d109 1
a109 1
@@@@ -365,7 +324,7 @@@@ static struct dentry *ecryptfs_lookup(st
d118 1
a118 1
@@@@ -462,7 +421,8 @@@@ static int ecryptfs_link(struct dentry *
d128 1
a128 1
@@@@ -487,7 +447,7 @@@@ static int ecryptfs_unlink(struct inode 
d137 1
a137 1
@@@@ -526,7 +486,8 @@@@ static int ecryptfs_symlink(struct inode
d147 1
a147 1
@@@@ -549,7 +510,8 @@@@ static int ecryptfs_mkdir(struct inode *
d157 4
a160 4
@@@@ -572,7 +534,7 @@@@ static int ecryptfs_rmdir(struct inode *
 	dput(lower_dentry);
 	if (!rc)
 		d_delete(lower_dentry);
d166 1
a166 1
@@@@ -596,7 +558,8 @@@@ ecryptfs_mknod(struct inode *dir, struct
d176 1
a176 1
@@@@ -625,9 +588,9 @@@@ ecryptfs_rename(struct inode *old_dir, s
d188 1
a188 1
@@@@ -681,8 +644,8 @@@@ ecryptfs_readlink(struct dentry *dentry,
d199 1
a199 1
@@@@ -912,7 +875,7 @@@@ static int ecryptfs_setattr(struct dentr
d208 4
a211 5
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index a78d87d..5982931 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@@@ -35,6 +35,7 @@@@ #include <linux/dcache.h>
d232 1
@


1.1.2.3
log
@Sync...
@
text
@d14 3
a16 5

diff -r 66fb39aeb6d0 fs/ecryptfs/file.c
--- a/fs/ecryptfs/file.c	Tue Nov 28 02:43:47 2006 -0500
+++ b/fs/ecryptfs/file.c	Tue Nov 28 02:43:47 2006 -0500
@@@@ -30,6 +30,7 @@@@
d33 5
a37 4
diff -r 66fb39aeb6d0 fs/ecryptfs/inode.c
--- a/fs/ecryptfs/inode.c	Tue Nov 28 02:43:47 2006 -0500
+++ b/fs/ecryptfs/inode.c	Tue Nov 28 02:45:29 2006 -0500
@@@@ -30,6 +30,7 @@@@
d45 1
a45 3
@@@@ -51,48 +52,6 @@@@ static void unlock_dir(struct dentry *di
 {
 	mutex_unlock(&dir->d_inode->i_mutex);
d47 2
a48 2
-}
-
d89 2
a90 2
 }
 
d92 2
d105 1
a105 1
@@@@ -372,7 +331,7 @@@@ static struct dentry *ecryptfs_lookup(st
d114 1
a114 1
@@@@ -478,7 +437,8 @@@@ static int ecryptfs_link(struct dentry *
d124 1
a124 1
@@@@ -503,7 +463,7 @@@@ static int ecryptfs_unlink(struct inode 
d133 1
a133 1
@@@@ -542,7 +502,8 @@@@ static int ecryptfs_symlink(struct inode
d143 1
a143 1
@@@@ -565,7 +526,8 @@@@ static int ecryptfs_mkdir(struct inode *
d153 4
a156 4
@@@@ -601,7 +563,7 @@@@ static int ecryptfs_rmdir(struct inode *
 		d_delete(tlower_dentry);
 		tlower_dentry = NULL;
 	}
d162 1
a162 1
@@@@ -629,7 +591,8 @@@@ ecryptfs_mknod(struct inode *dir, struct
d172 1
a172 1
@@@@ -658,9 +621,9 @@@@ ecryptfs_rename(struct inode *old_dir, s
d184 1
a184 1
@@@@ -714,8 +677,8 @@@@ ecryptfs_readlink(struct dentry *dentry,
d195 1
a195 1
@@@@ -945,7 +908,7 @@@@ static int ecryptfs_setattr(struct dentr
d204 5
a208 4
diff -r 66fb39aeb6d0 fs/ecryptfs/main.c
--- a/fs/ecryptfs/main.c	Tue Nov 28 02:43:47 2006 -0500
+++ b/fs/ecryptfs/main.c	Tue Nov 28 02:43:47 2006 -0500
@@@@ -35,6 +35,7 @@@@
@


1.1.2.4
log
@Sync up with Linus's tree
@
text
@d15 3
a17 3
diff -r 16d31a737f67 fs/ecryptfs/file.c
--- a/fs/ecryptfs/file.c	Tue Nov 28 03:03:40 2006 -0500
+++ b/fs/ecryptfs/file.c	Tue Nov 28 03:03:40 2006 -0500
d35 3
a37 3
diff -r 16d31a737f67 fs/ecryptfs/inode.c
--- a/fs/ecryptfs/inode.c	Tue Nov 28 03:03:40 2006 -0500
+++ b/fs/ecryptfs/inode.c	Tue Nov 28 03:04:05 2006 -0500
d106 1
a106 1
@@@@ -365,7 +324,7 @@@@ static struct dentry *ecryptfs_lookup(st
d115 1
a115 1
@@@@ -462,7 +421,8 @@@@ static int ecryptfs_link(struct dentry *
d125 2
a126 2
@@@@ -488,7 +448,7 @@@@ static int ecryptfs_unlink(struct inode 
 		printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc);
d134 1
a134 1
@@@@ -527,7 +487,8 @@@@ static int ecryptfs_symlink(struct inode
d144 1
a144 1
@@@@ -550,7 +511,8 @@@@ static int ecryptfs_mkdir(struct inode *
d154 4
a157 4
@@@@ -573,7 +535,7 @@@@ static int ecryptfs_rmdir(struct inode *
 	dput(lower_dentry);
 	if (!rc)
 		d_delete(lower_dentry);
d163 1
a163 1
@@@@ -597,7 +559,8 @@@@ ecryptfs_mknod(struct inode *dir, struct
d173 1
a173 1
@@@@ -626,9 +589,9 @@@@ ecryptfs_rename(struct inode *old_dir, s
d184 2
a185 2
 	dput(lower_new_dentry->d_parent);
@@@@ -684,8 +647,8 @@@@ ecryptfs_readlink(struct dentry *dentry,
d196 1
a196 1
@@@@ -915,7 +878,7 @@@@ static int ecryptfs_setattr(struct dentr
d205 3
a207 3
diff -r 16d31a737f67 fs/ecryptfs/main.c
--- a/fs/ecryptfs/main.c	Tue Nov 28 03:03:40 2006 -0500
+++ b/fs/ecryptfs/main.c	Tue Nov 28 03:03:40 2006 -0500
@


1.1.2.5
log
@Git cruft removal
@
text
@d12 3
@


1.1.2.6
log
@Removed many patches already in vanilla
@
text
@@


