-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here's the updated patch. The old one compiled but had a few stupid
merge errors left in it that caused it to bail out early after reading
the inode. This one works as expected.

- -Jeff

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFH1qE2LPWxlyuTD7IRAiVtAJsEFJF1XGdqjGhN/NZtH3GMk43cUQCfd/dS
ijTA5I+zQRhn0OzIN+hr4VQ=
=EPkm
-----END PGP SIGNATURE-----
From: Jeff Mahoney <[EMAIL PROTECTED]>
Subject: [PATCH] aufs: Update aufs to use 2.6.25-rc API
References: 356902

 This patch contains changes to allow aufs to work with the 2.6.25-rc API.

 As required by the project, it preserves the compatibility with older
 releases. I've tested with 2.6.22.

Signed-off-by: Jeff Mahoney <[EMAIL PROTECTED]>

---
 fs/aufs/branch.c  |   23 ++++++++++++-----------
 fs/aufs/compat.h  |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 fs/aufs/dentry.c  |    6 +++---
 fs/aufs/i_op.c    |    9 +++++----
 fs/aufs/inode.c   |   20 ++++++++++----------
 fs/aufs/inode.h   |    1 +
 fs/aufs/misc.c    |   23 ++++++++++++-----------
 fs/aufs/opts.c    |   14 +++++++-------
 fs/aufs/super.c   |   29 ++++++++++++++++++-----------
 fs/aufs/sysaufs.c |   48 ++++++++++++++++++++++++++++++++++++++++--------
 fs/aufs/vfsub.c   |    2 +-
 fs/aufs/vfsub.h   |    6 ++++--
 fs/aufs/xino.c    |    5 +++--
 13 files changed, 165 insertions(+), 70 deletions(-)

