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


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

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

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

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


desc
@@


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


1.1.2.1
log
@Container stuff
@
text
@a0 78
diff -r 640e5f23c62e include/linux/fs_stack.h
--- a/include/linux/fs_stack.h	Wed Oct 25 04:20:50 2006 -0400
+++ b/include/linux/fs_stack.h	Wed Oct 25 21:36:36 2006 -0400
@@@@ -37,12 +37,28 @@@@ struct fsstack_file_info {
 	};
 };
 
+/* DO NOT USE!
+ *
+ * The following structure is used during the container_of calls to allow
+ * for as generic as possible way of accessing fsstack_inode_info given a
+ * pointer to the inode.
+ */
+struct __fsstack_inode_generic_info {
+	struct inode vfs_inode;		/* vfs inode */
+	struct fsstack_inode_info info;	/* fsstack inode info */
+};
+
 /*
  * Functions to get lower objects from an upper one.
  *
- * NOTE: These functions expect struct fsstack_*_info to be the first member
- * in the filesystem-specific info structures and that inode->i_private
- * points at the beginning of the inode container.
+ * NOTE: The filesystem specific info structure _must_ have the following
+ * layout:
+ *
+ * 	struct foo {
+ * 		struct inode vfs_inode;
+ * 		struct fsstack_inode_info info;
+ * 		...
+ * 	};
  */
 static inline struct super_block *
 __fsstack_lower_sb(struct super_block *sb, unsigned long branch_idx)
@@@@ -72,10 +88,17 @@@@ fsstack_set_lower_sb(struct super_block 
 	info->sb = lower_sb;
 }
 
+/* get the fs dependent data */
+static inline void * fsstack_inode_data(struct inode *inode)
+{
+	return &((struct __fsstack_inode_generic_info*) inode)->info;
+}
+
 static inline struct inode *
 __fsstack_lower_inode(struct inode *inode, unsigned long branch_idx)
 {
-	struct fsstack_inode_info *info = inode->i_private;
+	struct fsstack_inode_info *info = fsstack_inode_data(inode);
+		
 	return info->inodes[branch_idx];
 }
 
@@@@ -83,20 +106,20 @@@@ __fsstack_set_lower_inode(struct inode *
 __fsstack_set_lower_inode(struct inode *inode, unsigned long branch_idx,
 			  struct inode *lower_inode)
 {
-	struct fsstack_inode_info *info = inode->i_private;
+	struct fsstack_inode_info *info = fsstack_inode_data(inode);
 	info->inodes[branch_idx] = lower_inode;
 }
 
 static inline struct inode *fsstack_lower_inode(struct inode *inode)
 {
-	struct fsstack_inode_info *info = inode->i_private;
+	struct fsstack_inode_info *info = fsstack_inode_data(inode);
 	return info->inode;
 }
 
 static inline void
 fsstack_set_lower_inode(struct inode *inode, struct inode *lower_inode)
 {
-	struct fsstack_inode_info *info = inode->i_private;
+	struct fsstack_inode_info *info = fsstack_inode_data(inode);
 	info->inode = lower_inode;
 }
 
@


1.1.2.2
log
@More container magic - generic & unionfs
@
text
@d1 3
a3 3
diff -r a00a641a51a8 include/linux/fs_stack.h
--- a/include/linux/fs_stack.h	Fri Oct 27 06:09:05 2006 -0400
+++ b/include/linux/fs_stack.h	Sat Oct 28 11:22:32 2006 -0400
d36 1
a36 1
@@@@ -72,31 +88,52 @@@@ fsstack_set_lower_sb(struct super_block 
a52 7
+}
+
+static inline struct inode **
+__fsstack_lower_inodes(struct inode *inode)
+{
+	struct fsstack_inode_info *info = fsstack_inode_data(inode);
+	return info->inodes;
d55 1
a55 1
 static inline void
a63 7
+static inline void
+__fsstack_set_lower_inodes(struct inode *inode, struct inode **lower_inodes)
+{
+	struct fsstack_inode_info *info = fsstack_inode_data(inode);
+	info->inodes = lower_inodes;
+}
+
a78 55
@@@@ -107,6 +144,13 @@@@ __fsstack_lower_dentry(struct dentry *de
 	return info->paths[branch_idx].dentry;
 }
 
+static inline struct path *
+__fsstack_lower_paths(struct dentry *dentry)
+{
+	struct fsstack_dentry_info *info = dentry->d_fsdata;
+	return info->paths;
+}
+
 static inline void
 __fsstack_set_lower_dentry(struct dentry *dentry, unsigned long branch_idx,
 			   struct dentry *lower_dentry)
@@@@ -115,6 +159,13 @@@@ __fsstack_set_lower_dentry(struct dentry
 	info->paths[branch_idx].dentry = lower_dentry;
 }
 
+static inline void
+__fsstack_set_lower_paths(struct dentry *dentry, struct path *lower_paths)
+{
+	struct fsstack_dentry_info *info = dentry->d_fsdata;
+	info->paths = lower_paths;
+}
+
 static inline struct dentry *fsstack_lower_dentry(struct dentry *dentry)
 {
 	struct fsstack_dentry_info *info = dentry->d_fsdata;
@@@@ -163,12 +214,26 @@@@ __fsstack_lower_file(struct file *file, 
 	return info->files[branch_idx];
 }
 
+static inline struct file **
+__fsstack_lower_files(struct file *file)
+{
+	struct fsstack_file_info *info = file->private_data;
+	return info->files;
+}
+
 static inline void
 __fsstack_set_lower_file(struct file *file, unsigned long branch_idx,
 			 struct file *lower_file)
 {
 	struct fsstack_file_info *info = file->private_data;
 	info->files[branch_idx] = lower_file;
+}
+
+static inline void
+__fsstack_set_lower_files(struct file *file, struct file **lower_files)
+{
+	struct fsstack_file_info *info = file->private_data;
+	info->files = lower_files;
 }
 
 static inline struct file *fsstack_lower_file(struct file *file)
@


1.1.2.3
log
@Collapse container and struct patches for fsstack
@
text
@@


