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


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

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

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

1.1.2.3
date	2006.12.11.14.23.59;	author jsipek;	state dead;
branches;
next	;


desc
@@


1.1
log
@file unionfs-lkml-comments-jan was initially added on branch LKML-branch.
@
text
@@


1.1.2.1
log
@most of lkml comments
@
text
@a0 1018
diff -r cef7052a3112 Documentation/filesystems/unionfs/00-INDEX
--- a/Documentation/filesystems/unionfs/00-INDEX	Mon Dec 04 03:26:06 2006 -0500
+++ b/Documentation/filesystems/unionfs/00-INDEX	Thu Dec 07 23:02:23 2006 -0500
@@@@ -5,4 +5,4 @@@@ rename.txt
 rename.txt
 	- Information regarding rename operations
 usage.txt
-	- Usage & known limitations
+	- Usage and known limitations
diff -r cef7052a3112 Documentation/filesystems/unionfs/concepts.txt
--- a/Documentation/filesystems/unionfs/concepts.txt	Mon Dec 04 03:26:06 2006 -0500
+++ b/Documentation/filesystems/unionfs/concepts.txt	Thu Dec 07 23:06:04 2006 -0500
@@@@ -1,10 +1,11 @@@@ This file describes the concepts needed 
-This file describes the concepts needed by a namespace unification file system.
+This file describes the concepts needed by a namespace unification file
+system.
 
 Branch Priority:
 ================
 
-Each branch is assigned a unique priority - starting from 0 (highest priority).
-No two branches can have the same priority.
+Each branch is assigned a unique priority - starting from 0 (highest
+priority).  No two branches can have the same priority.
 
 
 Branch Mode:
@@@@ -20,8 +21,8 @@@@ A whiteout removes a file name from the 
 A whiteout removes a file name from the namespace. Whiteouts are needed when
 one attempts to remove a file on a read-only branch.
 
-Suppose we have a two-branch union, where branch 0 is read-write and branch 1
-is read-only. And a file 'foo' on branch 1:
+Suppose we have a two-branch union, where branch 0 is read-write and branch
+1 is read-only. And a file 'foo' on branch 1:
 
 ./b0/
 ./b1/
@@@@ -32,28 +33,29 @@@@ The unified view would simply be:
 ./union/
 ./union/foo
 
-Since 'foo' is stored on a read-only branch, it cannot be removed. A whiteout
-is used to remove the name 'foo' from the unified namespace. Again, since
-branch 1 is read-only, the whiteout cannot be created there. So, we try on a
-higher priority (lower numerically) branch. And there we create the whiteout.
+Since 'foo' is stored on a read-only branch, it cannot be removed. A
+whiteout is used to remove the name 'foo' from the unified namespace. Again,
+since branch 1 is read-only, the whiteout cannot be created there. So, we
+try on a higher priority (lower numerically) branch and create the whiteout
+there.
 
 ./b0/
 ./b0/.wh.foo
 ./b1/
 ./b1/foo
 
-Later, when Unionfs traverses branches (due to lookup or readdir), it eliminate
-'foo' from the namespace (as well as the whiteout itself.)
+Later, when Unionfs traverses branches (due to lookup or readdir), it
+eliminate 'foo' from the namespace (as well as the whiteout itself.)
 
 
 Duplicate Elimination:
 ======================
 
-It is possible for files on different branches to have the same name. Unionfs
-then has to select which instance of the file to show to the user. Given the
-fact that each branch has a priority associated with it, the simplest
-solution is to take the instance from the highest priority (lowest numerical
-value) and "hide" the others.
+It is possible for files on different branches to have the same name.
+Unionfs then has to select which instance of the file to show to the user.
+Given the fact that each branch has a priority associated with it, the
+simplest solution is to take the instance from the highest priority
+(numerically lowest value) and "hide" the others.
 
 
 Copyup:
@@@@ -63,6 +65,6 @@@@ have to be stored somewhere. The best wa
 have to be stored somewhere. The best way is to create a copy of the
 original file on a branch that is writable, and then redirect the write
 though to this copy. The copy must be made on a higher priority branch so
-that lookup & readdir return this newer "version" of the file rather than
+that lookup and readdir return this newer "version" of the file rather than
 the original (see duplicate elimination).
 
diff -r cef7052a3112 Documentation/filesystems/unionfs/usage.txt
--- a/Documentation/filesystems/unionfs/usage.txt	Mon Dec 04 03:26:06 2006 -0500
+++ b/Documentation/filesystems/unionfs/usage.txt	Thu Dec 07 23:10:06 2006 -0500
@@@@ -1,21 +1,22 @@@@ Unionfs is a stackable unification file 
-Unionfs is a stackable unification file system, which can appear to merge the
-contents of several directories (branches), while keeping their physical
-content separate. Unionfs is useful for unified source tree management, merged
-contents of split CD-ROM, merged separate software package directories, data
-grids, and more. Unionfs allows any mix of read-only and read-write branches,
-as well as insertion and deletion of branches anywhere in the fan-out. To
-maintain unix semantics, Unionfs handles elimination of duplicates,
-partial-error conditions, and more.
+Unionfs is a stackable unification file system, which can appear to merge
+the contents of several directories (branches), while keeping their physical
+content separate. Unionfs is useful for unified source tree management,
+merged contents of split CD-ROM, merged separate software package
+directories, data grids, and more. Unionfs allows any mix of read-only and
+read-write branches, as well as insertion and deletion of branches anywhere
+in the fan-out. To maintain unix semantics, Unionfs handles elimination of
+duplicates, partial-error conditions, and more.
 
 mount -t unionfs -o branch-option[,union-options[,...]] none MOUNTPOINT
 
 The available branch-option for the mount command is:
 
 dirs=branch[=ro|=rw][:...]
-specifies a separated list of which directories compose the union.  Directories
-that come earlier in the list have a higher precedence than those which come
-later. Additionally, read-only or read-write permissions of the branch can be
-specified by appending =ro or =rw (default) to each directory.
+specifies a separated list of which directories compose the union.
+Directories that come earlier in the list have a higher precedence than
+those which come later. Additionally, read-only or read-write permissions of
+the branch can be specified by appending =ro or =rw (default) to each
+directory.
 
 Syntax:
 dirs=/branch1[=ro|=rw]:/branch2[=ro|=rw]:...:/branchN[=ro|=rw]
@@@@ -27,15 +28,15 @@@@ KNOWN ISSUES:
 KNOWN ISSUES:
 =============
 
-The NFS server returns -EACCES for read-only exports, instead of -EROFS.  This
-means we can't reliably detect a read-only NFS export.
+The NFS server returns -EACCES for read-only exports, instead of -EROFS.
+This means we can't reliably detect a read-only NFS export.
 
-Modifying a Unionfs branch directly, while the union is mounted is currently
-unsupported.  Any such change can cause Unionfs to oops, however it could even
-RESULT IN DATA LOSS.
+Modifying a Unionfs branch directly, while the union is mounted, is
+currently unsupported.  Any such change can cause Unionfs to oops, or stay
+silent and even RESULT IN DATA LOSS.
 
-Unionfs shouldn't use lookup_one_len on the underlying fs as it confuses
-NFS. Currently, unionfs_lookup passes lookup intents to the lower
+Unionfs should not use lookup_one_len() on the underlying fs as it confuses
+NFS. Currently, unionfs_lookup() passes lookup intents to the lower
 filesystem, this eliminates part of the problem. The remaining calls to
 lookup_one_len may need to be changed to pass an intent.
 
diff -r cef7052a3112 fs/namei.c
--- a/fs/namei.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/namei.c	Thu Dec 07 23:10:51 2006 -0500
@@@@ -1290,7 +1290,7 @@@@ static struct dentry *lookup_hash(struct
 	return __lookup_hash(&nd->last, nd->dentry, nd);
 }
 
