@@ -0,0 +1,855 @@
+diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/autoconf/cachector1.c ./vmblock/autoconf/cachector1.c
+--- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/autoconf/cachector1.c 1969-12-31 16:00:00.000000000 -0800
++++ ./vmblock/autoconf/cachector1.c 2008-08-24 02:51:19.000000000 -0700
+@@ -0,0 +1,38 @@
++/*********************************************************
++ * Copyright (C) 2008 VMware, Inc. All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation version 2 and no later version.
++ *
++ * This program is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
++ * for more details.
++ *
++ * You should have received a copy of the GNU General Public License along
++ * with this program; if not, write to the Free Software Foundation, Inc.,
++ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ *********************************************************/
++
++#include <linux/autoconf.h>
++#include <linux/version.h>
++
++/*
++ * Between 2.6.27-rc1 and 2.6.27-rc2 ctor prototype was changed from
++ * ctor(cache, ptr) to ctor(ptr). Unfortunately there
++ * is no typedef for ctor, so we have to redefine kmem_cache_create
++ * to find out ctor prototype. If prototype matches, then this is old
++ * kernel.
++ */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)
++#error "This test intentionally fails on 2.6.28 and newer kernels."
++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
++#include <linux/slab.h>
++
++struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
++ unsigned long,
++ void (*)(struct kmem_cache *, void *));
++
++#endif
+diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_sched.h ./vmblock/include/compat_sched.h
+--- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_sched.h 2008-04-28 15:36:04.000000000 -0700
++++ ./vmblock/include/compat_sched.h 2008-08-24 02:51:19.000000000 -0700
+@@ -271,4 +271,21 @@
+ #define compat_set_freezable() do {} while (0)
+ #endif
+
++/*
++ * Since 2.6.27-rc2 kill_proc() is gone... Replacement (GPL-only!)
++ * API is available since 2.6.19. Use them from 2.6.27-rc1 up.
++ */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
++typedef int compat_pid;
++#define compat_find_get_pid(pid) (pid)
++#define compat_put_pid(pid) do { } while (0)
++#define compat_kill_pid(pid, sig, flag) kill_proc(pid, sig, flag)
++#else
++typedef struct pid * compat_pid;
++#define compat_find_get_pid(pid) find_get_pid(pid)
++#define compat_put_pid(pid) put_pid(pid)
++#define compat_kill_pid(pid, sig, flag) kill_pid(pid, sig, flag)
++#endif
++
++
+ #endif /* __COMPAT_SCHED_H__ */
+diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_semaphore.h ./vmblock/include/compat_semaphore.h
+--- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_semaphore.h 2008-04-28 15:36:04.000000000 -0700
++++ ./vmblock/include/compat_semaphore.h 2008-08-24 02:51:19.000000000 -0700
+@@ -20,7 +20,12 @@
+ # define __COMPAT_SEMAPHORE_H__
+
+
+-#include <asm/semaphore.h>
++/* <= 2.6.25 have asm only, 2.6.26 has both, and 2.6.27-rc2+ has linux only. */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
++# include <asm/semaphore.h>
++#else
++# include <linux/semaphore.h>
++#endif
+
+
+ /*
+diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_slab.h ./vmblock/include/compat_slab.h
+--- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_slab.h 2008-04-28 15:36:04.000000000 -0700
++++ ./vmblock/include/compat_slab.h 2008-08-24 02:51:19.000000000 -0700
+@@ -57,14 +57,29 @@
+ * Up to 2.6.23 kmem_cache constructor has three arguments - pointer to block to
+ * prepare (aka "this"), from which cache it came, and some unused flags. After
+ * 2.6.23 flags were removed, and order of "this" and cache parameters was swapped...
++ * Since 2.6.27-rc2 everything is different again, and ctor has only one argument.
++ *
++ * HAS_3_ARGS has precedence over HAS_2_ARGS if both are defined.
+ */
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) && !defined(VMW_KMEMCR_CTOR_HAS_3_ARGS)
+ # define VMW_KMEMCR_CTOR_HAS_3_ARGS
+ #endif
+-#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && !defined(VMW_KMEMCR_CTOR_HAS_2_ARGS)
++# define VMW_KMEMCR_CTOR_HAS_2_ARGS
++#endif
++
++#if defined(VMW_KMEMCR_CTOR_HAS_3_ARGS)
+ typedef void compat_kmem_cache_ctor(void *, compat_kmem_cache *, unsigned long);
+-#else
++#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg, \
++ compat_kmem_cache *cache, \
++ unsigned long flags
++#elif defined(VMW_KMEMCR_CTOR_HAS_2_ARGS)
+ typedef void compat_kmem_cache_ctor(compat_kmem_cache *, void *);
++#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) compat_kmem_cache *cache, \
++ void *arg
++#else
++typedef void compat_kmem_cache_ctor(void *);
++#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg
+ #endif
+
+ #endif /* __COMPAT_SLAB_H__ */
+diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/linux/filesystem.c ./vmblock/linux/filesystem.c
+--- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/linux/filesystem.c 2008-04-28 15:36:04.000000000 -0700
++++ ./vmblock/linux/filesystem.c 2008-08-24 02:51:19.000000000 -0700
+@@ -411,19 +411,11 @@
+ *----------------------------------------------------------------------------
+ */
+
+-#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS
+ static void
+-InodeCacheCtor(void *slabElem, // IN: allocated slab item to initialize
+- compat_kmem_cache *cache, // IN: cache slab is from
+- unsigned long flags) // IN: flags associated with allocation
+-#else
+-static void
+-InodeCacheCtor(compat_kmem_cache *cache, // IN: cache slab is from
+- void *slabElem) // IN: allocated slab item to initialize
+-#endif
++InodeCacheCtor(COMPAT_KMEM_CACHE_CTOR_ARGS(slabElem)) // IN: allocated slab item to initialize
+ {
+ #ifdef VMW_EMBED_INODE
+- VMBlockInodeInfo *iinfo = (VMBlockInodeInfo *)slabElem;
++ VMBlockInodeInfo *iinfo = slabElem;
+
+ inode_init_once(&iinfo->inode);
+ #endif
+diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/Makefile.kernel ./vmblock/Makefile.kernel
+--- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/Makefile.kernel 2008-04-28 15:36:04.000000000 -0700
++++ ./vmblock/Makefile.kernel 2008-08-24 02:51:19.000000000 -0700
+@@ -25,7 +25,8 @@
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/epoll.c, -DVMW_HAVE_EPOLL, )
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/skas1.c, -DVMW_SKAS_MMAP, )
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachecreate.c, -DVMW_KMEMCR_HAS_DTOR, )
+-EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachector.c, -DVMW_KMEMCR_CTOR_HAS_3_ARGS, )
++EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachector.c, -DVMW_KMEMCR_CTOR_HAS_3_ARGS, )
++EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachector1.c, -DVMW_KMEMCR_CTOR_HAS_2_ARGS, )
+
+ # Note: These tests are inverted.
+ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/getsb1.c, , -DVMW_GETSB_2618)
+diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmci/compat_sched.h ./vmci/compat_sched.h
+--- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmci/compat_sched.h 2008-08-11 12:40:15.000000000 -0700
++++ ./vmci/compat_sched.h 2008-08-24 02:51:23.000000000 -0700
+@@ -271,4 +271,21 @@
+ #define compat_set_freezable() do {} while (0)
+ #endif
+
++/*
++ * Since 2.6.27-rc2 kill_proc() is gone... Replacement (GPL-only!)
++ * API is available since 2.6.19. Use them from 2.6.27-rc1 up.
++ */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
++typedef int compat_pid;
++#define compat_find_get_pid(pid) (pid)
++#define compat_put_pid(pid) do { } while (0)
++#define compat_kill_pid(pid, sig, flag) kill_proc(pid, sig, flag)
++#else
++typedef struct pid * compat_pid;
++#define compat_find_get_pid(pid) find_get_pid(pid)
++#define compat_put_pid(pid) put_pid(pid)
++#define compat_kill_pid(pid, sig, flag) kill_pid(pid, sig, flag)
++#endif
++
++
+ #endif /* __COMPAT_SCHED_H__ */
+diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmci/compat_semaphore.h ./vmci/compat_semaphore.h
+--- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmci/compat_semaphore.h 2008-08-11 12:40:15.000000000 -0700
++++ ./vmci/compat_semaphore.h 2008-08-24 02:51:22.000000000 -0700
+@@ -20,7 +20,12 @@
+ # define __COMPAT_SEMAPHORE_H__
+
+
+-#include <asm/semaphore.h>
++/* <= 2.6.25 have asm only, 2.6.26 has both, and 2.6.27-rc2+ has linux only. */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
++# include <asm/semaphore.h>
++#else
++# include <linux/semaphore.h>
++#endif
+
+
+ /*
|