--- a/fs/aufs/branch.c	2008-03-10 15:41:21.000000000 -0400
+++ b/fs/aufs/branch.c	2008-03-11 10:58:38.000000000 -0400
@@ -306,7 +306,8 @@ static int test_add(struct super_block *
 
 	root = sb->s_root;
 	bend = sbend(sb);
-	if (unlikely(bend >= 0 && au_find_dbindex(root, add->nd.dentry) >= 0)) {
+	if (unlikely(bend >= 0 &&
+	    au_find_dbindex(root, nd_dentry(&add->nd)) >= 0)) {
 		err = 1;
 		if (!remount) {
 			err = -EINVAL;
@@ -329,7 +330,7 @@ static int test_add(struct super_block *
 		goto out;
 	}
 
-	inode = add->nd.dentry->d_inode;
+	inode = nd_dentry(&add->nd)->d_inode;
 	AuDebugOn(!inode || !S_ISDIR(inode->i_mode));
 	err = -ENOENT;
 	if (unlikely(!inode->i_nlink)) {
@@ -358,7 +359,7 @@ static int test_add(struct super_block *
 		goto out;
 	}
 
-	err = test_br(sb, add->nd.dentry->d_inode, add->perm, add->path);
+	err = test_br(sb, nd_dentry(&add->nd)->d_inode, add->perm, add->path);
 	if (unlikely(err))
 		goto out;
 
@@ -379,7 +380,7 @@ static int test_add(struct super_block *
 
 	err = -EINVAL;
 	for (bindex = 0; bindex <= bend; bindex++)
-		if (unlikely(test_overlap(sb, add->nd.dentry,
+		if (unlikely(test_overlap(sb, nd_dentry(&add->nd),
 					  au_h_dptr_i(root, bindex)))) {
 			AuErr("%s is overlapped\n", add->path);
 			goto out;
@@ -406,7 +407,7 @@ int br_add(struct super_block *sb, struc
 	struct aufs_hinode *hinodep;
 
 	LKTRTrace("b%d, %s, 0x%x, %.*s\n", add->bindex, add->path,
-		  add->perm, AuDLNPair(add->nd.dentry));
+		  add->perm, AuDLNPair(nd_dentry(&add->nd)));
 	SiMustWriteLock(sb);
 	root = sb->s_root;
 	DiMustWriteLock(root);
@@ -432,14 +433,14 @@ int br_add(struct super_block *sb, struc
 	add_branch->br_wh = NULL;
 	if (unlikely(br_writable(add->perm))) {
 		err = init_br_wh(sb, /*bindex*/-1, add_branch, add->perm,
-				 add->nd.dentry, add->nd.mnt);
+				 nd_dentry(&add->nd), nd_mnt(&add->nd));
 		if (unlikely(err)) {
 			kfree(add_branch);
 			goto out;
 		}
 	}
 	add_branch->br_xino = NULL;
-	add_branch->br_mnt = mntget(add->nd.mnt);
+	add_branch->br_mnt = mntget(nd_mnt(&add->nd));
 	atomic_set(&add_branch->br_wh_running, 0);
 	add_branch->br_id = new_br_id(sb);
 	add_branch->br_perm = add->perm;
@@ -477,13 +478,13 @@ int br_add(struct super_block *sb, struc
 		dinfo->di_bstart = 0;
 		iinfo->ii_bstart = 0;
 	}
-	set_h_dptr(root, add_bindex, dget(add->nd.dentry));
-	set_h_iptr(root_inode, add_bindex, igrab(add->nd.dentry->d_inode), 0);
+	set_h_dptr(root, add_bindex, dget(nd_dentry(&add->nd)));
+	set_h_iptr(root_inode, add_bindex, igrab(nd_dentry(&add->nd)->d_inode), 0);
 	if (!add_bindex)
 		au_cpup_attr_all(root_inode);
 	else
-		au_add_nlink(root_inode, add->nd.dentry->d_inode);
-	maxb = add->nd.dentry->d_sb->s_maxbytes;
+		au_add_nlink(root_inode, nd_dentry(&add->nd)->d_inode);
+	maxb = nd_dentry(&add->nd)->d_sb->s_maxbytes;
 	if (sb->s_maxbytes < maxb)
 		sb->s_maxbytes = maxb;
 
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ b/fs/aufs/compat.h	2008-03-11 10:58:38.000000000 -0400
@@ -0,0 +1,49 @@
+#ifndef _AUFS_COMPAT_H_
+#define _AUFS_COMPAT_H_
+
+#include <linux/version.h>
+#include <linux/fs.h>
+#include <linux/seq_file.h>
+static inline int compat_seq_path(struct seq_file *m, struct vfsmount *mnt,
+				  struct dentry *dentry, char *esc)
+{
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 24)
+	struct path path = { .mnt = mnt, .dentry = dentry, };
+	return seq_path(m, &path, esc);
+#else
+	return seq_path(m, mnt, dentry, esc);
+#endif
+}
+static inline char *compat_d_path(struct dentry *dentry,
+				  struct vfsmount *vfsmnt, char *buf,
+				  int buflen)
+{
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 24)
+	struct path path = { .mnt = vfsmnt, .dentry = dentry, };
+	return d_path(&path, buf, buflen);
+#else
+	return d_path(dentry, vfsmnt, buf, buflen);
+#endif
+}
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 24)
+#define nd_dentry(nd)	(nd)->path.dentry
+#define nd_mnt(nd)	(nd)->path.mnt
+static inline void path_release(struct nameidata *nd)
+{
+	path_put(&nd->path);
+}
+
+#else
+#define nd_dentry(nd)	(nd)->dentry
+#define nd_mnt(nd)	(nd)->mnt
+
+static inline void iget_failed(struct inode *inode)
+{
+	make_bad_inode(inode);
+	unlock_new_inode(inode);
+	iput(inode);
+}
+#endif
+
+#endif /* _AUFS_COMPAT_H_ */
--- a/fs/aufs/dentry.c	2008-03-10 15:41:21.000000000 -0400
+++ b/fs/aufs/dentry.c	2008-03-11 10:58:38.000000000 -0400
@@ -880,7 +880,7 @@ static int h_d_revalidate(struct dentry
 				e = au_hin_after_reval(p, dentry, bindex,
 						       nd->intent.open.file);
 #ifndef TestingFuse
-				au_update_fuse_h_inode(p->mnt, h_dentry);
+				au_update_fuse_h_inode(nd_mnt(p), h_dentry);
 				/*ignore*/
 #endif
 				if (unlikely(e && !err))
@@ -1084,8 +1084,8 @@ static int aufs_d_revalidate(struct dent
 	//todo: no more lower nameidata, only here. re-use it.
 
 	LKTRTrace("dentry %.*s\n", AuDLNPair(dentry));
-	if (nd && nd->dentry)
-		LKTRTrace("nd{%.*s, 0x%x}\n", AuDLNPair(nd->dentry), nd->flags);
+	if (nd && nd_dentry(nd))
+		LKTRTrace("nd{%.*s, 0x%x}\n", AuDLNPair(nd_dentry(nd)), nd->flags);
 	//dir case: AuDebugOn(dentry->d_parent != nd->dentry);
 	//remove failure case:AuDebugOn(!IS_ROOT(dentry) && d_unhashed(dentry));
 	AuDebugOn(!dentry->d_fsdata);
--- a/fs/aufs/i_op.c	2008-03-10 15:41:54.000000000 -0400
+++ b/fs/aufs/i_op.c	2008-03-11 10:58:38.000000000 -0400
@@ -52,8 +52,8 @@ static int h_permission(struct inode *h_
 	err = -EACCES;
 	if (unlikely((write_mask && IS_IMMUTABLE(h_inode))
 		     || ((mask & MAY_EXEC) && S_ISREG(h_inode->i_mode)
-			 && fake_nd && fake_nd->mnt
-			 && (fake_nd->mnt->mnt_flags & MNT_NOEXEC))
+			 && fake_nd && nd_mnt(fake_nd)
+			 && (nd_mnt(fake_nd)->mnt_flags & MNT_NOEXEC))
 		    ))
 		goto out;
 
@@ -170,7 +170,7 @@ static int aufs_permission(struct inode
 	LKTRTrace("ino %lu, mask 0x%x, nondir %d, write_mask %d, "
 		  "nd %d{%d, %d}\n",
 		  inode->i_ino, mask, nondir, write_mask,
-		  !!nd, nd ? !!nd->dentry : 0, nd ? !!nd->mnt : 0);
+		  !!nd, nd ? !!nd_dentry(nd) : 0, nd ? !!nd_mnt(nd) : 0);
 
 	sb = inode->i_sb;
 	locked = silly_lock(inode, nd);
@@ -869,7 +869,8 @@ static void *aufs_follow_link(struct den
 	char *buf;
 	mm_segment_t old_fs;
 
-	LKTRTrace("%.*s, nd %.*s\n", AuDLNPair(dentry), AuDLNPair(nd->dentry));
+	LKTRTrace("%.*s, nd %.*s\n", AuDLNPair(dentry),
+		  AuDLNPair(nd_dentry(nd)));
 
 	err = -ENOMEM;
 	buf = __getname();
--- a/fs/aufs/inode.c	2008-03-10 15:41:22.000000000 -0400
+++ b/fs/aufs/inode.c	2008-03-11 10:58:38.000000000 -0400
@@ -323,17 +323,17 @@ struct inode *au_new_inode(struct dentry
 
 	LKTRTrace("%lx, new %d\n", inode->i_state, !!(inode->i_state & I_NEW));
 	if (inode->i_state & I_NEW) {
-		sb->s_op->read_inode(inode);
-		if (!is_bad_inode(inode)) {
-			ii_write_lock_new(inode);
-			err = set_inode(inode, dentry);
-			//err = -1;
+		err = aufs_read_inode(inode);
+		if (err)
+			goto out_iput;
+		ii_write_lock_new(inode);
+		err = set_inode(inode, dentry);
+		if (err) {
+			ii_write_unlock(inode);
+			goto out_iput;
 		}
 		unlock_new_inode(inode);
-		if (!err)
-			goto out; /* success */
-		ii_write_unlock(inode);
-		goto out_iput;
+		goto out;
 	} else {
 		err = reval_inode(inode, dentry, &match);
 		if (!err)
@@ -372,7 +372,7 @@ struct inode *au_new_inode(struct dentry
 	/* force noxino? */
 
  out_iput:
-	iput(inode);
+	iget_failed(inode);
 	inode = ERR_PTR(err);
  out:
 	AuTraceErrPtr(inode);
--- a/fs/aufs/inode.h	2008-03-10 15:41:22.000000000 -0400
+++ b/fs/aufs/inode.h	2008-03-11 10:58:38.000000000 -0400
@@ -51,6 +51,7 @@ struct aufs_icntnr {
 int au_refresh_hinode_self(struct inode *inode);
 int au_refresh_hinode(struct inode *inode, struct dentry *dentry);
 struct inode *au_new_inode(struct dentry *dentry);
+int aufs_read_inode(struct inode *inode);
 
 /* i_op.c */
 extern struct inode_operations aufs_iop, aufs_symlink_iop, aufs_dir_iop;
--- a/fs/aufs/misc.c	2008-03-10 15:41:22.000000000 -0400
+++ b/fs/aufs/misc.c	2008-03-11 10:58:38.000000000 -0400
@@ -22,6 +22,7 @@
 //#include <linux/namei.h>
 //#include <linux/mm.h>
 //#include <asm/uaccess.h>
+#include "compat.h"
 #include "aufs.h"
 
 void *au_kzrealloc(void *p, unsigned int nused, unsigned int new_sz, gfp_t gfp)
@@ -86,19 +87,19 @@ struct nameidata *au_fake_dm(struct name
 	if (!nd)
 		return NULL;
 
-	fake_nd->dentry = NULL;
-	fake_nd->mnt = NULL;
+	nd_dentry(fake_nd) = NULL;
+	nd_mnt(fake_nd) = NULL;
 
 #ifndef CONFIG_AUFS_FAKE_DM
 	DiMustAnyLock(nd->dentry);
 
-	if (bindex <= dbend(nd->dentry))
-		fake_nd->dentry = au_h_dptr_i(nd->dentry, bindex);
-	if (fake_nd->dentry) {
-		dget(fake_nd->dentry);
-		fake_nd->mnt = sbr_mnt(sb, bindex);
-		AuDebugOn(!fake_nd->mnt);
-		mntget(fake_nd->mnt);
+	if (bindex <= dbend(nd_dentry(nd)))
+		nd_dentry(fake_nd) = au_h_dptr_i(nd_dentry(nd), bindex);
+	if (nd_dentry(fake_nd)) {
+		dget(nd_dentry(fake_nd));
+		nd_mnt(fake_nd) = sbr_mnt(sb, bindex);
+		AuDebugOn(!nd_mnt(fake_nd));
+		mntget(nd_mnt(fake_nd));
 	} else
 		fake_nd = ERR_PTR(-ENOENT);
 #endif
@@ -111,8 +112,8 @@ void au_fake_dm_release(struct nameidata
 {
 #ifndef CONFIG_AUFS_FAKE_DM
 	if (fake_nd) {
-		mntput(fake_nd->mnt);
-		dput(fake_nd->dentry);
+		mntput(nd_mnt(fake_nd));
+		dput(nd_dentry(fake_nd));
 	}
 #endif
 }
--- a/fs/aufs/opts.c	2008-03-10 15:41:22.000000000 -0400
+++ b/fs/aufs/opts.c	2008-03-11 10:58:38.000000000 -0400
@@ -452,7 +452,7 @@ static void dump_opts(struct au_opts *op
 			u.add = &opt->add;
 			LKTRTrace("add {b%d, %s, 0x%x, %p}\n",
 				  u.add->bindex, u.add->path, u.add->perm,
-				  u.add->nd.dentry);
+				  nd_dentry(&u.add->nd));
 			break;
 		case Opt_del:
 		case Opt_idel:
@@ -469,13 +469,13 @@ static void dump_opts(struct au_opts *op
 			u.add = &opt->add;
 			LKTRTrace("append {b%d, %s, 0x%x, %p}\n",
 				  u.add->bindex, u.add->path, u.add->perm,
-				  u.add->nd.dentry);
+				  nd_dentry(&u.add->nd));
 			break;
 		case Opt_prepend:
 			u.add = &opt->add;
 			LKTRTrace("prepend {b%d, %s, 0x%x, %p}\n",
 				  u.add->bindex, u.add->path, u.add->perm,
-				  u.add->nd.dentry);
+				  nd_dentry(&u.add->nd));
 			break;
 		case Opt_dirwh:
 			LKTRTrace("dirwh %d\n", opt->dirwh);
@@ -660,7 +660,7 @@ static int opt_add(struct au_opt *opt, c
 	if (!err) {
 		if (!p /* && add->perm == AuBr_Last */) {
 			add->perm = AuBr_RO;
-			if (au_test_def_rr(add->nd.dentry->d_sb))
+			if (au_test_def_rr(nd_dentry(&add->nd)->d_sb))
 				add->perm = AuBr_RR;
 			if (!bindex && !(sb->s_flags & MS_RDONLY))
 				add->perm = AuBr_RW;
@@ -760,7 +760,7 @@ int au_opts_parse(struct super_block *sb
 				    u.del->path, err);
 				break;
 			}
-			u.del->h_root = dget(nd.dentry);
+			u.del->h_root = dget(nd_dentry(&nd));
 			path_release(&nd);
 			opt->type = token;
 			break;
@@ -806,7 +806,7 @@ int au_opts_parse(struct super_block *sb
 				    u.mod->path, err);
 				break;
 			}
-			u.mod->h_root = dget(nd.dentry);
+			u.mod->h_root = dget(nd_dentry(&nd));
 			path_release(&nd);
 			opt->type = token;
 			break;
@@ -868,7 +868,7 @@ int au_opts_parse(struct super_block *sb
 			aufs_read_lock(root, AuLock_FLUSH);
 			bend = sbend(sb);
 			for (bindex = 0; bindex <= bend; bindex++) {
-				if (au_h_dptr_i(root, bindex) == nd.dentry) {
+				if (au_h_dptr_i(root, bindex) == nd_dentry(&nd)) {
 					u.xino_itrunc->bindex = bindex;
 					break;
 				}
--- a/fs/aufs/super.c	2008-03-10 15:41:22.000000000 -0400
+++ b/fs/aufs/super.c	2008-03-11 10:58:38.000000000 -0400
@@ -42,6 +42,7 @@ typedef struct namespace au_mnt_ns_t;
 #define au_mnt_ns(tsk)	(tsk)->namespace
 #endif
 
+#include "compat.h"
 #include "aufs.h"
 
 /*
@@ -73,7 +74,7 @@ static void aufs_destroy_inode(struct in
 }
 
 //todo: how about merge with alloc_inode()?
-static void aufs_read_inode(struct inode *inode)
+int aufs_read_inode(struct inode *inode)
 {
 	int err;
 #if 0
@@ -93,11 +94,11 @@ static void aufs_read_inode(struct inode
 		inode->i_fop = &aufs_file_fop;
 		inode->i_mapping->a_ops = &aufs_aop;
 		//inode->i_mapping->backing_dev_info = &bdi;
-		return; /* success */
+		return err; /* success */
 	}
 
 	LKTRTrace("intializing inode info failed(%d)\n", err);
-	make_bad_inode(inode);
+	return err;
 }
 
 int au_show_brs(struct seq_file *seq, struct super_block *sb)
@@ -114,8 +115,8 @@ int au_show_brs(struct seq_file *seq, st
 	err = 0;
 	bend = sbend(sb);
 	for (bindex = 0; !err && bindex <= bend; bindex++) {
-		err = seq_path(seq, sbr_mnt(sb, bindex),
-			       au_h_dptr_i(root, bindex), au_esc_chars);
+		err = compat_seq_path(seq, sbr_mnt(sb, bindex),
+				      au_h_dptr_i(root, bindex), au_esc_chars);
 		if (err > 0)
 			err = seq_printf
 				(seq, "=%s",
@@ -148,7 +149,8 @@ static int aufs_show_options(struct seq_
 		if (unlikely(err))
 			goto out;
 		xino = sbinfo->si_xib;
-		err = seq_path(m, xino->f_vfsmnt, xino->f_dentry, au_esc_chars);
+		err = compat_seq_path(m, xino->f_vfsmnt, xino->f_dentry,
+				      au_esc_chars);
 		if (unlikely(err <= 0))
 			goto out;
 		err = 0;
@@ -747,7 +749,6 @@ static int aufs_remount_fs(struct super_
 static struct super_operations aufs_sop = {
 	.alloc_inode	= aufs_alloc_inode,
 	.destroy_inode	= aufs_destroy_inode,
-	.read_inode	= aufs_read_inode,
 	//.dirty_inode	= aufs_dirty_inode,
 	//.write_inode	= aufs_write_inode,
 	//void (*put_inode) (struct inode *);
@@ -856,18 +857,24 @@ static int alloc_root(struct super_block
 	AuTraceEnter();
 
 	err = -ENOMEM;
-	inode = iget(sb, AUFS_ROOT_INO);
+	inode = iget_locked(sb, AUFS_ROOT_INO);
 	//if (LktrCond) {iput(inode); inode = NULL;}
 	if (unlikely(!inode))
 		goto out;
 	err = PTR_ERR(inode);
 	if (IS_ERR(inode))
 		goto out;
-	err = -ENOMEM;
-	if (unlikely(is_bad_inode(inode)))
-		goto out_iput;
+	err = -EINVAL;
+	if (inode->i_state & I_NEW) {
+		err = aufs_read_inode(inode);
+		if (err) {
+			iget_failed(inode);
+			goto out;
+		}
+	}
 
 	inode->i_mode = S_IFDIR;
+	unlock_new_inode(inode);
 	root = d_alloc_root(inode);
 	//if (LktrCond) {igrab(inode); dput(root); root = NULL;}
 	if (unlikely(!root))
--- a/fs/aufs/sysaufs.c	2008-03-11 10:58:13.000000000 -0400
+++ b/fs/aufs/sysaufs.c	2008-03-11 10:58:38.000000000 -0400
@@ -26,6 +26,7 @@
 #include <linux/fs.h>
 #include <../fs/sysfs/sysfs.h>
 #endif
+#include "compat.h"
 #include "aufs.h"
 
 /* ---------------------------------------------------------------------- */
@@ -127,7 +128,17 @@ SbFuncBody(_index, func)
 	SbFunc(read_##name, index, sysaufs_read) \
 	SbFunc(write_##name, index, sysaufs_free_write)
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 24)
+static struct kset *aufs_subsys;
+#define AUFS_SUBSYS aufs_subsys
+
+/* No, not really, but we'll handle fs_kobj manually */
+#define FS_SUBSYS NULL
+#else
 static decl_subsys(aufs, NULL, NULL);
+#define AUFS_SUBSYS &aufs_subsys
+#define FS_SUBSYS &fs_subsys
+#endif
 enum {
 	Brs, Stat, Config,
 #ifdef CONFIG_AUFS_DEBUG
@@ -252,22 +263,34 @@ static void unreg(au_subsys_t *subsys, s
 				free_entry(a);
 		}
 
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 24)
+	kset_unregister(subsys);
+#else
 	subsystem_unregister(subsys);
 	subsys_put(parent);
+#endif
 }
 
 static int reg(au_subsys_t *subsys, struct sysaufs_entry *a, int n,
 	       au_subsys_t *parent)
 {
-	int err, i;
+	int err = 0, i;
 
 	AuTraceEnter();
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 24)
+	if (!subsys->kobj.parent) {
+		subsys->kobj.parent = &aufs_subsys->kobj;
+		kset_register(subsys);
+	}
+#else
 	subsys_get(parent);
 	kobj_set_kset_s(&au_subsys_to_kset(*subsys), *parent);
 	err = subsystem_register(subsys);
 	if (unlikely(err))
 		goto out;
+#endif
 
 	for (i = 0; !err && i < n; i++) {
 		a[i].err = sysfs_create_bin_file
@@ -277,7 +300,7 @@ static int reg(au_subsys_t *subsys, stru
 	if (unlikely(err))
 		unreg(subsys, a, n, parent);
 
- out:
+out:
 	AuTraceErr(err);
 	return err;
 }
@@ -302,8 +325,9 @@ void sysaufs_add(struct aufs_sbinfo *sbi
 	SbSetEntry(SysaufsSb_XINO, xino, 128);
 	err = kobject_set_name(&au_subsys_to_kset(sa->subsys).kobj, "%p",
 			       sbinfo->si_mnt->mnt_sb);
+
 	if (!err)
-		err = reg(&sa->subsys, sa->array, SysaufsSb_Last, &aufs_subsys);
+		err = reg(&sa->subsys, sa->array, SysaufsSb_Last, AUFS_SUBSYS);
 	if (unlikely(err))
 		AuWarn("failed adding sysfs (%d)\n", err);
 
@@ -317,7 +341,7 @@ void sysaufs_del(struct aufs_sbinfo *sbi
 	AuTraceEnter();
 
 	mutex_lock(&aufs_sbilist_mtx);
-	unreg(&sa->subsys, sa->array, SysaufsSb_Last, &aufs_subsys);
+	unreg(&sa->subsys, sa->array, SysaufsSb_Last, AUFS_SUBSYS);
 	list_del(&sbinfo->si_list);
 	free_entries();
 	mutex_unlock(&aufs_sbilist_mtx);
@@ -358,7 +382,7 @@ static int make_brs(struct seq_file *seq
 		if (!err)
 			err = seq_putc(seq, ' ');
 		if (!err)
-			err = seq_path(seq, mnt, root, au_esc_chars);
+			err = compat_seq_path(seq, mnt, root, au_esc_chars);
 		if (err > 0)
 			err = seq_printf(seq, " %p br:", sb);
 		if (!err)
@@ -697,7 +721,7 @@ static sysaufs_op g_ops[] = {
 
 int __init sysaufs_init(void)
 {
-	int err;
+	int err = 0;
 
 	GSetEntry(Brs, brs, 128);
 	GSetEntry(Stat, stat, 32);
@@ -705,7 +729,15 @@ int __init sysaufs_init(void)
 #ifdef CONFIG_AUFS_DEBUG
 	GSetEntry(Debug, debug, 32);
 #endif
-	err = reg(&aufs_subsys, g_array, _Last, &fs_subsys);
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 24)
+	aufs_subsys = kset_create_and_add("aufs", NULL, fs_kobj);
+	if (!aufs_subsys)
+		err = -ENOMEM;
+#endif
+
+	if (!err)
+		err = reg(AUFS_SUBSYS, g_array, _Last, FS_SUBSYS);
 	AuTraceErr(err);
 	return err;
 }
@@ -713,7 +745,7 @@ int __init sysaufs_init(void)
 void sysaufs_fin(void)
 {
 	mutex_lock(&aufs_sbilist_mtx);
-	unreg(&aufs_subsys, g_array, _Last, &fs_subsys);
+	unreg(AUFS_SUBSYS, g_array, _Last, FS_SUBSYS);
 	mutex_unlock(&aufs_sbilist_mtx);
 }
 
--- a/fs/aufs/vfsub.c	2008-03-11 10:58:13.000000000 -0400
+++ b/fs/aufs/vfsub.c	2008-03-11 10:58:38.000000000 -0400
@@ -94,7 +94,7 @@ int do_vfsub_create(struct inode *dir, s
 	if (!err) {
 		mnt = NULL;
 		if (nd)
-			mnt = nd->mnt;
+			mnt = nd_mnt(nd);
 		/* dir inode is locked */
 		au_update_fuse_h_inode(mnt, dentry->d_parent); /*ignore*/
 		au_update_fuse_h_inode(mnt, dentry); /*ignore*/
--- a/fs/aufs/vfsub.h	2008-03-10 15:41:22.000000000 -0400
+++ b/fs/aufs/vfsub.h	2008-03-11 10:58:38.000000000 -0400
@@ -33,6 +33,8 @@
 #include <linux/inotify.h>
 #endif
 
+#include "compat.h"
+
 /* ---------------------------------------------------------------------- */
 
 /* vfsub flags */
@@ -284,7 +286,7 @@ int vfsub_path_lookup(const char *name,
 	err = path_lookup(name, flags, nd);
 	/* lockdep_on(); */
 	if (!err)
-		au_update_fuse_h_inode(nd->mnt, nd->dentry); /*ignore*/
+		au_update_fuse_h_inode(nd_mnt(nd), nd_dentry(nd)); /*ignore*/
 	return err;
 }
 
@@ -336,7 +338,7 @@ int vfsub_vfs_path_lookup(struct dentry
 	err = vfs_path_lookup(parent, mnt, name, flags, nd);
 	lockdep_on();
 	if (!err)
-		au_update_fuse_h_inode(mnt, nd->dentry); /*ignore*/
+		au_update_fuse_h_inode(mnt, nd_dentry(nd)); /*ignore*/
 
 	AuTraceErr(err);
 	return err;
--- a/fs/aufs/xino.c	2008-03-10 15:41:22.000000000 -0400
+++ b/fs/aufs/xino.c	2008-03-11 10:58:38.000000000 -0400
@@ -1195,8 +1195,9 @@ struct file *xino_def(struct super_block
 		//if (LktrCond) {__putname(page); page = NULL;}
 		if (unlikely(!page))
 			goto out;
-		p = d_path(au_h_dptr_i(sb->s_root, bwr), sbr_mnt(sb, bwr), page,
-			   PATH_MAX - sizeof(AUFS_XINO_FNAME));
+		p = compat_d_path(au_h_dptr_i(sb->s_root, bwr),
+				  sbr_mnt(sb, bwr), page,
+				  PATH_MAX - sizeof(AUFS_XINO_FNAME));
 		//if (LktrCond) p = ERR_PTR(-1);
 		file = (void *)p;
 		if (p && !IS_ERR(p)) {

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Reply via email to