Code:
diff -up -r aufs-20070327/fs/aufs/aufs.h aufs-20070327-new/fs/aufs/aufs.h
--- aufs-20070327/fs/aufs/aufs.h 2007-03-27 23:41:11.000000000 +0200
+++ aufs-20070327-new/fs/aufs/aufs.h 2007-03-28 18:21:04.694373683 +0200
@@ -22,11 +22,19 @@
#define __AUFS_H__
#include <linux/version.h>
+#include <linux/types.h> /* for size_t */
/* ---------------------------------------------------------------------- */
-// limited support before 2.6.16, curretly 2.6.15 only.
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,15)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
+# define LOCK_INODE(inode) mutex_lock(&(inode)->i_mutex)
+# define UNLOCK_INODE(inode) mutex_unlock(&(inode)->i_mutex)
+#else
+# define LOCK_INODE(inode) down(&(inode)->i_sem)
+# define UNLOCK_INODE(inode) up(&(inode)->i_sem)
+#endif
+
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
#define atomic_long_t atomic_t
#define atomic_long_set atomic_set
#define timespec_to_ns(ts) ({(long long)(ts)->tv_sec;})
@@ -35,6 +43,19 @@
#define D_CHILD d_u.d_child
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+# ifdef __CHECKER__
+# define __bitwise__ __attribute__((bitwise))
+# else
+# define __bitwise__
+# endif
+
+typedef unsigned __bitwise__ gfp_t;
+void *kzalloc(size_t size, gfp_t flags);
+
+#define do_exit(a) /* not yet exported */
+#endif
+
/* ---------------------------------------------------------------------- */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
diff -up -r aufs-20070327/fs/aufs/branch.c aufs-20070327-new/fs/aufs/branch.c
--- aufs-20070327/fs/aufs/branch.c 2007-03-27 23:41:11.000000000 +0200
+++ aufs-20070327-new/fs/aufs/branch.c 2007-03-28 16:16:01.956799716 +0200
@@ -740,5 +740,5 @@
dput(br->br_plink);
br->br_plink = NULL;
}
-#if 1 // test here
+#if 0 // test here
// no need file_list_lock() since sbinfo is locked
diff -up -r aufs-20070327/fs/aufs/branch.h aufs-20070327-new/fs/aufs/branch.h
--- aufs-20070327/fs/aufs/branch.h 2007-03-27 23:41:11.000000000 +0200
+++ aufs-20070327-new/fs/aufs/branch.h 2007-03-29 09:42:07.897314461 +0200
@@ -100,10 +100,10 @@
/* --------------------------------------------------------------------- */
#define _AufsNoNfsBranchMsg "NFS branch is not supported"
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,15)
-#define AufsNoNfsBranch
-#define AufsNoNfsBranchMsg _AufsNoNfsBranchMsg
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) \
+//#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
+//#define AufsNoNfsBranch
+//#define AufsNoNfsBranchMsg _AufsNoNfsBranchMsg
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) \
&& !defined(CONFIG_AUFS_LHASH_PATCH)
#define AufsNoNfsBranch
#define AufsNoNfsBranchMsg _AufsNoNfsBranchMsg \
diff -up -r aufs-20070327/fs/aufs/debug.h aufs-20070327-new/fs/aufs/debug.h
--- aufs-20070327/fs/aufs/debug.h 2007-03-27 23:41:12.000000000 +0200
+++ aufs-20070327-new/fs/aufs/debug.h 2007-03-28 15:40:51.459788803 +0200
@@ -31,10 +31,14 @@
#define DEBUG_ON(a) /* */
#endif
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
static inline void MtxMustLock(struct mutex *mtx)
{
DEBUG_ON(!mutex_is_locked(mtx));
}
+#else
+#define MtxMustLock(a) /* */
+#endif
/* ---------------------------------------------------------------------- */
diff -up -r aufs-20070327/fs/aufs/file.c aufs-20070327-new/fs/aufs/file.c
--- aufs-20070327/fs/aufs/file.c 2007-03-27 23:41:12.000000000 +0200
+++ aufs-20070327-new/fs/aufs/file.c 2007-03-28 20:46:58.563987042 +0200
@@ -702,7 +702,7 @@ static int aufs_commit_write(struct file
{BUG();return 0;}
static int aufs_writepage(struct page *page, struct writeback_control *wbc)
{BUG();return 0;}
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,15)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
static int aufs_sync_page(struct page *page)
{BUG(); return 0;}
#else
@@ -724,6 +724,6 @@
static int aufs_set_page_dirty(struct page *page)
{BUG();return 0;}
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,15)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
static int aufs_invalidatepage (struct page *page, unsigned long offset)
{BUG(); return 0;}
#else
@@ -810,7 +810,9 @@
.invalidatepage = aufs_invalidatepage,
.releasepage = aufs_releasepage,
.direct_IO = aufs_direct_IO,
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)
.get_xip_page = aufs_get_xip_page,
//.migratepage = aufs_migratepage
#endif
+#endif
};
diff -up -r aufs-20070327/fs/aufs/f_op.c aufs-20070327-new/fs/aufs/f_op.c
--- aufs-20070327/fs/aufs/f_op.c 2007-03-27 23:41:12.000000000 +0200
+++ aufs-20070327-new/fs/aufs/f_op.c 2007-03-28 17:48:41.118229760 +0200
@@ -18,7 +18,10 @@
/* $Id: f_op.c,v 1.21 2007/03/27 12:49:00 sfjro Exp $ */
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
#include <linux/fsnotify.h>
+#endif
#include <linux/pagemap.h>
#include <linux/poll.h>
#include <linux/security.h>
diff -up -r aufs-20070327/fs/aufs/inode.h aufs-20070327-new/fs/aufs/inode.h
--- aufs-20070327/fs/aufs/inode.h 2007-03-27 23:41:12.000000000 +0200
+++ aufs-20070327-new/fs/aufs/inode.h 2007-03-28 15:42:06.004684827 +0200
@@ -22,7 +22,9 @@
#define __AUFS_INODE_H__
#include <linux/fs.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
#include <linux/inotify.h>
+#endif
#include <linux/version.h>
#include <linux/aufs_type.h>
#include "misc.h"
@@ -60,7 +60,7 @@
struct aufs_iinfo iinfo;
struct inode vfs_inode;
};
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,15)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
#define i_lock(i) down(&(i)->i_sem)
#define i_unlock(i) up(&(i)->i_sem)
diff -up -r aufs-20070327/fs/aufs/misc.c aufs-20070327-new/fs/aufs/misc.c
--- aufs-20070327/fs/aufs/misc.c 2007-03-27 23:41:12.000000000 +0200
+++ aufs-20070327-new/fs/aufs/misc.c 2007-03-28 17:43:12.461373007 +0200
@@ -24,5 +24,15 @@
#include <asm/uaccess.h>
#include "aufs.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
+void *kzalloc(size_t size, gfp_t flags)
+{
+ void *ret = kmalloc(size, flags);
+ if (ret)
+ memset(ret, 0, size);
+ return ret;
+}
+#endif
+
/*
* @hidden_dir: must be locked.
@@ -263,9 +273,14 @@
/* the last block may be a hole */
if (unlikely(!err && all_zero)) {
struct iattr ia = {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
.ia_size = dst->f_pos,
.ia_valid = ATTR_SIZE | ATTR_FILE,
.ia_file = dst
+#else
+ .ia_size = dst->f_pos,
+ .ia_valid = ATTR_SIZE,
+#endif
};
struct dentry *h_d = dst->f_dentry;
struct inode *h_i = h_d->d_inode;
diff -up -r aufs-20070327/fs/aufs/whout.c aufs-20070327-new/fs/aufs/whout.c
--- aufs-20070327/fs/aufs/whout.c 2007-03-27 23:41:12.000000000 +0200
+++ aufs-20070327-new/fs/aufs/whout.c 2007-03-28 17:37:27.529700059 +0200
@@ -20,6 +20,7 @@
#include <linux/fs.h>
#include <linux/kthread.h>
+#include <linux/kernel.h>
#include <linux/namei.h>
#include <linux/random.h>
#include <linux/security.h>
diff -up -r aufs-20070327/fs/aufs/xino.c aufs-20070327-new/fs/aufs/xino.c
--- aufs-20070327/fs/aufs/xino.c 2007-03-27 23:41:13.000000000 +0200
+++ aufs-20070327-new/fs/aufs/xino.c 2007-03-28 17:49:08.086895101 +0200
@@ -19,7 +19,10 @@
/* $Id: xino.c,v 1.22 2007/03/27 12:51:44 sfjro Exp $ */
//#include <linux/fs.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
#include <linux/fsnotify.h>
+#endif
#include <asm/uaccess.h>
#include "aufs.h"
diff -up -r aufs-20070327/local.mk aufs-20070327-new/local.mk
--- aufs-20070327/local.mk 2007-03-27 23:41:11.000000000 +0200
+++ aufs-20070327-new/local.mk 2007-03-28 15:54:57.778188118 +0200
@@ -16,5 +16,5 @@
CONFIG_AUFS_LHASH_PATCH =
CONFIG_AUFS_KSIZE_PATCH =
-CONFIG_AUFS_DEBUG = y
+CONFIG_AUFS_DEBUG =
CONFIG_AUFS_DEBUG_RWSEM =
CONFIG_AUFS_COMPAT =
============= Next, copy this code and save it as "linuxrc":