-struct dentry * lookup_one_len_nd(const char *name, struct dentry * base,
+struct dentry *lookup_one_len_nd(const char *name, struct dentry *base,
 				  int len, struct nameidata *nd)
 {
 	unsigned long hash;
diff -r cef7052a3112 fs/unionfs/copyup.c
--- a/fs/unionfs/copyup.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/copyup.c	Fri Dec 08 00:30:35 2006 -0500
@@@@ -36,13 +36,13 @@@@ static int copyup_xattrs(struct dentry *
 		goto out;
 	}
 
-	name_list = xattr_alloc(list_size + 1, XATTR_LIST_MAX);
+	name_list = unionfs_xattr_alloc(list_size + 1, XATTR_LIST_MAX);
 	if (!name_list || IS_ERR(name_list)) {
 		err = PTR_ERR(name_list);
 		goto out;
 	}
 	list_size = vfs_listxattr(old_hidden_dentry, name_list, list_size);
-	attr_value = xattr_alloc(XATTR_SIZE_MAX, XATTR_SIZE_MAX);
+	attr_value = unionfs_xattr_alloc(XATTR_SIZE_MAX, XATTR_SIZE_MAX);
 	if (!attr_value || IS_ERR(attr_value)) {
 		err = PTR_ERR(name_list);
 		goto out;
@@@@ -51,7 +51,7 @@@@ static int copyup_xattrs(struct dentry *
 	while (*name_list) {
 		ssize_t size;
 
-		//We need to lock here since vfs_getxattr doesn't lock for us.
+		/* lock here since vfs_getxattr doesn't lock for us */
 		mutex_lock(&old_hidden_dentry->d_inode->i_mutex);
 		size = vfs_getxattr(old_hidden_dentry, name_list,
 				    attr_value, XATTR_SIZE_MAX);
@@@@ -65,7 +65,7 @@@@ static int copyup_xattrs(struct dentry *
 			err = -E2BIG;
 			goto out;
 		}
-		//We don't need to lock here since vfs_setxattr does it for us.
+		/* we don't need to lock here - vfs_setxattr does it for us */
 		err = vfs_setxattr(new_hidden_dentry, name_list, attr_value,
 				   size, 0);
 
@@@@ -77,9 +77,9 @@@@ static int copyup_xattrs(struct dentry *
 	name_list = name_list_orig;
 
 	if (name_list)
-		xattr_free(name_list, list_size + 1);
+		unionfs_xattr_free(name_list, list_size + 1);
 	if (attr_value)
-		xattr_free(attr_value, XATTR_SIZE_MAX);
+		unionfs_xattr_free(attr_value, XATTR_SIZE_MAX);
 	/* It is no big deal if this fails, we just roll with the punches. */
 	if (err == -ENOTSUPP || err == -EOPNOTSUPP)
 		err = 0;
@@@@ -153,10 +153,8 @@@@ static inline int __copyup_ndentry(struc
 
 		run_sioq(__unionfs_symlink, &args);
 		err = args.err;
-	} else if (S_ISBLK(old_mode)
-		   || S_ISCHR(old_mode)
-		   || S_ISFIFO(old_mode)
-		   || S_ISSOCK(old_mode)) {
+	} else if (S_ISBLK(old_mode) || S_ISCHR(old_mode) ||
+		   S_ISFIFO(old_mode) || S_ISSOCK(old_mode)) {
 		args.mknod.parent = new_hidden_parent_dentry->d_inode;
 		args.mknod.dentry = new_hidden_dentry;
 		args.mknod.mode = old_mode;
@@@@ -202,7 +200,8 @@@@ static inline int __copyup_reg_data(stru
 	mntget(unionfs_lower_mnt_idx(dentry, old_bindex));
 	branchget(sb, old_bindex);
 	input_file = dentry_open(old_hidden_dentry,
-			unionfs_lower_mnt_idx(dentry, old_bindex), O_RDONLY | O_LARGEFILE);
+				unionfs_lower_mnt_idx(dentry, old_bindex),
+				O_RDONLY | O_LARGEFILE);
 	if (IS_ERR(input_file)) {
 		dput(old_hidden_dentry);
 		err = PTR_ERR(input_file);
@@@@ -218,7 +217,8 @@@@ static inline int __copyup_reg_data(stru
 	mntget(unionfs_lower_mnt_idx(dentry, new_bindex));
 	branchget(sb, new_bindex);
 	output_file = dentry_open(new_hidden_dentry,
-			unionfs_lower_mnt_idx(dentry, new_bindex), O_WRONLY | O_LARGEFILE);
+				unionfs_lower_mnt_idx(dentry, new_bindex),
+				O_WRONLY | O_LARGEFILE);
 	if (IS_ERR(output_file)) {
 		err = PTR_ERR(output_file);
 		goto out_close_in2;
@@@@ -265,7 +265,7 @@@@ static inline int __copyup_reg_data(stru
 					     (char __user *)buf,
 					     read_bytes,
 					     &output_file->f_pos);
-		if (write_bytes < 0 || (write_bytes < read_bytes)) {
+		if ((write_bytes < 0) || (write_bytes < read_bytes)) {
 			err = write_bytes;
 			break;
 		}
@@@@ -438,7 +438,13 @@@@ out_unlink:
 		branchput(sb, new_bindex);
 	}
 
-	/* TODO: should we reset the error to something like -EIO? */
+	/*
+	 * TODO: should we reset the error to something like -EIO?
+	 *
+	 * If we don't reset, the user may get some non-sensical errors, but
+	 * on the other hand, if we reset to EIO, we guarantee that the user
+	 * will get a "confusing" error message.
+	 */
 
 out_unlock:
 	unlock_dir(new_hidden_parent_dentry);
diff -r cef7052a3112 fs/unionfs/dentry.c
--- a/fs/unionfs/dentry.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/dentry.c	Thu Dec 07 23:46:33 2006 -0500
@@@@ -230,7 +230,7 @@@@ out:
 }
 
 struct dentry_operations unionfs_dops = {
-	.d_revalidate = unionfs_d_revalidate_wrap,
-	.d_release = unionfs_d_release,
+	.d_revalidate	= unionfs_d_revalidate_wrap,
+	.d_release	= unionfs_d_release,
 };
 
diff -r cef7052a3112 fs/unionfs/dirfops.c
--- a/fs/unionfs/dirfops.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/dirfops.c	Thu Dec 07 23:57:49 2006 -0500
@@@@ -184,9 +184,7 @@@@ out:
  * What is allowed:
  *  (1) seeking to the same position that you are currently at
  *	This really has no effect, but returns where you are.
- *  (2) seeking to the end of the file, if you've read everything
- *	This really has no effect, but returns where you are.
- *  (3) seeking to the beginning of the file
+ *  (2) seeking to the beginning of the file
  *	This throws out all state, and lets you begin again.
  */
 static loff_t unionfs_dir_llseek(struct file *file, loff_t offset, int origin)
@@@@ -253,12 +251,12 @@@@ out:
  * we don't want to operate on partial directories.
  */
 struct file_operations unionfs_dir_fops = {
-	.llseek =		unionfs_dir_llseek,
-	.read =			generic_read_dir,
-	.readdir =		unionfs_readdir,
-	.unlocked_ioctl =	unionfs_ioctl,
-	.open =			unionfs_open,
-	.release =		unionfs_file_release,
-	.flush =		unionfs_flush,
+	.llseek		= unionfs_dir_llseek,
+	.read		= generic_read_dir,
+	.readdir	= unionfs_readdir,
+	.unlocked_ioctl	= unionfs_ioctl,
+	.open		= unionfs_open,
+	.release	= unionfs_file_release,
+	.flush		= unionfs_flush,
 };
 
diff -r cef7052a3112 fs/unionfs/fanout.h
--- a/fs/unionfs/fanout.h	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/fanout.h	Fri Dec 08 00:20:57 2006 -0500
@@@@ -30,7 +30,7 @@@@ static inline struct unionfs_inode_info 
 /* Superblock to private data */
 #define UNIONFS_SB(super) ((struct unionfs_sb_info *)(super)->s_fs_info)
 #define sbstart(sb) 0
-#define sbend(sb) UNIONFS_SB(sb)->bend
+#define sbend(sb) (UNIONFS_SB(sb)->bend)
 #define sbmax(sb) (UNIONFS_SB(sb)->bend + 1)
 
 /* File to private Data */
@@@@ -39,7 +39,7 @@@@ static inline struct unionfs_inode_info 
 #define fbend(file) (UNIONFS_F(file)->bend)
 
 /* File to lower file. */
-static inline struct file *unionfs_lower_file(struct file *f)
+static inline struct file *unionfs_lower_file(const struct file *f)
 {
 	return UNIONFS_F(f)->lower_files[fbstart(f)];
 }
@@@@ -104,7 +104,7 @@@@ static inline void unionfs_set_lower_sup
 }
 
 /* Branch count macros. */
-static inline int branch_count(struct super_block *sb, int index)
+static inline int branch_count(const struct super_block *sb, int index)
 {
 	return atomic_read(&UNIONFS_SB(sb)->data[index].sbcount);
 }
diff -r cef7052a3112 fs/unionfs/file.c
--- a/fs/unionfs/file.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/file.c	Thu Dec 07 23:44:52 2006 -0500
@@@@ -242,17 +242,17 @@@@ out:
 }
 
 struct file_operations unionfs_main_fops = {
-	.llseek = unionfs_llseek,
-	.read = unionfs_read,
-	.write = unionfs_write,
-	.readdir = unionfs_file_readdir,
-	.poll = unionfs_poll,
-	.unlocked_ioctl = unionfs_ioctl,
-	.mmap = unionfs_mmap,
-	.open = unionfs_open,
-	.flush = unionfs_flush,
-	.release = unionfs_file_release,
-	.fsync = unionfs_fsync,
-	.fasync = unionfs_fasync,
+	.llseek		= unionfs_llseek,
+	.read		= unionfs_read,
+	.write		= unionfs_write,
+	.readdir	= unionfs_file_readdir,
+	.poll		= unionfs_poll,
+	.unlocked_ioctl	= unionfs_ioctl,
+	.mmap		= unionfs_mmap,
+	.open		= unionfs_open,
+	.flush		= unionfs_flush,
+	.release	= unionfs_file_release,
+	.fsync		= unionfs_fsync,
+	.fasync		= unionfs_fasync,
 };
 
diff -r cef7052a3112 fs/unionfs/inode.c
--- a/fs/unionfs/inode.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/inode.c	Thu Dec 07 23:48:10 2006 -0500
@@@@ -898,41 +898,41 @@@@ out:
 }
 
 struct inode_operations unionfs_symlink_iops = {
-	.readlink = unionfs_readlink,
-	.permission = unionfs_permission,
-	.follow_link = unionfs_follow_link,
-	.setattr = unionfs_setattr,
-	.put_link = unionfs_put_link,
+	.readlink	= unionfs_readlink,
+	.permission	= unionfs_permission,
+	.follow_link	= unionfs_follow_link,
+	.setattr	= unionfs_setattr,
+	.put_link	= unionfs_put_link,
 };
 
 struct inode_operations unionfs_dir_iops = {
-	.create = unionfs_create,
-	.lookup = unionfs_lookup,
-	.link = unionfs_link,
-	.unlink = unionfs_unlink,
-	.symlink = unionfs_symlink,
-	.mkdir = unionfs_mkdir,
-	.rmdir = unionfs_rmdir,
-	.mknod = unionfs_mknod,
-	.rename = unionfs_rename,
-	.permission = unionfs_permission,
-	.setattr = unionfs_setattr,
+	.create		= unionfs_create,
+	.lookup		= unionfs_lookup,
+	.link		= unionfs_link,
+	.unlink		= unionfs_unlink,
+	.symlink	= unionfs_symlink,
+	.mkdir		= unionfs_mkdir,
+	.rmdir		= unionfs_rmdir,
+	.mknod		= unionfs_mknod,
+	.rename		= unionfs_rename,
+	.permission	= unionfs_permission,
+	.setattr	= unionfs_setattr,
 #ifdef CONFIG_UNION_FS_XATTR
-	.setxattr = unionfs_setxattr,
-	.getxattr = unionfs_getxattr,
-	.removexattr = unionfs_removexattr,
-	.listxattr = unionfs_listxattr,
+	.setxattr	= unionfs_setxattr,
+	.getxattr	= unionfs_getxattr,
+	.removexattr	= unionfs_removexattr,
+	.listxattr	= unionfs_listxattr,
 #endif
 };
 
 struct inode_operations unionfs_main_iops = {
-	.permission = unionfs_permission,
-	.setattr = unionfs_setattr,
+	.permission	= unionfs_permission,
+	.setattr	= unionfs_setattr,
 #ifdef CONFIG_UNION_FS_XATTR
-	.setxattr = unionfs_setxattr,
-	.getxattr = unionfs_getxattr,
-	.removexattr = unionfs_removexattr,
-	.listxattr = unionfs_listxattr,
+	.setxattr	= unionfs_setxattr,
+	.getxattr	= unionfs_getxattr,
+	.removexattr	= unionfs_removexattr,
+	.listxattr	= unionfs_listxattr,
 #endif
 };
 
diff -r cef7052a3112 fs/unionfs/lookup.c
--- a/fs/unionfs/lookup.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/lookup.c	Fri Dec 08 00:18:02 2006 -0500
@@@@ -363,7 +363,7 @@@@ static int is_opaque_dir(struct dentry *
 		wh_hidden_dentry = lookup_one_len(UNIONFS_DIR_OPAQUE, hidden_dentry,
 					sizeof(UNIONFS_DIR_OPAQUE) - 1);
 	else {
-		args.isopaque.dentry = hidden_dentry;
+		args.is_opaque.dentry = hidden_dentry;
 		run_sioq(__is_opaque_dir, &args);
 		wh_hidden_dentry = args.ret;
 	}
@@@@ -396,7 +396,7 @@@@ static int is_validname(const char *name
 
 /* The dentry cache is just so we have properly sized dentries. */
 static struct kmem_cache *unionfs_dentry_cachep;
-int init_dentry_cache(void)
+int unionfs_init_dentry_cache(void)
 {
 	unionfs_dentry_cachep = kmem_cache_create("unionfs_dentry",
 					sizeof(struct unionfs_dentry_info), 0,
@@@@ -405,7 +405,7 @@@@ int init_dentry_cache(void)
 	return (unionfs_dentry_cachep ? 0 : -ENOMEM);
 }
 
-void destroy_dentry_cache(void)
+void unionfs_destroy_dentry_cache(void)
 {
 	if (unionfs_dentry_cachep)
 		kmem_cache_destroy(unionfs_dentry_cachep);
diff -r cef7052a3112 fs/unionfs/main.c
--- a/fs/unionfs/main.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/main.c	Fri Dec 08 00:03:51 2006 -0500
@@@@ -630,46 +630,43 @@@@ static int unionfs_get_sb(struct file_sy
 }
 
 static struct file_system_type unionfs_fs_type = {
-	.owner = THIS_MODULE,
-	.name = "unionfs",
-	.get_sb = unionfs_get_sb,
-	.kill_sb = generic_shutdown_super,
-	.fs_flags = FS_REVAL_DOT,
+	.owner		= THIS_MODULE,
+	.name		= "unionfs",
+	.get_sb		= unionfs_get_sb,
+	.kill_sb	= generic_shutdown_super,
+	.fs_flags	= FS_REVAL_DOT,
 };
-
-static int init_debug = 0;
-module_param_named(debug, init_debug, int, S_IRUGO);
-MODULE_PARM_DESC(debug, "Initial Unionfs debug value.");
 
 static int __init init_unionfs_fs(void)
 {
 	int err;
 	printk("Registering unionfs " UNIONFS_VERSION "\n");
 
-	if ((err = init_filldir_cache()))
-		goto out;
-	if ((err = init_inode_cache()))
-		goto out;
-	if ((err = init_dentry_cache()))
+	if ((err = unionfs_init_filldir_cache()))
+		goto out;
+	if ((err = unionfs_init_inode_cache()))
+		goto out;
+	if ((err = unionfs_init_dentry_cache()))
 		goto out;
 	if ((err = init_sioq()))
 		goto out;
 	err = register_filesystem(&unionfs_fs_type);
 out:
 	if (err) {
-		fin_sioq();
-		destroy_filldir_cache();
-		destroy_inode_cache();
-		destroy_dentry_cache();
+		stop_sioq();
+		unionfs_destroy_filldir_cache();
+		unionfs_destroy_inode_cache();
+		unionfs_destroy_dentry_cache();
 	}
 	return err;
 }
+
 static void __exit exit_unionfs_fs(void)
 {
-	fin_sioq();
-	destroy_filldir_cache();
-	destroy_inode_cache();
-	destroy_dentry_cache();
+	stop_sioq();
+	unionfs_destroy_filldir_cache();
+	unionfs_destroy_inode_cache();
+	unionfs_destroy_dentry_cache();
 	unregister_filesystem(&unionfs_fs_type);
 	printk("Completed unionfs module unload.\n");
 }
diff -r cef7052a3112 fs/unionfs/rdstate.c
--- a/fs/unionfs/rdstate.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/rdstate.c	Fri Dec 08 00:18:16 2006 -0500
@@@@ -27,7 +27,7 @@@@
  * (as defined by the dentry structure), then we use an inline name to
  * preserve kmalloc space. */
 static struct kmem_cache *unionfs_filldir_cachep;
-int init_filldir_cache(void)
+int unionfs_init_filldir_cache(void)
 {
 	unionfs_filldir_cachep =
 	    kmem_cache_create("unionfs_filldir", sizeof(struct filldir_node), 0,
@@@@ -36,7 +36,7 @@@@ int init_filldir_cache(void)
 	return (unionfs_filldir_cachep ? 0 : -ENOMEM);
 }
 
-void destroy_filldir_cache(void)
+void unionfs_destroy_filldir_cache(void)
 {
 	if (unionfs_filldir_cachep)
 		kmem_cache_destroy(unionfs_filldir_cachep);
diff -r cef7052a3112 fs/unionfs/sioq.c
--- a/fs/unionfs/sioq.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/sioq.c	Wed Dec 06 12:27:23 2006 -0500
@@@@ -18,6 +18,12 @@@@
 
 #include "union.h"
 
+/* Super-user IO work Queue - sometimes we need to perform actions which
+ * would fail due to the unix permissions on the parent directory (e.g.,
+ * rmdir a directory which appears empty, but in reality contains
+ * whiteouts).
+ */
+
 struct workqueue_struct *sioq;
 
 int __init init_sioq(void)
@@@@ -34,7 +40,7 @@@@ int __init init_sioq(void)
 	return err;
 }
 
-void fin_sioq(void)
+void __exit stop_sioq(void)
 {
 	if (sioq)
 		destroy_workqueue(sioq);
@@@@ -78,6 +84,7 @@@@ void __unionfs_mknod(void *data)
 	args->err = vfs_mknod(m->parent, m->dentry, m->mode, m->dev);
 	complete(&args->comp);
 }
+
 void __unionfs_symlink(void *data)
 {
 	struct sioq_args *args = data;
@@@@ -108,7 +115,7 @@@@ void __is_opaque_dir(void *data)
 {
 	struct sioq_args *args = data;
 
-	args->ret = lookup_one_len(UNIONFS_DIR_OPAQUE, args->isopaque.dentry,
+	args->ret = lookup_one_len(UNIONFS_DIR_OPAQUE, args->is_opaque.dentry,
 				sizeof(UNIONFS_DIR_OPAQUE) - 1);
 	complete(&args->comp);
 }
diff -r cef7052a3112 fs/unionfs/sioq.h
--- a/fs/unionfs/sioq.h	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/sioq.h	Wed Dec 06 12:29:01 2006 -0500
@@@@ -7,7 +7,7 @@@@ struct deletewh_args {
 	int bindex;
 };
 
-struct isopaque_args {
+struct is_opaque_args {
 	struct dentry *dentry;
 };
 
@@@@ -52,7 +52,7 @@@@ struct sioq_args {
 
 	union {
 		struct deletewh_args deletewh;
-		struct isopaque_args isopaque;
+		struct is_opaque_args is_opaque;
 		struct create_args create;
 		struct mkdir_args mkdir;
 		struct mknod_args mknod;
@@@@ -62,11 +62,11 @@@@ struct sioq_args {
 };
 
 extern struct workqueue_struct *sioq;
-int __init init_sioq(void);
-extern void fin_sioq(void);
+extern int __init init_sioq(void);
+extern __exit void stop_sioq(void);
 extern void run_sioq(void (*func)(void *arg), struct sioq_args *args);
 
-/* Extern definitions for our privledge escalation helpers */
+/* Extern definitions for our privlege escalation helpers */
 extern void __unionfs_create(void *data);
 extern void __unionfs_mkdir(void *data);
 extern void __unionfs_mknod(void *data);
diff -r cef7052a3112 fs/unionfs/stale_inode.c
--- a/fs/unionfs/stale_inode.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/stale_inode.c	Thu Dec 07 23:51:26 2006 -0500
@@@@ -36,35 +36,35 @@@@ static int return_ESTALE(void)
 #define ESTALE_ERROR ((void *) (return_ESTALE))
 
 static struct file_operations stale_file_ops = {
-	.llseek = ESTALE_ERROR,
-	.read = ESTALE_ERROR,
-	.write = ESTALE_ERROR,
-	.readdir = ESTALE_ERROR,
-	.poll = ESTALE_ERROR,
-	.ioctl = ESTALE_ERROR,
-	.mmap = ESTALE_ERROR,
-	.open = ESTALE_ERROR,
-	.flush = ESTALE_ERROR,
-	.release = ESTALE_ERROR,
-	.fsync = ESTALE_ERROR,
-	.fasync = ESTALE_ERROR,
-	.lock = ESTALE_ERROR,
+	.llseek		= ESTALE_ERROR,
+	.read		= ESTALE_ERROR,
+	.write		= ESTALE_ERROR,
+	.readdir	= ESTALE_ERROR,
+	.poll		= ESTALE_ERROR,
+	.ioctl		= ESTALE_ERROR,
+	.mmap		= ESTALE_ERROR,
+	.open		= ESTALE_ERROR,
+	.flush		= ESTALE_ERROR,
+	.release	= ESTALE_ERROR,
+	.fsync		= ESTALE_ERROR,
+	.fasync		= ESTALE_ERROR,
+	.lock		= ESTALE_ERROR,
 };
 
 struct inode_operations stale_inode_ops = {
-	.create = ESTALE_ERROR,
-	.lookup = ESTALE_ERROR,
-	.link = ESTALE_ERROR,
-	.unlink = ESTALE_ERROR,
-	.symlink = ESTALE_ERROR,
-	.mkdir = ESTALE_ERROR,
-	.rmdir = ESTALE_ERROR,
-	.mknod = ESTALE_ERROR,
-	.rename = ESTALE_ERROR,
-	.readlink = ESTALE_ERROR,
-	.follow_link = stale_follow_link,
-	.truncate = ESTALE_ERROR,
-	.permission = ESTALE_ERROR,
+	.create		= ESTALE_ERROR,
+	.lookup		= ESTALE_ERROR,
+	.link		= ESTALE_ERROR,
+	.unlink		= ESTALE_ERROR,
+	.symlink	= ESTALE_ERROR,
+	.mkdir		= ESTALE_ERROR,
+	.rmdir		= ESTALE_ERROR,
+	.mknod		= ESTALE_ERROR,
+	.rename		= ESTALE_ERROR,
+	.readlink	= ESTALE_ERROR,
+	.follow_link	= stale_follow_link,
+	.truncate	= ESTALE_ERROR,
+	.permission	= ESTALE_ERROR,
 };
 
 /*
diff -r cef7052a3112 fs/unionfs/super.c
--- a/fs/unionfs/super.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/super.c	Fri Dec 08 00:02:47 2006 -0500
@@@@ -210,7 +210,7 @@@@ static void init_once(void *v, struct km
 		inode_init_once(&i->vfs_inode);
 }
 
-int init_inode_cache(void)
+int unionfs_init_inode_cache(void)
 {
 	int err = 0;
 
@@@@ -223,7 +223,7 @@@@ int init_inode_cache(void)
 	return err;
 }
 
-void destroy_inode_cache(void)
+void unionfs_destroy_inode_cache(void)
 {
 	if (unionfs_inode_cachep)
 		kmem_cache_destroy(unionfs_inode_cachep);
@@@@ -326,17 +326,17 @@@@ out:
 }
 
 struct super_operations unionfs_sops = {
-	.read_inode = unionfs_read_inode,
-	.put_inode = unionfs_put_inode,
-	.delete_inode = unionfs_delete_inode,
-	.put_super = unionfs_put_super,
-	.statfs = unionfs_statfs,
-	.remount_fs = unionfs_remount_fs,
-	.clear_inode = unionfs_clear_inode,
-	.umount_begin = unionfs_umount_begin,
-	.show_options = unionfs_show_options,
-	.write_inode = unionfs_write_inode,
-	.alloc_inode = unionfs_alloc_inode,
-	.destroy_inode = unionfs_destroy_inode,
+	.read_inode	= unionfs_read_inode,
+	.put_inode	= unionfs_put_inode,
+	.delete_inode	= unionfs_delete_inode,
+	.put_super	= unionfs_put_super,
+	.statfs		= unionfs_statfs,
+	.remount_fs	= unionfs_remount_fs,
+	.clear_inode	= unionfs_clear_inode,
+	.umount_begin	= unionfs_umount_begin,
+	.show_options	= unionfs_show_options,
+	.write_inode	= unionfs_write_inode,
+	.alloc_inode	= unionfs_alloc_inode,
+	.destroy_inode	= unionfs_destroy_inode,
 };
 
diff -r cef7052a3112 fs/unionfs/union.h
--- a/fs/unionfs/union.h	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/union.h	Fri Dec 08 00:28:37 2006 -0500
@@@@ -18,8 +18,6 @@@@
 #ifndef _UNION_H_
 #define _UNION_H_
 
-#include <asm/mman.h>
-#include <asm/system.h>
 #include <linux/dcache.h>
 #include <linux/file.h>
 #include <linux/list.h>
@@@@ -42,13 +40,15 @@@@
 #include <linux/writeback.h>
 #include <linux/xattr.h>
 #include <linux/fs_stack.h>
+#include <linux/magic.h>
+
+#include <asm/mman.h>
+#include <asm/system.h>
 
 #include <linux/union_fs.h>
+
 /* the file system name */
 #define UNIONFS_NAME "unionfs"
-
-/* unionfs file systems superblock magic */
-#define UNIONFS_SUPER_MAGIC 0xf15f083d
 
 /* unionfs root inode number */
 #define UNIONFS_ROOT_INO     1
@@@@ -72,7 +72,7 @@@@ extern struct dentry_operations unionfs_
 extern struct dentry_operations unionfs_dops;
 
 /* How long should an entry be allowed to persist */
-#define RDCACHE_JIFFIES 5*HZ
+#define RDCACHE_JIFFIES	(5*HZ)
 
 /* file private data. */
 struct unionfs_file_info {
@@@@ -109,7 +109,8 @@@@ struct unionfs_dentry_info {
 struct unionfs_dentry_info {
 	/* The semaphore is used to lock the dentry as soon as we get into a
 	 * unionfs function from the VFS.  Our lock ordering is that children
-	 * go before their parents. */
+	 * go before their parents.
+	 */
 	struct semaphore sem;
 	int bstart;
 	int bend;
@@@@ -147,9 +148,17 @@@@ struct filldir_node {
 	char *name;		/* name entry */
 	int hash;		/* name hash */
 	int namelen;		/* name len since name is not 0 terminated */
-	int bindex;		/* we can check for duplicate whiteouts and files in the same branch in order to return -EIO. */
-	int whiteout;		/* is this a whiteout entry? */
-	char iname[DNAME_INLINE_LEN_MIN];	/* Inline name, so we don't need to separately kmalloc small ones */
+
+	/* we can check for duplicate whiteouts and files in the same branch
+	 * in order to return -EIO.
+	 */ 
+	int bindex;		
+
+	/* is this a whiteout entry? */
+	int whiteout;
+
+	/* Inline name, so we don't need to separately kmalloc small ones */
+	char iname[DNAME_INLINE_LEN_MIN];
 };
 
 /* Directory hash table. */
@@@@ -171,12 +180,12 @@@@ struct unionfs_dir_state {
 #include "sioq.h"
 
 /* Cache creation/deletion routines. */
-void destroy_filldir_cache(void);
-int init_filldir_cache(void);
-int init_inode_cache(void);
-void destroy_inode_cache(void);
-int init_dentry_cache(void);
-void destroy_dentry_cache(void);
+void unionfs_destroy_filldir_cache(void);
+int unionfs_init_filldir_cache(void);
+int unionfs_init_inode_cache(void);
+void unionfs_destroy_inode_cache(void);
+int unionfs_init_dentry_cache(void);
+void unionfs_destroy_dentry_cache(void);
 
 /* Initialize and free readdir-specific  state. */
 int init_rdstate(struct file *file);
@@@@ -209,8 +218,6 @@@@ static inline off_t rdstate2offset(struc
 #define unionfs_write_lock(sb) down_write(&UNIONFS_SB(sb)->rwsem)
 #define unionfs_write_unlock(sb) up_write(&UNIONFS_SB(sb)->rwsem)
 
-/* The double lock function needs to go after the debugmacros, so that
- * dtopd is defined.  */
 static inline void double_lock_dentry(struct dentry *d1, struct dentry *d2)
 {
 	if (d2 < d1) {
@@@@ -242,7 +249,7 @@@@ extern int unionfs_partial_lookup(struct
 extern int unionfs_partial_lookup(struct dentry *dentry);
 
 /* Pass an unionfs dentry and an index and it will try to create a whiteout in branch 'index'.
-   On error, it will proceed to a branch to the left */
+ * On error, it will proceed to a branch to the left */
 extern int create_whiteout(struct dentry *dentry, int start);
 /* copies a file from dbstart to newbindex branch */
 extern int copyup_file(struct inode *dir, struct file *file, int bstart,
@@@@ -318,8 +325,8 @@@@ int check_branch(struct nameidata *nd);
 
 #ifdef CONFIG_UNION_FS_XATTR
 /* Extended attribute functions. */
-extern void *xattr_alloc(size_t size, size_t limit);
-extern void xattr_free(void *ptr, size_t size);
+extern void *unionfs_xattr_alloc(size_t size, size_t limit);
+extern void unionfs_xattr_free(void *ptr, size_t size);
 
 extern ssize_t unionfs_getxattr(struct dentry *dentry, const char *name,
 		void *value, size_t size);
@@@@ -354,40 +361,47 @@@@ static inline int unionfs_get_nlinks(str
 
 	for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
 		hidden_inode = unionfs_lower_inode_idx(inode, bindex);
+
+		/* ignore files */
 		if (!hidden_inode || !S_ISDIR(hidden_inode->i_mode))
 			continue;
+
 		BUG_ON(hidden_inode->i_nlink < 0);
 
 		/* A deleted directory. */
 		if (hidden_inode->i_nlink == 0)
 			continue;
 		dirs++;
-		/* A broken directory (e.g., squashfs). */
+
+		/*
+		 * A broken directory...
+		 *
+		 * Some filesystems don't properly set the number of links
+		 * on empty directories
+		 */
 		if (hidden_inode->i_nlink == 1)
 			sum_nlinks += 2;
 		else
 			sum_nlinks += (hidden_inode->i_nlink - 2);
 	}
 
-	if (!dirs)
-		return 0;
-	return sum_nlinks + 2;
+	return (!dirs ? 0 : sum_nlinks + 2);
 }
 
 struct dentry *unionfs_lookup_backend(struct dentry *dentry, struct nameidata *nd, int lookupmode);
 int is_stale_inode(struct inode *inode);
 void make_stale_inode(struct inode *inode);
 
-#define IS_SET(sb, check_flag) (check_flag & MOUNT_FLAG(sb))
+#define IS_SET(sb, check_flag) ((check_flag) & MOUNT_FLAG(sb))
 
 /* unionfs_permission, check if we should bypass error to facilitate copyup */
 #define IS_COPYUP_ERR(err) ((err) == -EROFS)
 
 /* unionfs_open, check if we need to copyup the file */
 #define OPEN_WRITE_FLAGS (O_WRONLY | O_RDWR | O_APPEND)
-#define IS_WRITE_FLAG(flag) ((flag) & (OPEN_WRITE_FLAGS))
-
-static inline int branchperms(struct super_block *sb, int index)
+#define IS_WRITE_FLAG(flag) ((flag) & OPEN_WRITE_FLAGS)
+
+static inline int branchperms(const struct super_block *sb, int index)
 {
 	BUG_ON(index < 0);
 
@@@@ -404,13 +418,13 @@@@ static inline int set_branchperms(struct
 }
 
 /* Is this file on a read-only branch? */
-static inline int is_robranch_super(struct super_block *sb, int index)
+static inline int is_robranch_super(const struct super_block *sb, int index)
 {
 	return (!(branchperms(sb, index) & MAY_WRITE)) ? -EROFS : 0;
 }
 
 /* Is this file on a read-only branch? */
-static inline int is_robranch_idx(struct dentry *dentry, int index)
+static inline int is_robranch_idx(const struct dentry *dentry, int index)
 {
 	int err = 0;
 
@@@@ -423,7 +437,7 @@@@ static inline int is_robranch_idx(struct
 	return err;
 }
 
-static inline int is_robranch(struct dentry *dentry)
+static inline int is_robranch(const struct dentry *dentry)
 {
 	int index;
 
diff -r cef7052a3112 include/linux/magic.h
--- a/include/linux/magic.h	Mon Dec 04 03:26:06 2006 -0500
+++ b/include/linux/magic.h	Tue Dec 05 14:53:30 2006 -0500
@@@@ -32,6 +32,8 @@@@
 #define REISER2FS_SUPER_MAGIC_STRING	"ReIsEr2Fs"
 #define REISER2FS_JR_SUPER_MAGIC_STRING	"ReIsEr3Fs"
 
+#define UNIONFS_SUPER_MAGIC 0xf15f083d
+
 #define SMB_SUPER_MAGIC		0x517B
 #define USBDEVICE_SUPER_MAGIC	0x9fa2
 
diff -r cef7052a3112 include/linux/namei.h
--- a/include/linux/namei.h	Mon Dec 04 03:26:06 2006 -0500
+++ b/include/linux/namei.h	Thu Dec 07 23:11:23 2006 -0500
@@@@ -81,7 +81,7 @@@@ extern struct file *nameidata_to_filp(st
 extern struct file *nameidata_to_filp(struct nameidata *nd, int flags);
 extern void release_open_intent(struct nameidata *);
 
-extern struct dentry * lookup_one_len_nd(const char *,
+extern struct dentry *lookup_one_len_nd(const char *,
 			struct dentry *, int, struct nameidata *);
 
 /* SMP-safe */
diff -r cef7052a3112 fs/unionfs/xattr.c
--- a/fs/unionfs/xattr.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/xattr.c	Fri Dec 08 00:27:48 2006 -0500
@@@@ -19,7 +19,7 @@@@
 #include "union.h"
 
 /* This is lifted from fs/xattr.c */
-void *xattr_alloc(size_t size, size_t limit)
+void *unionfs_xattr_alloc(size_t size, size_t limit)
 {
 	void *ptr;
 
@@@@ -37,7 +37,7 @@@@ void *xattr_alloc(size_t size, size_t li
 	return ptr;
 }
 
-void xattr_free(void *ptr, size_t size)
+void unionfs_xattr_free(void *ptr, size_t size)
 {
 	if (!size)		/* size request, no buffer was needed */
 		return;
diff -r cef7052a3112 include/linux/union_fs.h
--- a/include/linux/union_fs.h	Mon Dec 04 03:26:06 2006 -0500
+++ b/include/linux/union_fs.h	Fri Dec 08 00:21:44 2006 -0500
@@@@ -4,8 +4,6 @@@@
 #define UNIONFS_VERSION  "2.0"
 /*
  * DEFINITIONS FOR USER AND KERNEL CODE:
- * (Note: ioctl numbers 1--9 are reserved for fistgen, the rest
- *  are auto-generated automatically based on the user's .fist file.)
  */
 # define UNIONFS_IOCTL_INCGEN		_IOR(0x15, 11, int)
 # define UNIONFS_IOCTL_QUERYFILE	_IOR(0x15, 15, int)
@


1.1.2.2
log
@More Jan's comments
@
text
@d163 1
a163 1
+++ b/fs/unionfs/copyup.c	Mon Dec 11 08:17:52 2006 -0500
d252 1
a252 21
@@@@ -298,7 +298,8 @@@@ out:
 }
 
 /* dput the lower references for old and new dentry & clear a lower dentry
- * pointer */
+ * pointer
+ */
 static inline void __clear(struct dentry *dentry,
 			   struct dentry *old_hidden_dentry,
 			   int old_bstart, int old_bend,
@@@@ -428,7 +429,8 @@@@ out_unlink:
 out_unlink:
 	/* copyup failed, because we possibly ran out of space or
 	 * quota, or something else happened so let's unlink; we don't
-	 * really care about the return value of vfs_unlink */
+	 * really care about the return value of vfs_unlink
+	 */
 	vfs_unlink(new_hidden_parent_dentry->d_inode, new_hidden_dentry);
 
 	if (copyup_file) {
@@@@ -438,7 +440,13 @@@@ out_unlink:
a266 81
@@@@ -454,7 +462,8 @@@@ out:
 
 /* This function creates a copy of a file represented by 'file' which currently
  * resides in branch 'bstart' to branch 'new_bindex.'  The copy will be named
- * "name".  */
+ * "name".
+ */
 int copyup_named_file(struct inode *dir, struct file *file, char *name,
 		      int bstart, int new_bindex, loff_t len)
 {
@@@@ -513,10 +522,9 @@@@ static inline void __cleanup_dentry(stru
 	loop_start = min(old_bstart, bindex);
 	loop_end = max(old_bend, bindex);
 
-	/* This loop sets the bstart and bend for the new
-	 * dentry by traversing from left to right.
-	 * It also dputs all negative dentries except
-	 * bindex (the newly looked dentry
+	/* This loop sets the bstart and bend for the new dentry by
+	 * traversing from left to right.  It also dputs all negative
+	 * dentries except bindex
 	 */
 	for (i = loop_start; i <= loop_end; i++) {
 		if (!unionfs_lower_dentry_idx(dentry, i))
@@@@ -573,7 +581,8 @@@@ static inline void __set_dentry(struct d
 }
 
 /* This function replicates the directory structure upto given dentry
- * in the bindex branch.  */
+ * in the bindex branch.
+ */
 struct dentry *create_parents_named(struct inode *dir, struct dentry *dentry,
 				    const char *name, int bindex)
 {
@@@@ -622,10 +631,10 @@@@ struct dentry *create_parents_named(stru
 	/* This loop finds the first parent that exists in the given branch.
 	 * We start building the directory structure from there.  At the end
 	 * of the loop, the following should hold:
-	 *      child_dentry is the first nonexistent child
-	 *      parent_dentry is the first existent parent
-	 *      path[0] is the = deepest child
-	 *      path[count] is the first child to create
+	 *  - child_dentry is the first nonexistent child
+	 *  - parent_dentry is the first existent parent
+	 *  - path[0] is the = deepest child
+	 *  - path[count] is the first child to create
 	 */
 	do {
 		child_dentry = parent_dentry;
@@@@ -663,7 +672,8 @@@@ struct dentry *create_parents_named(stru
 	sb = dentry->d_sb;
 
 	/* This is basically while(child_dentry != dentry).  This loop is
-	 * horrible to follow and should be replaced with cleaner code. */
+	 * horrible to follow and should be replaced with cleaner code.
+	 */
 	while (1) {
 		/* get hidden parent dir in the current branch */
 		hidden_parent_dentry = unionfs_lower_dentry_idx(parent_dentry, bindex);
@@@@ -682,8 +692,9 @@@@ struct dentry *create_parents_named(stru
 				goto out;
 		} else {
 
-			/* is the name a whiteout of the childname ? */
-			/* lookup the whiteout child in the underlying file system */
+			/* is the name a whiteout of the childname ?
+			 * lookup the whiteout child in the underlying file system
+			 */
 			hidden_dentry =
 			    lookup_one_len(name, hidden_parent_dentry,
 					   strlen(name));
@@@@ -700,7 +711,8 @@@@ struct dentry *create_parents_named(stru
 
 		if (hidden_dentry->d_inode) {
 			/* since this already exists we dput to avoid
-			 * multiple references on the same dentry */
+			 * multiple references on the same dentry
+			 */
 			dput(hidden_dentry);
 		} else {
 			struct sioq_args args;
d269 2
a270 32
+++ b/fs/unionfs/dentry.c	Mon Dec 11 08:19:08 2006 -0500
@@@@ -134,7 +134,8 @@@@ restart:
 				goto out;
 			}
 			/* current unionfs_lookup_backend() doesn't return
-			   a valid dentry */
+			 * a valid dentry
+			 */
 			dput(dentry);
 			dentry = result;
 		}
@@@@ -165,7 +166,8 @@@@ restart:
 	if (!dentry->d_inode)
 		valid = 0;
 	if (valid)
-		fsstack_copy_attr_all(dentry->d_inode, unionfs_lower_inode(dentry->d_inode),
+		fsstack_copy_attr_all(dentry->d_inode,
+				unionfs_lower_inode(dentry->d_inode),
 				unionfs_get_nlinks);
 
 out:
@@@@ -191,7 +193,8 @@@@ void unionfs_d_release(struct dentry *de
 
 	/* There is no reason to lock the dentry, because we have the only
 	 * reference, but the printing functions verify that we have a lock
-	 * on the dentry before calling dbstart, etc. */
+	 * on the dentry before calling dbstart, etc.
+	 */
 	lock_dentry(dentry);
 
 	/* this could be a negative dentry, so check first */
@@@@ -230,7 +233,7 @@@@ out:
d282 1
a282 1
+++ b/fs/unionfs/dirfops.c	Mon Dec 11 08:20:07 2006 -0500
d294 1
a294 13
@@@@ -229,8 +227,9 @@@@ static loff_t unionfs_dir_llseek(struct 
 				else
 					err = -EINVAL;
 			} else {
-				if ((rdstate = find_rdstate(file->f_dentry->d_inode,
-							offset))) {
+				rdstate = find_rdstate(file->f_dentry->d_inode,
+							offset)
+				if (rdstate) {
 					UNIONFS_F(file)->rdstate = rdstate;
 					err = rdstate->offset;
 				} else
@@@@ -253,12 +252,12 @@@@ out:
d316 1
a316 1
+++ b/fs/unionfs/fanout.h	Mon Dec 11 08:22:08 2006 -0500
d346 2
a347 10
+++ b/fs/unionfs/file.c	Mon Dec 11 08:22:52 2006 -0500
@@@@ -223,7 +223,6 @@@@ out:
 	return err;
 }
 
-/* SP: disabled as none of the other in kernel fs's seem to use it */
 static int unionfs_fasync(int fd, struct file *file, int flag)
 {
 	int err = 0;
@@@@ -242,17 +241,17 @@@@ out:
d379 2
a380 218
+++ b/fs/unionfs/inode.c	Mon Dec 11 08:30:38 2006 -0500
@@@@ -31,7 +31,7 @@@@ static int unionfs_create(struct inode *
 {
 	int err = 0;
 	struct dentry *hidden_dentry = NULL;
-	struct dentry *whiteout_dentry = NULL;
+	struct dentry *wh_dentry = NULL;
 	struct dentry *new_hidden_dentry;
 	struct dentry *hidden_parent_dentry = NULL;
 	int bindex = 0, bstart;
@@@@ -50,16 +50,15 @@@@ static int unionfs_create(struct inode *
 		goto out;
 	}
 
-	whiteout_dentry =
-	    lookup_one_len(name, hidden_dentry->d_parent,
+	wh_dentry = lookup_one_len(name, hidden_dentry->d_parent,
 			   dentry->d_name.len + UNIONFS_WHLEN);
-	if (IS_ERR(whiteout_dentry)) {
-		err = PTR_ERR(whiteout_dentry);
-		whiteout_dentry = NULL;
-		goto out;
-	}
-
-	if (whiteout_dentry->d_inode) {
+	if (IS_ERR(wh_dentry)) {
+		err = PTR_ERR(wh_dentry);
+		wh_dentry = NULL;
+		goto out;
+	}
+
+	if (wh_dentry->d_inode) {
 		/* .wh.foo has been found. */
 		/* First truncate it and then rename it to foo (hence having
 		 * the same overall effect as a normal create.
@@@@ -67,7 +66,7 @@@@ static int unionfs_create(struct inode *
 		struct dentry *hidden_dir_dentry;
 		struct iattr newattrs;
 
-		mutex_lock(&whiteout_dentry->d_inode->i_mutex);
+		mutex_lock(&wh_dentry->d_inode->i_mutex);
 		newattrs.ia_valid = ATTR_CTIME | ATTR_MODE | ATTR_ATIME
 		    | ATTR_MTIME | ATTR_UID | ATTR_GID | ATTR_FORCE
 		    | ATTR_KILL_SUID | ATTR_KILL_SGID;
@@@@ -76,14 +75,14 @@@@ static int unionfs_create(struct inode *
 		newattrs.ia_uid = current->fsuid;
 		newattrs.ia_gid = current->fsgid;
 
-		if (whiteout_dentry->d_inode->i_size != 0) {
+		if (wh_dentry->d_inode->i_size != 0) {
 			newattrs.ia_valid |= ATTR_SIZE;
 			newattrs.ia_size = 0;
 		}
 
-		err = notify_change(whiteout_dentry, &newattrs);
-
-		mutex_unlock(&whiteout_dentry->d_inode->i_mutex);
+		err = notify_change(wh_dentry, &newattrs);
+
+		mutex_unlock(&wh_dentry->d_inode->i_mutex);
 
 		if (err)
 			printk(KERN_WARNING "unionfs: %s:%d: notify_change "
@@@@ -93,15 +92,14 @@@@ static int unionfs_create(struct inode *
 		new_hidden_dentry = unionfs_lower_dentry(dentry);
 		dget(new_hidden_dentry);
 
-		hidden_dir_dentry = dget_parent(whiteout_dentry);
+		hidden_dir_dentry = dget_parent(wh_dentry);
 		lock_rename(hidden_dir_dentry, hidden_dir_dentry);
 
 		if (!(err = is_robranch_super(dentry->d_sb, bstart))) {
-			err =
-			    vfs_rename(hidden_dir_dentry->d_inode,
-				       whiteout_dentry,
-				       hidden_dir_dentry->d_inode,
-				       new_hidden_dentry);
+			err = vfs_rename(hidden_dir_dentry->d_inode,
+					 wh_dentry,
+					 hidden_dir_dentry->d_inode,
+					 new_hidden_dentry);
 		}
 		if (!err) {
 			fsstack_copy_attr_times(parent,
@@@@ -120,19 +118,22 @@@@ static int unionfs_create(struct inode *
 			/* exit if the error returned was NOT -EROFS */
 			if (!IS_COPYUP_ERR(err))
 				goto out;
-			/* We were not able to create the file in this branch,
-			 * so, we try to create it in one branch to left
+			/* We were not able to create the file in this
+			 * branch, so, we try to create it in one branch to
+			 * left
 			 */
 			bstart--;
 		} else {
-			/* reset the unionfs dentry to point to the .wh.foo entry. */
+			/* reset the unionfs dentry to point to the .wh.foo
+			 * entry.
+			 */
 
 			/* Discard any old reference. */
 			dput(unionfs_lower_dentry(dentry));
 
 			/* Trade one reference to another. */
-			unionfs_set_lower_dentry_idx(dentry, bstart, whiteout_dentry);
-			whiteout_dentry = NULL;
+			unionfs_set_lower_dentry_idx(dentry, bstart, wh_dentry);
+			wh_dentry = NULL;
 
 			err = unionfs_interpose(dentry, parent->i_sb, 0);
 			goto out;
@@@@ -187,7 +188,7 @@@@ static int unionfs_create(struct inode *
 	}
 
 out:
-	dput(whiteout_dentry);
+	dput(wh_dentry);
 	kfree(name);
 
 	unlock_dentry(dentry);
@@@@ -197,7 +198,7 @@@@ struct dentry *unionfs_lookup(struct ino
 struct dentry *unionfs_lookup(struct inode *parent, struct dentry *dentry,
 			      struct nameidata *nd)
 {
-	struct nameidata lowernd;
+	struct nameidata lowernd; /* TODO: be gentler to the stack */
 
 	if (nd)
 		memcpy(&lowernd, nd, sizeof(struct nameidata));
@@@@ -223,7 +224,8 @@@@ static int unionfs_link(struct dentry *o
 	hidden_new_dentry = unionfs_lower_dentry(new_dentry);
 
 	/* check if whiteout exists in the branch of new dentry, i.e. lookup
-	 * .wh.foo first. If present, delete it */
+	 * .wh.foo first. If present, delete it
+	 */
 	name = alloc_whname(new_dentry->d_name.name, new_dentry->d_name.len);
 	if (IS_ERR(name)) {
 		err = PTR_ERR(name);
@@@@ -347,7 +349,8 @@@@ static int unionfs_symlink(struct inode 
 	hidden_dentry = unionfs_lower_dentry(dentry);
 
 	/* check if whiteout exists in this branch, i.e. lookup .wh.foo
-	 * first. If present, delete it */
+	 * first. If present, delete it
+	 */
 	name = alloc_whname(dentry->d_name.name, dentry->d_name.len);
 	if (IS_ERR(name)) {
 		err = PTR_ERR(name);
@@@@ -390,7 +393,8 @@@@ static int unionfs_symlink(struct inode 
 	}
 
 	/* deleted whiteout if it was present, now do a normal vfs_symlink()
-	 * with possible recursive directory creation */
+	 * with possible recursive directory creation
+	 */
 	for (bindex = bstart; bindex >= 0; bindex--) {
 		hidden_dentry = unionfs_lower_dentry_idx(dentry, bindex);
 		if (!hidden_dentry) {
@@@@ -399,7 +403,8 @@@@ static int unionfs_symlink(struct inode 
 			 * hidden_dentry will NOT be null when bindex ==
 			 * bstart because lookup passed as a negative
 			 * unionfs dentry pointing to a lone negative
-			 * underlying dentry */
+			 * underlying dentry
+			 */
 			hidden_dentry = create_parents(dir, dentry, bindex);
 			if (!hidden_dentry || IS_ERR(hidden_dentry)) {
 				if (IS_ERR(hidden_dentry))
@@@@ -742,11 +747,14 @@@@ void unionfs_put_link(struct dentry *den
 }
 
 /* Basically copied from the kernel vfs permission(), but we've changed
- * the following: (1) the IS_RDONLY check is skipped, and (2) if you set
- * the mount option `nfsperms=insceure', we assume that -EACCES means that
- * the export is read-only and we should check standard Unix permissions.
- * This means that NFS ACL checks (or other advanced permission features)
- * are bypassed.
+ * the following:
+ *   (1) the IS_RDONLY check is skipped, and 
+ *   (2) if you set the mount option `mode=nfsro', we assume that -EACCES
+ *   means that the export is read-only and we should check standard Unix
+ *   permissions.  This means that NFS ACL checks (or other advanced
+ *   permission features) are bypassed. Note however, that we do call
+ *   security_inode_permission, and therefore security inside SELinux, etc.
+ *   are performed.
  */
 static int inode_permission(struct inode *inode, int mask, struct nameidata *nd,
 			    int bindex)
@@@@ -757,8 +765,8 @@@@ static int inode_permission(struct inode
 		/* The first branch is allowed to be really readonly. */
 		if (bindex == 0) {
 			umode_t mode = inode->i_mode;
-			if (IS_RDONLY(inode) && (S_ISREG(mode) || S_ISDIR(mode)
-						 || S_ISLNK(mode)))
+			if (IS_RDONLY(inode) &&
+			   (S_ISREG(mode) || S_ISDIR(mode) || S_ISLNK(mode)))
 				return -EROFS;
 		}
 		/*
@@@@ -813,11 +821,13 @@@@ static int unionfs_permission(struct ino
 			continue;
 
 		/* We use our own special version of permission, such that
-		 * only the first branch returns -EROFS. */
+		 * only the first branch returns -EROFS.
+		 */
 		err = inode_permission(hidden_inode, mask, nd, bindex);
 
 		/* The permissions are an intersection of the overall directory
-		 * permissions, so we fail if one fails. */
+		 * permissions, so we fail if one fails.
+		 */
 		if (err)
 			goto out;
 
@@@@ -898,41 +908,41 @@@@ out:
d450 2
a451 83
+++ b/fs/unionfs/lookup.c	Mon Dec 11 08:33:36 2006 -0500
@@@@ -44,7 +44,8 @@@@ struct dentry *unionfs_lookup_backend(st
 
 	/* We should already have a lock on this dentry in the case of a
 	 * partial lookup, or a revalidation. Otherwise it is returned from
-	 * new_dentry_private_data already locked.  */
+	 * new_dentry_private_data already locked.
+	 */
 	if (lookupmode == INTERPOSE_PARTIAL || lookupmode == INTERPOSE_REVAL ||
 	    lookupmode == INTERPOSE_REVAL_NEG)
 		verify_locked(dentry);
@@@@ -86,7 +87,8 @@@@ struct dentry *unionfs_lookup_backend(st
 
 	/* It would be ideal if we could convert partial lookups to only have
 	 * to do this work when they really need to.  It could probably improve
-	 * performance quite a bit, and maybe simplify the rest of the code. */
+	 * performance quite a bit, and maybe simplify the rest of the code.
+	 */
 	if (lookupmode == INTERPOSE_PARTIAL) {
 		bstart++;
 		if ((bopaque != -1) && (bopaque < bend))
@@@@ -163,13 +165,17 @@@@ struct dentry *unionfs_lookup_backend(st
 		}
 
 		/* Store the first negative dentry specially, because if they
-		 * are all negative we need this for future creates. */
+		 * are all negative we need this for future creates.
+		 */
 		if (!hidden_dentry->d_inode) {
 			if (!first_hidden_dentry && (dbstart(dentry) == -1)) {
 				first_hidden_dentry = hidden_dentry;
 				/* FIXME: following line needs to be changed
-				 * to allow mountpoint crossing */
-				first_hidden_mnt = mntget(unionfs_lower_mnt_idx(parent_dentry, bindex));
+				 * to allow mountpoint crossing
+				 */
+				first_hidden_mnt = mntget(
+					unionfs_lower_mnt_idx(parent_dentry,
+								bindex));
 				first_dentry_offset = bindex;
 			} else
 				dput(hidden_dentry);
@@@@ -185,7 +191,8 @@@@ struct dentry *unionfs_lookup_backend(st
 			set_dbstart(dentry, bindex);
 		unionfs_set_lower_dentry_idx(dentry, bindex, hidden_dentry);
 		/* FIXME: the following line needs to get fixed to allow
-		 * mountpoint crossing */
+		 * mountpoint crossing
+		 */
 		unionfs_set_lower_mnt_idx(dentry, bindex,
 			mntget(unionfs_lower_mnt_idx(parent_dentry, bindex)));
 		set_dbend(dentry, bindex);
@@@@ -249,7 +256,8 @@@@ out_negative:
 		}
 		
 		/* FIXME: the following line needs to be changed to allow
-		 * mountpoint crossing */
+		 * mountpoint crossing
+		 */
 		first_hidden_mnt = mntget(unionfs_lower_mnt_idx(dentry, bindex));
 	}
 	unionfs_set_lower_dentry_idx(dentry, first_dentry_offset, first_hidden_dentry);
@@@@ -268,7 +276,8 @@@@ out_positive:
 	BUG_ON(dentry_count <= 0);
 
 	/* If we're holding onto the first negative dentry & corresponding
-	 * vfsmount - throw it out. */
+	 * vfsmount - throw it out.
+	 */
 	dput(first_hidden_dentry);
 	mntput(first_hidden_mnt);
 
@@@@ -280,7 +289,8 @@@@ out_positive:
 		}
 
 		/* This somehow turned positive, so it is as if we had a
-		 * negative revalidation.  */
+		 * negative revalidation.
+		 */
 		lookupmode = INTERPOSE_REVAL_NEG;
 
 		update_bstart(dentry);
@@@@ -363,7 +373,7 @@@@ static int is_opaque_dir(struct dentry *
d460 1
a460 1
@@@@ -396,7 +406,7 @@@@ static int is_validname(const char *name
d469 1
a469 1
@@@@ -405,7 +415,7 @@@@ int init_dentry_cache(void)
a477 18
@@@@ -470,7 +480,6 @@@@ int new_dentry_private_data(struct dentr
 
 	spin_unlock(&dentry->d_lock);
 	return 0;
-	/* */
 
 out_free:
 	kfree(info->lower_paths);
@@@@ -483,7 +492,8 @@@@ out:
 }
 
 /* scan through the lower dentry objects, and set bstart to reflect the
- * starting branch */
+ * starting branch
+ */
 void update_bstart(struct dentry *dentry)
 {
 	int bindex;
d480 2
a481 64
+++ b/fs/unionfs/main.c	Mon Dec 11 08:35:21 2006 -0500
@@@@ -51,7 +51,8 @@@@ int unionfs_interpose(struct dentry *den
 	 */
 
 	/* On revalidate we've already got our own inode and just need
-	 * to fix it up. */
+	 * to fix it up.
+	 */
 	if (flag == INTERPOSE_REVAL) {
 		inode = dentry->d_inode;
 		UNIONFS_I(inode)->bstart = -1;
@@@@ -118,7 +119,9 @@@@ int unionfs_interpose(struct dentry *den
 	    S_ISFIFO(hidden_inode->i_mode) || S_ISSOCK(hidden_inode->i_mode))
 		init_special_inode(inode, hidden_inode->i_mode,
 				   hidden_inode->i_rdev);
-	/* Fix our inode's address operations to that of the lower inode (Unionfs is FiST-Lite) */
+	/* Fix our inode's address operations to that of the lower inode
+	 * (Unionfs is FiST-Lite)
+	 */
 	if (inode->i_mapping->a_ops != hidden_inode->i_mapping->a_ops)
 		inode->i_mapping->a_ops = hidden_inode->i_mapping->a_ops;
 
@@@@ -171,7 +174,8 @@@@ void unionfs_reinterpose(struct dentry *
 			continue;
 		if (unionfs_lower_inode_idx(inode, bindex))
 			continue;
-		unionfs_set_lower_inode_idx(inode, bindex, igrab(hidden_dentry->d_inode));
+		unionfs_set_lower_inode_idx(inode, bindex,
+				igrab(hidden_dentry->d_inode));
 	}
 	ibstart(inode) = dbstart(dentry);
 	ibend(inode) = dbend(dentry);
@@@@ -252,7 +256,8 @@@@ static int parse_dirs_option(struct supe
 	}
 
 	/* Each colon means we have a separator, this is really just a rough
-	 * guess, since strsep will handle empty fields for us. */
+	 * guess, since strsep will handle empty fields for us.
+	 */
 	for (i = 0; options[i]; i++)
 		if (options[i] == ':')
 			branches++;
@@@@ -396,7 +401,8 @@@@ static struct unionfs_dentry_info *union
 			*optarg++ = '\0';
 
 		/* All of our options take an argument now. Insert ones that
-		 * don't, above this check.  */
+		 * don't, above this check.
+		 */
 		if (!optarg) {
 			printk("unionfs: %s requires an argument.\n", optname);
 			err = -EINVAL;
@@@@ -504,9 +510,7 @@@@ static int unionfs_read_super(struct sup
 		goto out;
 	}
 
-	/*
-	 * Allocate superblock private data
-	 */
+	/* Allocate superblock private data */
 	sb->s_fs_info = kzalloc(sizeof(struct unionfs_sb_info), GFP_KERNEL);
 	if (!UNIONFS_SB(sb)) {
 		printk(KERN_WARNING "%s: out of memory\n", __FUNCTION__);
@@@@ -630,46 +634,43 @@@@ static int unionfs_get_sb(struct file_sy
d549 2
a550 13
+++ b/fs/unionfs/rdstate.c	Mon Dec 11 08:37:17 2006 -0500
@@@@ -19,15 +19,19 @@@@
 #include "union.h"
 
 /* This file contains the routines for maintaining readdir state. */
+
 /* There are two structures here, rdstate which is a hash table
- * of the second structure which is a filldir_node. */
+ * of the second structure which is a filldir_node.
+ */
 
 /* This is a struct kmem_cache for filldir nodes, because we allocate a lot
  * of them and they shouldn't waste memory.  If the node has a small name
d552 1
a552 3
- * preserve kmalloc space. */
+ * preserve kmalloc space.
+ */
a554 1
+
d559 1
a559 1
@@@@ -36,7 +40,7 @@@@ int init_filldir_cache(void)
a567 16
@@@@ -205,11 +209,13 @@@@ struct filldir_node *find_filldir_node(s
 		if (cursor->namelen == namelen && cursor->hash == hash &&
 		    !strncmp(cursor->name, name, namelen)) {
 			/* a duplicate exists, and hence no need to create
-			 * entry to the list */
+			 * entry to the list
+			 */
 			found = 1;
 
 			/* if the duplicate is in this branch, then the file
-			 * system is corrupted. */
+			 * system is corrupted.
+			 */
 			if (cursor->bindex == rdstate->bindex) {
 				printk(KERN_DEBUG "Possible I/O error "
 					"unionfs_filldir: a file is duplicated "
d648 1
a648 1
+++ b/fs/unionfs/stale_inode.c	Mon Dec 11 08:40:05 2006 -0500
a710 36
@@@@ -77,14 +77,13 @@@@ struct inode_operations stale_inode_ops 
  */
 
 /**
- *	make_stale_inode - mark an inode stale due to an I/O error
- *	@@inode: Inode to mark stale
+ * make_stale_inode - mark an inode stale due to an I/O error
+ * @@inode: Inode to mark stale
  *
- *	When an inode cannot be read due to a media or remote network
- *	failure this function makes the inode "stale" and causes I/O operations
- *	on it to fail from this point on.
+ * When an inode cannot be read due to a media or remote network
+ * failure this function makes the inode "stale" and causes I/O operations
+ * on it to fail from this point on.
  */
-
 void make_stale_inode(struct inode *inode)
 {
 	inode->i_mode = S_IFREG;
@@@@ -101,12 +100,11 @@@@ void make_stale_inode(struct inode *inod
  */
 
 /**
- *	is_stale_inode - is an inode errored
- *	@@inode: inode to test
+ * is_stale_inode - is an inode errored
+ * @@inode: inode to test
  *
- *	Returns true if the inode in question has been marked as stale.
+ * Returns true if the inode in question has been marked as stale.
  */
-
 int is_stale_inode(struct inode *inode)
 {
 	return (inode->i_op == &stale_inode_ops);
d713 2
a714 42
+++ b/fs/unionfs/super.c	Mon Dec 11 08:41:17 2006 -0500
@@@@ -19,7 +19,8 @@@@
 #include "union.h"
 
 /* The inode cache is used with alloc_inode for both our inode info and the
- * vfs inode.  */
+ * vfs inode.
+ */
 static struct kmem_cache *unionfs_inode_cachep;
 
 static void unionfs_read_inode(struct inode *inode)
@@@@ -115,7 +116,8 @@@@ static void unionfs_put_super(struct sup
 
 /* Since people use this to answer the "How big of a file can I write?"
  * question, we report the size of the highest priority branch as the size of
- * the union. */
+ * the union.
+ */
 static int unionfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
 	int err	= 0;
@@@@ -138,7 +140,8 @@@@ static int unionfs_statfs(struct dentry 
 /* We don't support a standard text remount. Eventually it would be nice to
  * support a full-on remount, so that you can have all of the directories
  * change at once, but that would require some pretty complicated matching
- * code. */
+ * code.
+ */
 static int unionfs_remount_fs(struct super_block *sb, int *flags, char *data)
 {
 	return -ENOSYS;
@@@@ -164,7 +167,8 @@@@ static void unionfs_clear_inode(struct i
 	}
 
 	/* Decrement a reference to a hidden_inode, which was incremented
-	 * by our read_inode when it was created initially.  */
+	 * by our read_inode when it was created initially.
+	 */
 	bstart = ibstart(inode);
 	bend = ibend(inode);
 	if (bstart >= 0) {
@@@@ -210,7 +214,7 @@@@ static void init_once(void *v, struct km
d723 1
a723 1
@@@@ -223,7 +227,7 @@@@ int init_inode_cache(void)
d732 1
a732 1
@@@@ -326,17 +330,17 @@@@ out:
d764 1
a764 1
+++ b/fs/unionfs/union.h	Mon Dec 11 08:43:08 2006 -0500
d833 1
a833 14
@@@@ -157,10 +166,11 @@@@ struct unionfs_dir_state {
 	unsigned int cookie;	/* The cookie, which is based off of rdversion */
 	unsigned int offset;	/* The entry we have returned. */
 	int bindex;
-	loff_t dirpos;	/* The offset within the lower level directory. */
+	loff_t dirpos;		/* The offset within the lower level directory. */
 	int size;		/* How big is the hash table? */
 	int hashentries;	/* How many entries have been inserted? */
 	unsigned long access;
+
 	/* This cache list is used when the inode keeps us around. */
 	struct list_head cache;
 	struct list_head list[0];
@@@@ -171,12 +181,12 @@@@ struct unionfs_dir_state {
d852 2
a853 10
@@@@ -204,13 +214,11 @@@@ static inline off_t rdstate2offset(struc
 	return tmp;
 }
 
-#define unionfs_read_lock(sb) down_read(&UNIONFS_SB(sb)->rwsem)
-#define unionfs_read_unlock(sb) up_read(&UNIONFS_SB(sb)->rwsem)
-#define unionfs_write_lock(sb) down_write(&UNIONFS_SB(sb)->rwsem)
+#define unionfs_read_lock(sb)	 down_read(&UNIONFS_SB(sb)->rwsem)
+#define unionfs_read_unlock(sb)	 up_read(&UNIONFS_SB(sb)->rwsem)
+#define unionfs_write_lock(sb)	 down_write(&UNIONFS_SB(sb)->rwsem)
d861 1
a861 10
@@@@ -229,6 +237,7 @@@@ void update_bstart(struct dentry *dentry
 /*
  * EXTERNALS:
  */
+
 /* replicates the directory structure upto given dentry in given branch */
 extern struct dentry *create_parents(struct inode *dir, struct dentry *dentry,
 				     int bindex);
@@@@ -241,8 +250,11 @@@@ extern int is_branch_overlap(struct dent
 /* partial lookup */
d864 1
a864 1
-/* Pass an unionfs dentry and an index and it will try to create a whiteout in branch 'index'.
d866 1
a866 5
+/* Pass an unionfs dentry and an index and it will try to create a whiteout
+ * in branch 'index'.
+ *
+ * On error, it will proceed to a branch to the left
+ */
d870 1
a870 1
@@@@ -318,8 +330,8 @@@@ int check_branch(struct nameidata *nd);
d881 1
a881 11
@@@@ -337,7 +349,8 @@@@ static inline int d_deleted(struct dentr
 }
 
 /* returns the sum of the n_link values of all the underlying inodes of the
- * passed inode */
+ * passed inode
+ */
 static inline int unionfs_get_nlinks(struct inode *inode)
 {
 	int sum_nlinks = 0;
@@@@ -354,40 +367,47 @@@@ static inline int unionfs_get_nlinks(str
d937 1
a937 1
@@@@ -404,13 +424,13 @@@@ static inline int set_branchperms(struct
d953 1
a953 1
@@@@ -423,7 +443,7 @@@@ static inline int is_robranch_idx(struct
a961 32
@@@@ -459,10 +479,6 @@@@ static inline char *alloc_whname(const c
 
 #define VALID_MOUNT_FLAGS (0)
 
-/*
- * MACROS:
- */
-
 #ifndef DEFAULT_POLLMASK
 #define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
 #endif
diff -r cef7052a3112 fs/unionfs/xattr.c
--- a/fs/unionfs/xattr.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/xattr.c	Fri Dec 08 00:27:48 2006 -0500
@@@@ -19,7 +19,7 @@@@
 #include "union.h"
 
 /* This is lifted from fs/xattr.c */
-void *xattr_alloc(size_t size, size_t limit)
+void *unionfs_xattr_alloc(size_t size, size_t limit)
 {
 	void *ptr;
 
@@@@ -37,7 +37,7 @@@@ void *xattr_alloc(size_t size, size_t li
 	return ptr;
 }
 
-void xattr_free(void *ptr, size_t size)
+void unionfs_xattr_free(void *ptr, size_t size)
 {
 	if (!size)		/* size request, no buffer was needed */
 		return;
d986 21
a1018 121
diff -r cef7052a3112 fs/unionfs/commonfops.c
--- a/fs/unionfs/commonfops.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/commonfops.c	Mon Dec 11 08:12:12 2006 -0500
@@@@ -76,7 +76,8 @@@@ out:
 }
 
 /* put all references held by upper struct file and free lower file pointer
- * array */
+ * array
+ */
 static void cleanup_file(struct file *file)
 {
 	int bindex, bstart, bend;
@@@@ -241,7 +242,8 @@@@ int unionfs_file_revalidate(struct file 
 	/* There are two cases we are interested in.  The first is if the
 	 * generation is lower than the super-block.  The second is if someone
 	 * has copied up this file from underneath us, we also need to refresh
-	 * things. */
+	 * things.
+	 */
 	if (!d_deleted(dentry) &&
 	    (sbgen > fgen || dbstart(dentry) != fbstart(file))) {
 		/* First we throw out the existing files. */
@@@@ -315,7 +317,8 @@@@ static inline int __open_dir(struct inod
 		unionfs_set_lower_file_idx(file, bindex, hidden_file);
 
 		/* The branchget goes after the open, because otherwise
-		 * we would miss the reference on release. */
+		 * we would miss the reference on release.
+		 */
 		branchget(inode->i_sb, bindex);
 	}
 
@@@@ -340,7 +343,9 @@@@ static inline int __open_file(struct ino
 	 * copyup the file.
 	 */
 	if (hidden_dentry->d_inode && is_robranch(file->f_dentry)) {
-		/* if the open will change the file, copy it up otherwise defer it. */
+		/* if the open will change the file, copy it up otherwise
+		 * defer it.
+		 */
 		if (hidden_flags & O_TRUNC) {
 			int size = 0;
 			int err = -EROFS;
@@@@ -411,7 +416,8 @@@@ int unionfs_open(struct inode *inode, st
 	atomic_inc(&UNIONFS_I(dentry->d_inode)->totalopens);
 
 	/* open all directories and make the unionfs file struct point to
-	 * these hidden file structs */
+	 * these hidden file structs
+	 */
 	if (S_ISDIR(inode->i_mode))
 		err = __open_dir(inode, file);	/* open a dir */
 	else
diff -r cef7052a3112 fs/unionfs/dirhelper.c
--- a/fs/unionfs/dirhelper.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/dirhelper.c	Mon Dec 11 08:21:18 2006 -0500
@@@@ -148,11 +148,11 @@@@ static int readdir_util_callback(void *d
 
 	buf->filldir_called = 1;
 
-	if (name[0] == '.'
-	    && (namelen == 1 || (name[1] == '.' && namelen == 2)))
-		goto out;
-
-	if (namelen > UNIONFS_WHLEN && !strncmp(name, UNIONFS_WHPFX, UNIONFS_WHLEN)) {
+	if (name[0] == '.' && (namelen == 1 || (name[1] == '.' && namelen == 2)))
+		goto out;
+
+	if (namelen > UNIONFS_WHLEN &&
+	    !strncmp(name, UNIONFS_WHPFX, UNIONFS_WHLEN)) {
 		namelen -= UNIONFS_WHLEN;
 		name += UNIONFS_WHLEN;
 		whiteout = 1;
diff -r cef7052a3112 fs/unionfs/rename.c
--- a/fs/unionfs/rename.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/rename.c	Mon Dec 11 08:39:10 2006 -0500
@@@@ -93,7 +93,8 @@@@ static int do_rename(struct inode *old_d
 		goto out_unlock;
 
 	/* ready to whiteout for old_dentry. caller will create the actual
-	 * whiteout, and must dput(*wh_old) */
+	 * whiteout, and must dput(*wh_old)
+	 */
 	if (wh_old) {
 		char *whname;
 		whname = alloc_whname(old_dentry->d_name.name,
@@@@ -207,7 +208,9 @@@@ static int do_unionfs_rename(struct inod
 
 	if (do_copyup != -1) {
 		for (bindex = do_copyup; bindex >= 0; bindex--) {
-			/* copyup the file into some left directory, so that you can rename it */
+			/* copyup the file into some left directory, so that
+			 * you can rename it
+			 */
 			err = copyup_dentry(old_dentry->d_parent->d_inode,
 					    old_dentry, old_bstart, bindex, NULL,
 					    old_dentry->d_inode->i_size);
diff -r cef7052a3112 fs/unionfs/subr.c
--- a/fs/unionfs/subr.c	Mon Dec 04 03:26:06 2006 -0500
+++ b/fs/unionfs/subr.c	Mon Dec 11 08:40:22 2006 -0500
@@@@ -67,7 +67,8 @@@@ int create_whiteout(struct dentry *dentr
 			continue;
 
 		/* The whiteout already exists. This used to be impossible, but
-		 * now is possible because of opaqueness. */
+		 * now is possible because of opaqueness.
+		 */
 		if (hidden_wh_dentry->d_inode) {
 			dput(hidden_wh_dentry);
 			err = 0;
@@@@ -98,7 +99,8 @@@@ out:
 }
 
 /* This is a helper function for rename, which ends up with hosed over dentries
- * when it needs to revert. */
+ * when it needs to revert.
+ */
 int unionfs_refresh_hidden_dentry(struct dentry *dentry, int bindex)
 {
 	struct dentry *hidden_dentry;
@


1.1.2.3
log
@Folded unionfs-lkml-comments-jan
@
text
@@


