[PATCH] UBUNTU: Update open-vm-tools kernel modules

Soren Hansen soren at ubuntu.com
Wed Dec 12 18:00:46 UTC 2007


Signed-off-by: Soren Hansen <soren at ubuntu.com>
---
 ubuntu/vmblock/Makefile                    |   49 ++++++---
 ubuntu/vmblock/Makefile.kernel             |   57 +++-------
 ubuntu/vmblock/Makefile.normal             |   41 ++++----
 ubuntu/vmblock/README                      |    4 +-
 ubuntu/vmblock/autoconf/cachecreate.c      |    8 +-
 ubuntu/vmblock/autoconf/epoll.c            |    8 +-
 ubuntu/vmblock/autoconf/filldir1.c         |    8 +-
 ubuntu/vmblock/autoconf/geninclude.c       |    8 +-
 ubuntu/vmblock/autoconf/getsb1.c           |    8 +-
 ubuntu/vmblock/autoconf/setnice.c          |    8 +-
 ubuntu/vmblock/autoconf/skas1.c            |    8 +-
 ubuntu/vmblock/autoconf/statfs1.c          |    8 +-
 ubuntu/vmblock/include/compat_completion.h |    8 +-
 ubuntu/vmblock/include/compat_file.h       |    8 +-
 ubuntu/vmblock/include/compat_fs.h         |   10 +-
 ubuntu/vmblock/include/compat_init.h       |    8 +-
 ubuntu/vmblock/include/compat_kernel.h     |    8 +-
 ubuntu/vmblock/include/compat_list.h       |   18 +++-
 ubuntu/vmblock/include/compat_mm.h         |    8 +-
 ubuntu/vmblock/include/compat_module.h     |    8 +-
 ubuntu/vmblock/include/compat_namei.h      |    8 +-
 ubuntu/vmblock/include/compat_page.h       |    8 +-
 ubuntu/vmblock/include/compat_sched.h      |   36 ++++++-
 ubuntu/vmblock/include/compat_semaphore.h  |    8 +-
 ubuntu/vmblock/include/compat_slab.h       |   27 ++++-
 ubuntu/vmblock/include/compat_spinlock.h   |    8 +-
 ubuntu/vmblock/include/compat_statfs.h     |    8 +-
 ubuntu/vmblock/include/compat_string.h     |    8 +-
 ubuntu/vmblock/include/compat_uaccess.h    |    8 +-
 ubuntu/vmblock/include/compat_version.h    |    8 +-
 ubuntu/vmblock/include/compat_wait.h       |    8 +-
 ubuntu/vmblock/include/driver-config.h     |    8 +-
 ubuntu/vmblock/include/vm_assert.h         |    9 +-
 ubuntu/vmblock/include/vm_basic_defs.h     |   36 +++++--
 ubuntu/vmblock/include/vm_basic_types.h    |  157 +++++++++++++++++-----------
 ubuntu/vmblock/include/vmblock.h           |    8 +-
 ubuntu/vmblock/include/vmware.h            |    9 +-
 ubuntu/vmblock/linux/block.c               |    8 +-
 ubuntu/vmblock/linux/block.h               |    8 +-
 ubuntu/vmblock/linux/control.c             |    8 +-
 ubuntu/vmblock/linux/dbllnklst.c           |    8 +-
 ubuntu/vmblock/linux/dbllnklst.h           |    8 +-
 ubuntu/vmblock/linux/dentry.c              |    8 +-
 ubuntu/vmblock/linux/file.c                |    8 +-
 ubuntu/vmblock/linux/filesystem.c          |    8 +-
 ubuntu/vmblock/linux/filesystem.h          |    8 +-
 ubuntu/vmblock/linux/inode.c               |    8 +-
 ubuntu/vmblock/linux/module.c              |    8 +-
 ubuntu/vmblock/linux/os.h                  |    8 +-
 ubuntu/vmblock/linux/stubs.c               |    8 +-
 ubuntu/vmblock/linux/stubs.h               |    8 +-
 ubuntu/vmblock/linux/super.c               |    8 +-
 ubuntu/vmblock/linux/vmblockInt.h          |    8 +-
 ubuntu/vmblock/linux/vmblock_version.h     |    8 +-
 ubuntu/vmhgfs/Makefile                     |   49 ++++++---
 ubuntu/vmhgfs/Makefile.kernel              |   47 +++-----
 ubuntu/vmhgfs/Makefile.normal              |   40 ++++----
 ubuntu/vmhgfs/autoconf/cachecreate.c       |    8 +-
 ubuntu/vmhgfs/autoconf/cachector.c         |   40 +++++++
 ubuntu/vmhgfs/autoconf/epoll.c             |    8 +-
 ubuntu/vmhgfs/autoconf/geninclude.c        |    8 +-
 ubuntu/vmhgfs/autoconf/getsb1.c            |    8 +-
 ubuntu/vmhgfs/autoconf/inode1.c            |    8 +-
 ubuntu/vmhgfs/autoconf/maxbytes.c          |    8 +-
 ubuntu/vmhgfs/autoconf/setnice.c           |    8 +-
 ubuntu/vmhgfs/autoconf/statfs1.c           |    8 +-
 ubuntu/vmhgfs/backdoor.c                   |   10 +-
 ubuntu/vmhgfs/backdoor.h                   |    8 +-
 ubuntu/vmhgfs/backdoorGcc32.c              |    8 +-
 ubuntu/vmhgfs/backdoorGcc64.c              |    8 +-
 ubuntu/vmhgfs/backdoorInt.h                |    8 +-
 ubuntu/vmhgfs/backdoor_def.h               |   12 ++-
 ubuntu/vmhgfs/bdhandler.c                  |    8 +-
 ubuntu/vmhgfs/bdhandler.h                  |    8 +-
 ubuntu/vmhgfs/compat_completion.h          |    8 +-
 ubuntu/vmhgfs/compat_dcache.h              |    8 +-
 ubuntu/vmhgfs/compat_file.h                |    8 +-
 ubuntu/vmhgfs/compat_fs.h                  |   10 +-
 ubuntu/vmhgfs/compat_highmem.h             |    8 +-
 ubuntu/vmhgfs/compat_kernel.h              |    8 +-
 ubuntu/vmhgfs/compat_list.h                |   18 +++-
 ubuntu/vmhgfs/compat_mm.h                  |    8 +-
 ubuntu/vmhgfs/compat_module.h              |    8 +-
 ubuntu/vmhgfs/compat_namei.h               |    8 +-
 ubuntu/vmhgfs/compat_page-flags.h          |    8 +-
 ubuntu/vmhgfs/compat_page.h                |    8 +-
 ubuntu/vmhgfs/compat_sched.h               |   36 ++++++-
 ubuntu/vmhgfs/compat_semaphore.h           |    8 +-
 ubuntu/vmhgfs/compat_slab.h                |   27 ++++-
 ubuntu/vmhgfs/compat_spinlock.h            |    8 +-
 ubuntu/vmhgfs/compat_statfs.h              |    8 +-
 ubuntu/vmhgfs/compat_string.h              |    8 +-
 ubuntu/vmhgfs/compat_uaccess.h             |    8 +-
 ubuntu/vmhgfs/compat_version.h             |    8 +-
 ubuntu/vmhgfs/compat_wait.h                |    8 +-
 ubuntu/vmhgfs/cpName.c                     |    8 +-
 ubuntu/vmhgfs/cpName.h                     |   19 +++-
 ubuntu/vmhgfs/cpNameInt.h                  |    8 +-
 ubuntu/vmhgfs/cpNameLinux.c                |    8 +-
 ubuntu/vmhgfs/cpNameLite.c                 |    8 +-
 ubuntu/vmhgfs/cpNameLite.h                 |    8 +-
 ubuntu/vmhgfs/dbllnklst.h                  |    8 +-
 ubuntu/vmhgfs/dentry.c                     |    8 +-
 ubuntu/vmhgfs/dir.c                        |    8 +-
 ubuntu/vmhgfs/driver-config.h              |    8 +-
 ubuntu/vmhgfs/escBitvector.h               |   11 ++-
 ubuntu/vmhgfs/file.c                       |    8 +-
 ubuntu/vmhgfs/filesystem.c                 |   18 ++--
 ubuntu/vmhgfs/filesystem.h                 |    8 +-
 ubuntu/vmhgfs/fsutil.c                     |   11 ++-
 ubuntu/vmhgfs/fsutil.h                     |    8 +-
 ubuntu/vmhgfs/guest_msg_def.h              |    8 +-
 ubuntu/vmhgfs/hgfs.h                       |    9 +-
 ubuntu/vmhgfs/hgfsBd.c                     |   10 +-
 ubuntu/vmhgfs/hgfsBd.h                     |    8 +-
 ubuntu/vmhgfs/hgfsDevLinux.h               |    8 +-
 ubuntu/vmhgfs/hgfsProto.h                  |   33 +++++-
 ubuntu/vmhgfs/hgfsUtil.c                   |   10 +-
 ubuntu/vmhgfs/hgfsUtil.h                   |   24 +++--
 ubuntu/vmhgfs/includeCheck.h               |    8 +-
 ubuntu/vmhgfs/inode.c                      |    8 +-
 ubuntu/vmhgfs/inode.h                      |    8 +-
 ubuntu/vmhgfs/kernelStubs.h                |   61 +++++++++--
 ubuntu/vmhgfs/kernelStubsLinux.c           |   15 ++-
 ubuntu/vmhgfs/link.c                       |    8 +-
 ubuntu/vmhgfs/message.c                    |   10 +-
 ubuntu/vmhgfs/message.h                    |    8 +-
 ubuntu/vmhgfs/messageBackdoor.c            |   12 +-
 ubuntu/vmhgfs/module.c                     |    8 +-
 ubuntu/vmhgfs/module.h                     |    8 +-
 ubuntu/vmhgfs/page.c                       |    8 +-
 ubuntu/vmhgfs/request.c                    |    8 +-
 ubuntu/vmhgfs/request.h                    |    8 +-
 ubuntu/vmhgfs/rpcout.c                     |   20 ++--
 ubuntu/vmhgfs/rpcout.h                     |    8 +-
 ubuntu/vmhgfs/staticEscape.c               |   19 +++-
 ubuntu/vmhgfs/staticEscape.h               |    8 +-
 ubuntu/vmhgfs/stubs.c                      |    8 +-
 ubuntu/vmhgfs/super.c                      |    8 +-
 ubuntu/vmhgfs/vm_assert.h                  |    9 +-
 ubuntu/vmhgfs/vm_basic_asm.h               |   14 ++--
 ubuntu/vmhgfs/vm_basic_asm_x86.h           |    9 +-
 ubuntu/vmhgfs/vm_basic_asm_x86_64.h        |    9 +-
 ubuntu/vmhgfs/vm_basic_defs.h              |   36 +++++--
 ubuntu/vmhgfs/vm_basic_types.h             |  157 +++++++++++++++++-----------
 ubuntu/vmhgfs/vmhgfs_version.h             |   14 ++--
 ubuntu/vmhgfs/vmware.h                     |    9 +-
 ubuntu/vmhgfs/vmware_pack_begin.h          |    8 +-
 ubuntu/vmhgfs/vmware_pack_end.h            |    8 +-
 ubuntu/vmhgfs/vmware_pack_init.h           |    8 +-
 ubuntu/vmhgfs/x86cpuid.h                   |   92 +++++++++++------
 ubuntu/vmmemctl/Makefile                   |   49 ++++++---
 ubuntu/vmmemctl/Makefile.kernel            |   46 +++-----
 ubuntu/vmmemctl/Makefile.normal            |   40 ++++----
 ubuntu/vmmemctl/autoconf/epoll.c           |    8 +-
 ubuntu/vmmemctl/autoconf/geninclude.c      |    8 +-
 ubuntu/vmmemctl/autoconf/setnice.c         |    8 +-
 ubuntu/vmmemctl/backdoor.h                 |    8 +-
 ubuntu/vmmemctl/backdoorGcc32.c            |    8 +-
 ubuntu/vmmemctl/backdoorGcc64.c            |    8 +-
 ubuntu/vmmemctl/backdoorInt.h              |    8 +-
 ubuntu/vmmemctl/backdoor_balloon.h         |    8 +-
 ubuntu/vmmemctl/balloon_def.h              |    8 +-
 ubuntu/vmmemctl/compat_completion.h        |    8 +-
 ubuntu/vmmemctl/compat_file.h              |    8 +-
 ubuntu/vmmemctl/compat_kernel.h            |    8 +-
 ubuntu/vmmemctl/compat_list.h              |   18 +++-
 ubuntu/vmmemctl/compat_mm.h                |    8 +-
 ubuntu/vmmemctl/compat_module.h            |    8 +-
 ubuntu/vmmemctl/compat_page.h              |    8 +-
 ubuntu/vmmemctl/compat_sched.h             |   36 ++++++-
 ubuntu/vmmemctl/compat_semaphore.h         |    8 +-
 ubuntu/vmmemctl/compat_spinlock.h          |    8 +-
 ubuntu/vmmemctl/compat_version.h           |    8 +-
 ubuntu/vmmemctl/compat_wait.h              |    8 +-
 ubuntu/vmmemctl/driver-config.h            |    8 +-
 ubuntu/vmmemctl/includeCheck.h             |    8 +-
 ubuntu/vmmemctl/os.c                       |   18 +++-
 ubuntu/vmmemctl/os.h                       |    9 +-
 ubuntu/vmmemctl/vm_assert.h                |    9 +-
 ubuntu/vmmemctl/vm_basic_defs.h            |   36 +++++--
 ubuntu/vmmemctl/vm_basic_types.h           |  157 +++++++++++++++++-----------
 ubuntu/vmmemctl/vmballoon.c                |   14 ++-
 ubuntu/vmmemctl/vmballoon.h                |    8 +-
 ubuntu/vmmemctl/vmmemctl_version.h         |    8 +-
 ubuntu/vmxnet/Makefile                     |   49 ++++++---
 ubuntu/vmxnet/Makefile.kernel              |   45 +++-----
 ubuntu/vmxnet/Makefile.normal              |   34 +++---
 ubuntu/vmxnet/autoconf/geninclude.c        |    8 +-
 ubuntu/vmxnet/autoconf/skblin.c            |    8 +-
 ubuntu/vmxnet/bpf_meta.h                   |   59 +++++++++++
 ubuntu/vmxnet/compat_ethtool.h             |    8 +-
 ubuntu/vmxnet/compat_highmem.h             |   40 +++++++
 ubuntu/vmxnet/compat_init.h                |    8 +-
 ubuntu/vmxnet/compat_interrupt.h           |    8 +-
 ubuntu/vmxnet/compat_ioport.h              |    8 +-
 ubuntu/vmxnet/compat_module.h              |    8 +-
 ubuntu/vmxnet/compat_netdevice.h           |   62 ++++++++++--
 ubuntu/vmxnet/compat_pci.h                 |    8 +-
 ubuntu/vmxnet/compat_skbuff.h              |    8 +-
 ubuntu/vmxnet/compat_slab.h                |   27 ++++-
 ubuntu/vmxnet/compat_spinlock.h            |    8 +-
 ubuntu/vmxnet/compat_timer.h               |   95 +++++++++++++++++
 ubuntu/vmxnet/compat_version.h             |    8 +-
 ubuntu/vmxnet/driver-config.h              |    8 +-
 ubuntu/vmxnet/includeCheck.h               |    8 +-
 ubuntu/vmxnet/net.h                        |    8 +-
 ubuntu/vmxnet/net_dist.h                   |   12 +-
 ubuntu/vmxnet/net_sg.h                     |    8 +-
 ubuntu/vmxnet/return_status.h              |    8 +-
 ubuntu/vmxnet/vm_basic_types.h             |  157 +++++++++++++++++-----------
 ubuntu/vmxnet/vm_device_version.h          |   10 +-
 ubuntu/vmxnet/vmkapi_status.h              |   19 +++-
 ubuntu/vmxnet/vmkapi_types.h               |   23 +++-
 ubuntu/vmxnet/vmnet_def.h                  |   10 +-
 ubuntu/vmxnet/vmxnet.c                     |  144 ++++++++++++++++++++++++--
 ubuntu/vmxnet/vmxnet2_def.h                |   13 ++-
 ubuntu/vmxnet/vmxnetInt.h                  |    9 +-
 ubuntu/vmxnet/vmxnet_def.h                 |   11 +-
 ubuntu/vmxnet/vmxnet_version.h             |    8 +-
 220 files changed, 2368 insertions(+), 1416 deletions(-)
 create mode 100644 ubuntu/vmhgfs/autoconf/cachector.c
 create mode 100644 ubuntu/vmxnet/bpf_meta.h
 create mode 100644 ubuntu/vmxnet/compat_highmem.h
 create mode 100644 ubuntu/vmxnet/compat_timer.h

diff --git a/ubuntu/vmblock/Makefile b/ubuntu/vmblock/Makefile
index 8a7ae56..ae0c286 100644
--- a/ubuntu/vmblock/Makefile
+++ b/ubuntu/vmblock/Makefile
@@ -1,20 +1,21 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 1998 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
+##########################################################
+# Copyright (C) 1998 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
+#
+##########################################################
 
 ####
 ####  VMware kernel module Makefile to be distributed externally
@@ -107,6 +108,22 @@ endif
 
 endif
 
+vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
+	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
+	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+	-DKBUILD_BASENAME=\"$(DRIVER)\" \
+	-Werror -S -o /dev/null -xc $(1) \
+	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
+
+CC_WARNINGS := -Wall -Wstrict-prototypes
+CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS) -DVMW_USING_KBUILD
+ifdef VMX86_DEVEL
+CC_OPTS += -DVMX86_DEVEL
+endif
+ifdef VMX86_DEBUG
+CC_OPTS += -DVMX86_DEBUG
+endif
+
 include $(SRCROOT)/Makefile.kernel
 
 ifdef TOPDIR
diff --git a/ubuntu/vmblock/Makefile.kernel b/ubuntu/vmblock/Makefile.kernel
index 9f0e14c..a5276ab 100644
--- a/ubuntu/vmblock/Makefile.kernel
+++ b/ubuntu/vmblock/Makefile.kernel
@@ -1,44 +1,21 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 2006 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
-
-####
-####  VMware vmblock Makefile to be distributed externally
-####
-####
-
-vm_check_build = $(shell if $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
-	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
-	-DKBUILD_BASENAME=\"$(DRIVER)\" \
-	-Werror -S -o /dev/null -xc $(1) \
-	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
-
-CC_WARNINGS := -Wall -Wstrict-prototypes
-
-CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS)
-
-CC_OPTS += -DVMW_USING_KBUILD
-
-ifdef VMX86_DEVEL
-CC_OPTS += -DVMX86_DEVEL
-endif
-ifdef VMX86_DEBUG
-CC_OPTS += -DVMX86_DEBUG
-endif
+##########################################################
+# Copyright (C) 2006 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 := -I$(SRCROOT)/include
 
diff --git a/ubuntu/vmblock/Makefile.normal b/ubuntu/vmblock/Makefile.normal
index ae778c8..9721d11 100644
--- a/ubuntu/vmblock/Makefile.normal
+++ b/ubuntu/vmblock/Makefile.normal
@@ -1,20 +1,21 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 2006 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
+##########################################################
+# Copyright (C) 2006 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
+#
+##########################################################
 
 ####
 ####  VMware vmblock Makefile to be distributed externally
@@ -99,20 +100,20 @@ OBJS := $(LINUX_OBJS)
 ####
 
 driver: setup deps
-	$(MAKE) -C $(DESTDIR) -f ../Makefile SRCROOT=../$(SRCROOT) $(DRIVERNAME) \
+	$(MAKE) -C $(DESTDIR) -f ../Makefile SRCROOT=../$(SRCROOT) $(DRIVER).o \
 		INCLUDE_DEPS=1
 
 setup:
 	@if [ -d $(DESTDIR) ] ; then true ; else mkdir $(DESTDIR); chmod 755 $(DESTDIR) ; fi
 
-$(DRIVER): $(DRIVERNAME)
+$(DRIVER) $(DRIVER).o: $(DRIVERNAME)
 	cp -f $< $@
 
 $(DRIVERNAME): $(OBJS)
-	$(ECHO) "Building $(DRIVERNAME)"   
+	$(ECHO) "Building $(DRIVERNAME)"
 	ld -r -o $(DRIVERNAME) $^
 
-auto-build: 
+auto-build:
 	$(MAKE) driver QUIET=1
 	cp -f $(DESTDIR)/$(DRIVERNAME) $(SRCROOT)/../$(DRIVER).o
 
diff --git a/ubuntu/vmblock/README b/ubuntu/vmblock/README
index 3cae243..fdb750f 100644
--- a/ubuntu/vmblock/README
+++ b/ubuntu/vmblock/README
@@ -6,9 +6,9 @@ Makefile is correct and then just type
 
 from this directory.  A copy of the module will be left in
 
-        driver-<kernel version>/vmblock-<kernel-version>
+        driver-<kernel version>/vmblock.o
 
-(e.g. driver-up-2.4.20/vmblock-up-2.4.20) for 2.4 series kernels and in
+(e.g. driver-up-2.4.20/vmblock.o) for 2.4 series kernels and in
 
         ../vmblock.o
 
diff --git a/ubuntu/vmblock/autoconf/cachecreate.c b/ubuntu/vmblock/autoconf/cachecreate.c
index 98c82eb..88c51c1 100644
--- a/ubuntu/vmblock/autoconf/cachecreate.c
+++ b/ubuntu/vmblock/autoconf/cachecreate.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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>
diff --git a/ubuntu/vmblock/autoconf/epoll.c b/ubuntu/vmblock/autoconf/epoll.c
index fc6ac4c..44083c6 100644
--- a/ubuntu/vmblock/autoconf/epoll.c
+++ b/ubuntu/vmblock/autoconf/epoll.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2004 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * Detect whether we have 'struct poll_wqueues'
diff --git a/ubuntu/vmblock/autoconf/filldir1.c b/ubuntu/vmblock/autoconf/filldir1.c
index 8c8b700..754da62 100644
--- a/ubuntu/vmblock/autoconf/filldir1.c
+++ b/ubuntu/vmblock/autoconf/filldir1.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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>
diff --git a/ubuntu/vmblock/autoconf/geninclude.c b/ubuntu/vmblock/autoconf/geninclude.c
index 681bb52..f37a20f 100644
--- a/ubuntu/vmblock/autoconf/geninclude.c
+++ b/ubuntu/vmblock/autoconf/geninclude.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2003 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -14,7 +13,8 @@
  * 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>
 
diff --git a/ubuntu/vmblock/autoconf/getsb1.c b/ubuntu/vmblock/autoconf/getsb1.c
index c76388a..862ae2b 100644
--- a/ubuntu/vmblock/autoconf/getsb1.c
+++ b/ubuntu/vmblock/autoconf/getsb1.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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>
diff --git a/ubuntu/vmblock/autoconf/setnice.c b/ubuntu/vmblock/autoconf/setnice.c
index ebd452a..8d5ebf2 100644
--- a/ubuntu/vmblock/autoconf/setnice.c
+++ b/ubuntu/vmblock/autoconf/setnice.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * set_user_nice appeared in 2.4.21.  But some distros
diff --git a/ubuntu/vmblock/autoconf/skas1.c b/ubuntu/vmblock/autoconf/skas1.c
index e8eab9f..015232f 100644
--- a/ubuntu/vmblock/autoconf/skas1.c
+++ b/ubuntu/vmblock/autoconf/skas1.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2004 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * SKAS patch adds 'struct mm *mm' as first argument to do_mmap_pgoff.
diff --git a/ubuntu/vmblock/autoconf/statfs1.c b/ubuntu/vmblock/autoconf/statfs1.c
index 57c3f14..8501cab 100644
--- a/ubuntu/vmblock/autoconf/statfs1.c
+++ b/ubuntu/vmblock/autoconf/statfs1.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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>
diff --git a/ubuntu/vmblock/include/compat_completion.h b/ubuntu/vmblock/include/compat_completion.h
index 35f081f..e690fff 100644
--- a/ubuntu/vmblock/include/compat_completion.h
+++ b/ubuntu/vmblock/include/compat_completion.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2004 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_COMPLETION_H__
 #   define __COMPAT_COMPLETION_H__
diff --git a/ubuntu/vmblock/include/compat_file.h b/ubuntu/vmblock/include/compat_file.h
index 9d16904..5af3010 100644
--- a/ubuntu/vmblock/include/compat_file.h
+++ b/ubuntu/vmblock/include/compat_file.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_FILE_H__
 #   define __COMPAT_FILE_H__
diff --git a/ubuntu/vmblock/include/compat_fs.h b/ubuntu/vmblock/include/compat_fs.h
index 01d39a6..d1c083a 100644
--- a/ubuntu/vmblock/include/compat_fs.h
+++ b/ubuntu/vmblock/include/compat_fs.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_FS_H__
 #   define __COMPAT_FS_H__
@@ -159,7 +159,7 @@
 #define compat_i_size_read(inode) ((inode)->i_size)
 #define compat_i_size_write(inode, size) ((inode)->i_size = size)
 #else
-#define compat_i_size_read(node) i_size_read(inode)
+#define compat_i_size_read(inode) i_size_read(inode)
 #define compat_i_size_write(inode, size) i_size_write(inode, size)
 #endif
 
diff --git a/ubuntu/vmblock/include/compat_init.h b/ubuntu/vmblock/include/compat_init.h
index 0115d9e..48d7075 100644
--- a/ubuntu/vmblock/include/compat_init.h
+++ b/ubuntu/vmblock/include/compat_init.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1999 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1999 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * compat_init.h: Initialization compatibility wrappers.
diff --git a/ubuntu/vmblock/include/compat_kernel.h b/ubuntu/vmblock/include/compat_kernel.h
index d278ae7..76b47cf 100644
--- a/ubuntu/vmblock/include/compat_kernel.h
+++ b/ubuntu/vmblock/include/compat_kernel.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2004 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_KERNEL_H__
 #   define __COMPAT_KERNEL_H__
diff --git a/ubuntu/vmblock/include/compat_list.h b/ubuntu/vmblock/include/compat_list.h
index baaa8ac..333557b 100644
--- a/ubuntu/vmblock/include/compat_list.h
+++ b/ubuntu/vmblock/include/compat_list.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_LIST_H__
 #   define __COMPAT_LIST_H__
@@ -22,6 +22,16 @@
 #include <linux/list.h>
 
 /*
+ * list_add_tail is with us since 2.4.0, or something like that.
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
+#define list_add_tail(newe, head) do {  \
+   struct list_head *__h = (head);      \
+   __list_add((newe), __h->prev, __h);  \
+} while (0)
+#endif
+
+/*
  * list_for_each_safe() showed up in 2.4.10, but it may be backported so we
  * just check for its existence.
  */
diff --git a/ubuntu/vmblock/include/compat_mm.h b/ubuntu/vmblock/include/compat_mm.h
index 9e9605b..9265a82 100644
--- a/ubuntu/vmblock/include/compat_mm.h
+++ b/ubuntu/vmblock/include/compat_mm.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_MM_H__
 #   define __COMPAT_MM_H__
diff --git a/ubuntu/vmblock/include/compat_module.h b/ubuntu/vmblock/include/compat_module.h
index 6576fb6..66fc469 100644
--- a/ubuntu/vmblock/include/compat_module.h
+++ b/ubuntu/vmblock/include/compat_module.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2007 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * compat_module.h --
diff --git a/ubuntu/vmblock/include/compat_namei.h b/ubuntu/vmblock/include/compat_namei.h
index 9ca3290..a3176f5 100644
--- a/ubuntu/vmblock/include/compat_namei.h
+++ b/ubuntu/vmblock/include/compat_namei.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_NAMEI_H__
 #   define __COMPAT_NAMEI_H__
diff --git a/ubuntu/vmblock/include/compat_page.h b/ubuntu/vmblock/include/compat_page.h
index 3aeab98..0bf0e25 100644
--- a/ubuntu/vmblock/include/compat_page.h
+++ b/ubuntu/vmblock/include/compat_page.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_PAGE_H__
 #   define __COMPAT_PAGE_H__
diff --git a/ubuntu/vmblock/include/compat_sched.h b/ubuntu/vmblock/include/compat_sched.h
index e54e1b6..6fc79dc 100644
--- a/ubuntu/vmblock/include/compat_sched.h
+++ b/ubuntu/vmblock/include/compat_sched.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SCHED_H__
 #   define __COMPAT_SCHED_H__
@@ -42,6 +42,34 @@
 #   define cond_resched() (need_resched() ? schedule() : (void) 0)
 #endif
 
+/* Oh well.  We need yield...  Happy us! */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 20)
+#   ifdef __x86_64__
+#      define compat_yield() there_is_nothing_like_yield()
+#   else
+#      include <linux/unistd.h>
+#      include <linux/kernel.h>
+
+/*
+ * Used by _syscallX macros. Note that this is global variable, so
+ * do not rely on its contents too much. As exit() is only function
+ * we use, and we never check return value from exit(), we have
+ * no problem...
+ */
+extern int errno;
+
+/*
+ * compat_exit() provides an access to the exit() function. It must 
+ * be named compat_exit(), as exit() (with different signature) is 
+ * provided by x86-64, arm and other (but not by i386).
+ */
+#      define __NR_compat_yield __NR_sched_yield
+static inline _syscall0(int, compat_yield);
+#   endif
+#else
+#   define compat_yield() yield()
+#endif
+
 
 /*
  * Since 2.5.34 there are two methods to enumerate tasks:
diff --git a/ubuntu/vmblock/include/compat_semaphore.h b/ubuntu/vmblock/include/compat_semaphore.h
index 23f92f3..8c6df97 100644
--- a/ubuntu/vmblock/include/compat_semaphore.h
+++ b/ubuntu/vmblock/include/compat_semaphore.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SEMAPHORE_H__
 #   define __COMPAT_SEMAPHORE_H__
diff --git a/ubuntu/vmblock/include/compat_slab.h b/ubuntu/vmblock/include/compat_slab.h
index c0d504b..8654a9a 100644
--- a/ubuntu/vmblock/include/compat_slab.h
+++ b/ubuntu/vmblock/include/compat_slab.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SLAB_H__
 #   define __COMPAT_SLAB_H__
@@ -40,7 +40,10 @@
 #endif
 
 /*
- * Destructor is gone since 2.6.23-pre1.
+ * Up to 2.6.22 kmem_cache_create has 6 arguments - name, size, alignment, flags,
+ * constructor, and destructor.  Then for some time kernel was asserting that
+ * destructor is NULL, and since 2.6.23-pre1 kmem_cache_create takes only 5
+ * arguments - destructor is gone.
  */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)
 #define compat_kmem_cache_create(name, size, align, flags, ctor) \
@@ -50,4 +53,18 @@
 		kmem_cache_create(name, size, align, flags, ctor)
 #endif
 
+/*
+ * 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...
+ */
+#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
+typedef void compat_kmem_cache_ctor(void *, compat_kmem_cache *, unsigned long);
+#else
+typedef void compat_kmem_cache_ctor(compat_kmem_cache *, void *);
+#endif
+
 #endif /* __COMPAT_SLAB_H__ */
diff --git a/ubuntu/vmblock/include/compat_spinlock.h b/ubuntu/vmblock/include/compat_spinlock.h
index c069db9..ea867f2 100644
--- a/ubuntu/vmblock/include/compat_spinlock.h
+++ b/ubuntu/vmblock/include/compat_spinlock.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SPINLOCK_H__
 #   define __COMPAT_SPINLOCK_H__
diff --git a/ubuntu/vmblock/include/compat_statfs.h b/ubuntu/vmblock/include/compat_statfs.h
index 0dc191d..29ec4f8 100644
--- a/ubuntu/vmblock/include/compat_statfs.h
+++ b/ubuntu/vmblock/include/compat_statfs.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_STATFS_H__
 #   define __COMPAT_STATFS_H__
diff --git a/ubuntu/vmblock/include/compat_string.h b/ubuntu/vmblock/include/compat_string.h
index 6ea0ebf..b74f875 100644
--- a/ubuntu/vmblock/include/compat_string.h
+++ b/ubuntu/vmblock/include/compat_string.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2007 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_STRING_H__
 #   define __COMPAT_STRING_H__
diff --git a/ubuntu/vmblock/include/compat_uaccess.h b/ubuntu/vmblock/include/compat_uaccess.h
index d272269..d58ee05 100644
--- a/ubuntu/vmblock/include/compat_uaccess.h
+++ b/ubuntu/vmblock/include/compat_uaccess.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_UACCESS_H__
 #   define __COMPAT_UACCESS_H__
diff --git a/ubuntu/vmblock/include/compat_version.h b/ubuntu/vmblock/include/compat_version.h
index 2f4c546..baf9634 100644
--- a/ubuntu/vmblock/include/compat_version.h
+++ b/ubuntu/vmblock/include/compat_version.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_VERSION_H__
 #   define __COMPAT_VERSION_H__
diff --git a/ubuntu/vmblock/include/compat_wait.h b/ubuntu/vmblock/include/compat_wait.h
index e3aca6c..ebcf087 100644
--- a/ubuntu/vmblock/include/compat_wait.h
+++ b/ubuntu/vmblock/include/compat_wait.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_WAIT_H__
 #   define __COMPAT_WAIT_H__
diff --git a/ubuntu/vmblock/include/driver-config.h b/ubuntu/vmblock/include/driver-config.h
index b9aec7f..3722731 100644
--- a/ubuntu/vmblock/include/driver-config.h
+++ b/ubuntu/vmblock/include/driver-config.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * Sets the proper defines from the Linux header files
diff --git a/ubuntu/vmblock/include/vm_assert.h b/ubuntu/vmblock/include/vm_assert.h
index 07b987f..12b67f3 100644
--- a/ubuntu/vmblock/include/vm_assert.h
+++ b/ubuntu/vmblock/include/vm_assert.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 1998-2004 VMware, Inc.  All rights reserved.
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998-2004 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vm_assert.h --
diff --git a/ubuntu/vmblock/include/vm_basic_defs.h b/ubuntu/vmblock/include/vm_basic_defs.h
index e01cb24..8da371b 100644
--- a/ubuntu/vmblock/include/vm_basic_defs.h
+++ b/ubuntu/vmblock/include/vm_basic_defs.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 2003 VMware, Inc.  All rights reserved.
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vm_basic_defs.h --
@@ -152,8 +151,6 @@ Max(int a, int b)
 #ifndef PAGE_SHIFT // {
 #if defined VM_I386
    #define PAGE_SHIFT    12
-#elif defined VM_IA64
-   #define PAGE_SHIFT    14	// On IA-64, the default page size is 16K
 #elif defined __APPLE__
    #define PAGE_SHIFT    12
 #else
@@ -382,6 +379,31 @@ typedef int pid_t;
 
 #endif // }
 
+#ifndef va_copy
+#ifdef _WIN32
+
+/*
+ * Windows needs va_copy. This works for both 32 and 64-bit Windows
+ * based on inspection of how varags.h from the Visual C CRTL is
+ * implemented. (Future versions of the RTL may break this).
+ */
+
+#define va_copy(dest, src) ((dest) = (src))
+
+#endif // _WIN32
+
+#if defined(__APPLE__) && defined(KERNEL)
+
+/*
+ * MacOS kernel-mode needs va_copy. Based on inspection of stdarg.h
+ * from the MacOSX10.4u.sdk kernel framework, this should work.
+ * (Future versions of the SDK may break this).
+ */
+
+#define va_copy(dest, src) ((dest) = (src))
+
+#endif // __APPLE__ && KERNEL
+#endif // va_copy
 
 /*
  * This one is outside USERLEVEL because it's used by
diff --git a/ubuntu/vmblock/include/vm_basic_types.h b/ubuntu/vmblock/include/vm_basic_types.h
index 5fc0231..bdefa6f 100644
--- a/ubuntu/vmblock/include/vm_basic_types.h
+++ b/ubuntu/vmblock/include/vm_basic_types.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (c) 1998-2007 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998-2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  *
@@ -63,10 +63,6 @@ typedef char           Bool;
 #define VM_I386
 #endif
 
-#ifdef __ia64__
-#define VM_IA64
-#endif
-
 #ifdef _WIN64
 #define __x86_64__
 #endif
@@ -86,10 +82,6 @@ typedef char           Bool;
 #define VM_I386
 #endif
 
-#if defined VM_I386 && defined VM_IA64
-#error "Only one CPU platform is allowed."
-#endif
-
 #ifdef _MSC_VER
 typedef unsigned __int64 uint64;
 typedef signed __int64 int64;
@@ -109,7 +101,7 @@ typedef signed __int64 int64;
 #elif __GNUC__
 /* The Xserver source compiles with -ansi -pendantic */
 #ifndef __STRICT_ANSI__
-#if defined(VM_IA64) || defined(VM_X86_64)
+#if defined(VM_X86_64)
 typedef unsigned long uint64;
 typedef long int64;
 #else
@@ -140,54 +132,71 @@ typedef char      int8;
  * This applies to Solaris as well.
  */
 
-#if defined(__FreeBSD__) || defined(sun)
-#   ifdef KLD_MODULE
-#      include <sys/types.h>
-#   else
-#      if (BSD_VERSION >= 50) || defined(HAVE_INTTYPES_H)
-#         include <inttypes.h>
+/*
+ * Before trying to do the includes based on OS defines, see if we can use
+ * feature-based defines to get as much functionality as possible
+ */
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_INTTYPES_H
+#include <sys/inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if !defined(USING_AUTOCONF)
+#   if defined(__FreeBSD__) || defined(sun)
+#      ifdef KLD_MODULE
 #         include <sys/types.h>
 #      else
-#         include <sys/inttypes.h>
-#      endif
-#   endif
-#elif defined __APPLE__
-#   if KERNEL
-#       include <sys/types.h> /* mostly for size_t */
-#       include <stdint.h>
-#   else
-#       include <inttypes.h>
-#       include <stdlib.h>
-#       include <stdint.h>
-#   endif
-#else
-#   if !defined(__intptr_t_defined) && !defined(intptr_t)
-#      define __intptr_t_defined
-#      define intptr_t  intptr_t
-#      ifdef VM_I386
-#         ifdef VM_X86_64
-             typedef int64     intptr_t;
+#         if (BSD_VERSION >= 50)
+#            include <inttypes.h>
+#            include <sys/types.h>
 #         else
-             typedef int32     intptr_t;
+#            include <sys/inttypes.h>
 #         endif
 #      endif
-
-#      ifdef VM_IA64
-          typedef int64     intptr_t;
+#   elif defined __APPLE__
+#      if KERNEL
+#         include <sys/unistd.h>
+#         include <sys/types.h> /* mostly for size_t */
+#         include <stdint.h>
+#      else
+#         include <unistd.h>
+#         include <inttypes.h>
+#         include <stdlib.h>
+#         include <stdint.h>
 #      endif
-#   endif
-
-#   ifndef _STDINT_H
-#      ifdef VM_I386
-#         ifdef VM_X86_64
-             typedef uint64    uintptr_t;
-#         else
-             typedef uint32    uintptr_t;
+#   else
+#      if !defined(__intptr_t_defined) && !defined(intptr_t)
+#         define __intptr_t_defined
+#         define intptr_t  intptr_t
+#         ifdef VM_I386
+#            ifdef VM_X86_64
+typedef int64     intptr_t;
+#            else
+typedef int32     intptr_t;
+#            endif
 #         endif
 #      endif
 
-#      ifdef VM_IA64
-          typedef uint64    uintptr_t;
+#      ifndef _STDINT_H
+#         ifdef VM_I386
+#            ifdef VM_X86_64
+typedef uint64    uintptr_t;
+#            else
+typedef uint32    uintptr_t;
+#            endif
+#         endif
 #      endif
 #   endif
 #endif
@@ -233,10 +242,20 @@ typedef int64 VmTimeVirtualClock;  /* Virtual Clock kept in CPU cycles */
          #define FMTSZ  ""
          #define FMTPD  ""
       #endif
-   #else
+   #elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) \
+      || (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \
+      || (defined(_POSIX2_VERSION) && _POSIX2_VERSION >= 200112L)
       /* BSD/Darwin, Linux */
       #define FMTSZ     "z"
       #define FMTPD     "t"
+   #else
+      /* Systems with a pre-C99 libc */
+      #define FMTSZ     "Z"
+      #ifdef VM_X86_64
+         #define FMTPD  "l"
+      #else
+         #define FMTPD  ""
+      #endif
    #endif
    #ifdef VM_X86_64
       #define FMT64     "l"
@@ -618,6 +637,16 @@ typedef void * UserVA;
 #define ALIGNED(n)
 #endif
 
+/*
+ * __func__ is a stringified function name that is part of the C99 standard. The block
+ * below defines __func__ on older systems where the compiler does not support that
+ * macro.
+ */
+#if defined(__GNUC__) \
+   && ((__GNUC__ == 2 && __GNUC_MINOR < 96) \
+       || (__GNUC__ < 2))
+#   define __func__ __FUNCTION__
+#endif
 
 /*
  * Once upon a time, this was used to silence compiler warnings that
@@ -642,9 +671,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef uint64 size_t;
-#      endif
 #   endif
 #else
 #   ifndef _SIZE_T
@@ -657,9 +683,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef uint64 size_t;
-#      endif
 #   endif
 #   if !defined(FROBOS) && !defined(_SSIZE_T) && !defined(ssize_t)  && !defined(__ssize_t_defined) && !defined(_SSIZE_T_DECLARED)
 #      define _SSIZE_T
@@ -673,9 +696,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef int64 ssize_t;
-#      endif
 #   endif
 #endif
 
@@ -724,4 +744,17 @@ typedef void * UserVA;
 # define FMTMODE "o"
 #endif
 
+/*
+ * Format modifier for printing time_t. Most platforms define a time_t to be
+ * a long int, but on FreeBSD (as of 5.0, it seems), the time_t is a signed
+ * size quantity. Refer to the definition of FMTSZ to see why we need silly
+ * preprocessor arithmetic.
+ * Use this like this: printf("The mode is %"FMTTIME".\n", time);
+ */
+#if defined(__FreeBSD__) && (__FreeBSD__ + 0) && ((__FreeBSD__ + 0) >= 5)
+#   define FMTTIME FMTSZ"d"
+#else
+#   define FMTTIME "ld"
+#endif
+
 #endif  /* _VM_BASIC_TYPES_H_ */
diff --git a/ubuntu/vmblock/include/vmblock.h b/ubuntu/vmblock/include/vmblock.h
index db15220..b6c6727 100644
--- a/ubuntu/vmblock/include/vmblock.h
+++ b/ubuntu/vmblock/include/vmblock.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vmblock.h --
diff --git a/ubuntu/vmblock/include/vmware.h b/ubuntu/vmblock/include/vmware.h
index 1bf3dab..b7cf86c 100644
--- a/ubuntu/vmblock/include/vmware.h
+++ b/ubuntu/vmblock/include/vmware.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 2003 VMware, Inc.  All rights reserved.
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vmware.h --
diff --git a/ubuntu/vmblock/linux/block.c b/ubuntu/vmblock/linux/block.c
index cb3f91c..b559f4e 100644
--- a/ubuntu/vmblock/linux/block.c
+++ b/ubuntu/vmblock/linux/block.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * block.c --
diff --git a/ubuntu/vmblock/linux/block.h b/ubuntu/vmblock/linux/block.h
index 0908191..ffbebef 100644
--- a/ubuntu/vmblock/linux/block.h
+++ b/ubuntu/vmblock/linux/block.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * block.h --
diff --git a/ubuntu/vmblock/linux/control.c b/ubuntu/vmblock/linux/control.c
index ea44f7c..b55513d 100644
--- a/ubuntu/vmblock/linux/control.c
+++ b/ubuntu/vmblock/linux/control.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * control.c --
diff --git a/ubuntu/vmblock/linux/dbllnklst.c b/ubuntu/vmblock/linux/dbllnklst.c
index 86c38cb..28b9888 100644
--- a/ubuntu/vmblock/linux/dbllnklst.c
+++ b/ubuntu/vmblock/linux/dbllnklst.c
@@ -1,6 +1,5 @@
-/*
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- *
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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 "vmware.h"
 #include "dbllnklst.h"
diff --git a/ubuntu/vmblock/linux/dbllnklst.h b/ubuntu/vmblock/linux/dbllnklst.h
index 50d04c5..645b722 100644
--- a/ubuntu/vmblock/linux/dbllnklst.h
+++ b/ubuntu/vmblock/linux/dbllnklst.h
@@ -1,6 +1,5 @@
-/*
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- *
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * dbllnklst.h --
diff --git a/ubuntu/vmblock/linux/dentry.c b/ubuntu/vmblock/linux/dentry.c
index c4d0779..a39bb76 100644
--- a/ubuntu/vmblock/linux/dentry.c
+++ b/ubuntu/vmblock/linux/dentry.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * dentry.c --
diff --git a/ubuntu/vmblock/linux/file.c b/ubuntu/vmblock/linux/file.c
index cd653fd..6b651f0 100644
--- a/ubuntu/vmblock/linux/file.c
+++ b/ubuntu/vmblock/linux/file.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * file.c --
diff --git a/ubuntu/vmblock/linux/filesystem.c b/ubuntu/vmblock/linux/filesystem.c
index cc20551..506a149 100644
--- a/ubuntu/vmblock/linux/filesystem.c
+++ b/ubuntu/vmblock/linux/filesystem.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * filesystem.c --
diff --git a/ubuntu/vmblock/linux/filesystem.h b/ubuntu/vmblock/linux/filesystem.h
index 3d5234f..697d112 100644
--- a/ubuntu/vmblock/linux/filesystem.h
+++ b/ubuntu/vmblock/linux/filesystem.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * filesystem.h --
diff --git a/ubuntu/vmblock/linux/inode.c b/ubuntu/vmblock/linux/inode.c
index 7d3652b..d27dc28 100644
--- a/ubuntu/vmblock/linux/inode.c
+++ b/ubuntu/vmblock/linux/inode.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * inode.c --
diff --git a/ubuntu/vmblock/linux/module.c b/ubuntu/vmblock/linux/module.c
index d0e92de..8285cdf 100644
--- a/ubuntu/vmblock/linux/module.c
+++ b/ubuntu/vmblock/linux/module.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * module.c --
diff --git a/ubuntu/vmblock/linux/os.h b/ubuntu/vmblock/linux/os.h
index 23c076b..7408200 100644
--- a/ubuntu/vmblock/linux/os.h
+++ b/ubuntu/vmblock/linux/os.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2007 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 
 /*
diff --git a/ubuntu/vmblock/linux/stubs.c b/ubuntu/vmblock/linux/stubs.c
index 58bbf8d..1c00984 100644
--- a/ubuntu/vmblock/linux/stubs.c
+++ b/ubuntu/vmblock/linux/stubs.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2007 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 
 /*
diff --git a/ubuntu/vmblock/linux/stubs.h b/ubuntu/vmblock/linux/stubs.h
index 763d449..a7087a4 100644
--- a/ubuntu/vmblock/linux/stubs.h
+++ b/ubuntu/vmblock/linux/stubs.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2007 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 
 /*
diff --git a/ubuntu/vmblock/linux/super.c b/ubuntu/vmblock/linux/super.c
index 6440c5d..2f2a9aa 100644
--- a/ubuntu/vmblock/linux/super.c
+++ b/ubuntu/vmblock/linux/super.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * super.c --
diff --git a/ubuntu/vmblock/linux/vmblockInt.h b/ubuntu/vmblock/linux/vmblockInt.h
index 14f74e3..bff7bbc 100644
--- a/ubuntu/vmblock/linux/vmblockInt.h
+++ b/ubuntu/vmblock/linux/vmblockInt.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vmblockInt.h --
diff --git a/ubuntu/vmblock/linux/vmblock_version.h b/ubuntu/vmblock/linux/vmblock_version.h
index 709eb93..ab4416c 100644
--- a/ubuntu/vmblock/linux/vmblock_version.h
+++ b/ubuntu/vmblock/linux/vmblock_version.h
@@ -1,6 +1,5 @@
-/* ************************************************************************
- * Copyright 2007 VMware, Inc.  All rights reserved. 
- * ************************************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vmblock_version.h --
diff --git a/ubuntu/vmhgfs/Makefile b/ubuntu/vmhgfs/Makefile
index f2e6e34..4aa2fd7 100644
--- a/ubuntu/vmhgfs/Makefile
+++ b/ubuntu/vmhgfs/Makefile
@@ -1,20 +1,21 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 1998 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
+##########################################################
+# Copyright (C) 1998 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
+#
+##########################################################
 
 ####
 ####  VMware kernel module Makefile to be distributed externally
@@ -107,6 +108,22 @@ endif
 
 endif
 
+vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
+	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
+	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+	-DKBUILD_BASENAME=\"$(DRIVER)\" \
+	-Werror -S -o /dev/null -xc $(1) \
+	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
+
+CC_WARNINGS := -Wall -Wstrict-prototypes
+CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS) -DVMW_USING_KBUILD
+ifdef VMX86_DEVEL
+CC_OPTS += -DVMX86_DEVEL
+endif
+ifdef VMX86_DEBUG
+CC_OPTS += -DVMX86_DEBUG
+endif
+
 include $(SRCROOT)/Makefile.kernel
 
 ifdef TOPDIR
diff --git a/ubuntu/vmhgfs/Makefile.kernel b/ubuntu/vmhgfs/Makefile.kernel
index 7cee159..bfcf4df 100644
--- a/ubuntu/vmhgfs/Makefile.kernel
+++ b/ubuntu/vmhgfs/Makefile.kernel
@@ -1,37 +1,25 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 1998 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
+##########################################################
+# Copyright (C) 1998 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
+#
+##########################################################
 
 ####
 ####  VMware vmhgfs Makefile to be distributed externally
 ####
-####
-
-vm_check_build = $(shell if $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
-	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
-	-DKBUILD_BASENAME=\"$(DRIVER)\" \
-	-Werror -S -o /dev/null -xc $(1) \
-	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
-
-CC_WARNINGS := -Wall -Wstrict-prototypes
-
-CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS)
-
-CC_OPTS += -DVMW_USING_KBUILD
 
 INCLUDE := -I.
 
@@ -41,6 +29,7 @@ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/setnice.c, -DVMW_HAVE
 EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/epoll.c, -DVMW_HAVE_EPOLL, )
 EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/maxbytes.c, -DVMW_SB_HAS_MAXBYTES, )
 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, )
 
 # Note: These tests are inverted
 EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/getsb1.c,, -DVMW_GETSB_2618)
diff --git a/ubuntu/vmhgfs/Makefile.normal b/ubuntu/vmhgfs/Makefile.normal
index e5cfaf4..5254954 100644
--- a/ubuntu/vmhgfs/Makefile.normal
+++ b/ubuntu/vmhgfs/Makefile.normal
@@ -1,25 +1,25 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 1998 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
+##########################################################
+# Copyright (C) 1998 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
+#
+##########################################################
 
 ####
 ####  VMware vmhgfs Makefile to be distributed externally
 ####
-####
 
 vm_check_build = $(shell if $(CC) $(CC_OPTS) $(INCLUDE) -Werror -S -o /dev/null -xc $(1) \
         > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
@@ -104,17 +104,17 @@ LIBS :=
 
 default: all
 
-all: $(DRIVERNAME)
+all: $(DRIVER).o
 
 $(DRIVERNAME): $(OBJS)
 	$(LD) -r -o $@ $^
 
-$(DRIVER) ../$(DRIVER).o: $(DRIVERNAME)
+$(DRIVER) $(DRIVER).o ../$(DRIVER).o: $(DRIVERNAME)
 	cp -f $< $@
 
 auto-build: ../$(DRIVER).o
 
 clean:
-	rm -f $(DRIVERNAME) ../$(DRIVERNAME) $(DRIVER) $(OBJS)
+	rm -f $(DRIVERNAME) ../$(DRIVERNAME) $(DRIVER).o ../$(DRIVER).o $(DRIVER) $(OBJS)
 
 .SILENT:
diff --git a/ubuntu/vmhgfs/autoconf/cachecreate.c b/ubuntu/vmhgfs/autoconf/cachecreate.c
index 98c82eb..88c51c1 100644
--- a/ubuntu/vmhgfs/autoconf/cachecreate.c
+++ b/ubuntu/vmhgfs/autoconf/cachecreate.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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>
diff --git a/ubuntu/vmhgfs/autoconf/cachector.c b/ubuntu/vmhgfs/autoconf/cachector.c
new file mode 100644
index 0000000..bbc124d
--- /dev/null
+++ b/ubuntu/vmhgfs/autoconf/cachector.c
@@ -0,0 +1,40 @@
+/*********************************************************
+ * Copyright (C) 2006 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.23 and 2.6.24-rc1 ctor prototype was changed from
+ * ctor(ptr, cache, flags) to ctor(cache, ptr).  Unfortunately there
+ * is no typedef for ctor, so we have to redefine kmem_cache_create
+ * to find out ctor prototype.  This assumes that kmem_cache_create
+ * takes 5 arguments and not 6 - that change occured between
+ * 2.6.22 and 2.6.23-rc1.  If prototype matches, then this is old
+ * kernel.
+ */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
+#error "This test intentionally fails on 2.6.24 and newer kernels."
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
+#include <linux/slab.h>
+
+struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
+                        unsigned long,
+                        void (*)(void *, struct kmem_cache *, unsigned long));
+						
+#endif
diff --git a/ubuntu/vmhgfs/autoconf/epoll.c b/ubuntu/vmhgfs/autoconf/epoll.c
index fc6ac4c..44083c6 100644
--- a/ubuntu/vmhgfs/autoconf/epoll.c
+++ b/ubuntu/vmhgfs/autoconf/epoll.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2004 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * Detect whether we have 'struct poll_wqueues'
diff --git a/ubuntu/vmhgfs/autoconf/geninclude.c b/ubuntu/vmhgfs/autoconf/geninclude.c
index 681bb52..f37a20f 100644
--- a/ubuntu/vmhgfs/autoconf/geninclude.c
+++ b/ubuntu/vmhgfs/autoconf/geninclude.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2003 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -14,7 +13,8 @@
  * 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>
 
diff --git a/ubuntu/vmhgfs/autoconf/getsb1.c b/ubuntu/vmhgfs/autoconf/getsb1.c
index c76388a..862ae2b 100644
--- a/ubuntu/vmhgfs/autoconf/getsb1.c
+++ b/ubuntu/vmhgfs/autoconf/getsb1.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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>
diff --git a/ubuntu/vmhgfs/autoconf/inode1.c b/ubuntu/vmhgfs/autoconf/inode1.c
index cf99648..d010146 100644
--- a/ubuntu/vmhgfs/autoconf/inode1.c
+++ b/ubuntu/vmhgfs/autoconf/inode1.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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>
diff --git a/ubuntu/vmhgfs/autoconf/maxbytes.c b/ubuntu/vmhgfs/autoconf/maxbytes.c
index 2b55497..095279c 100644
--- a/ubuntu/vmhgfs/autoconf/maxbytes.c
+++ b/ubuntu/vmhgfs/autoconf/maxbytes.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2007 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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>
diff --git a/ubuntu/vmhgfs/autoconf/setnice.c b/ubuntu/vmhgfs/autoconf/setnice.c
index ebd452a..8d5ebf2 100644
--- a/ubuntu/vmhgfs/autoconf/setnice.c
+++ b/ubuntu/vmhgfs/autoconf/setnice.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * set_user_nice appeared in 2.4.21.  But some distros
diff --git a/ubuntu/vmhgfs/autoconf/statfs1.c b/ubuntu/vmhgfs/autoconf/statfs1.c
index 57c3f14..8501cab 100644
--- a/ubuntu/vmhgfs/autoconf/statfs1.c
+++ b/ubuntu/vmhgfs/autoconf/statfs1.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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>
diff --git a/ubuntu/vmhgfs/backdoor.c b/ubuntu/vmhgfs/backdoor.c
index e2ff0dc..c8357b8 100644
--- a/ubuntu/vmhgfs/backdoor.c
+++ b/ubuntu/vmhgfs/backdoor.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1999 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1999 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * backdoor.c --
@@ -31,7 +31,7 @@
 extern "C" {
 #endif
 
-#ifdef __KERNEL__
+#if defined(__KERNEL__) || defined(_KERNEL)
 #else
 #   include "debug.h"
 #endif
diff --git a/ubuntu/vmhgfs/backdoor.h b/ubuntu/vmhgfs/backdoor.h
index ceba29d..3dc6b6c 100644
--- a/ubuntu/vmhgfs/backdoor.h
+++ b/ubuntu/vmhgfs/backdoor.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1999 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1999 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * backdoor.h --
diff --git a/ubuntu/vmhgfs/backdoorGcc32.c b/ubuntu/vmhgfs/backdoorGcc32.c
index 654c564..aa62270 100644
--- a/ubuntu/vmhgfs/backdoorGcc32.c
+++ b/ubuntu/vmhgfs/backdoorGcc32.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2005 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * backdoorGcc32.c --
diff --git a/ubuntu/vmhgfs/backdoorGcc64.c b/ubuntu/vmhgfs/backdoorGcc64.c
index 1557499..555dea3 100644
--- a/ubuntu/vmhgfs/backdoorGcc64.c
+++ b/ubuntu/vmhgfs/backdoorGcc64.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2005 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * backdoorGcc64.c --
diff --git a/ubuntu/vmhgfs/backdoorInt.h b/ubuntu/vmhgfs/backdoorInt.h
index 09e01fc..d85afa7 100644
--- a/ubuntu/vmhgfs/backdoorInt.h
+++ b/ubuntu/vmhgfs/backdoorInt.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * backdoorInt.h --
diff --git a/ubuntu/vmhgfs/backdoor_def.h b/ubuntu/vmhgfs/backdoor_def.h
index b0d7ea4..ec83163 100644
--- a/ubuntu/vmhgfs/backdoor_def.h
+++ b/ubuntu/vmhgfs/backdoor_def.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * backdoor_def.h --
@@ -107,7 +107,9 @@
 #define BDOOR_CMD_GETTIMEFULL           46
 #define BDOOR_CMD_STATELOGGER           47
 #define BDOOR_CMD_CHECKFORCEBIOSSETUP	48
-#define BDOOR_CMD_MAX                   49
+#define BDOOR_CMD_LAZYTIMEREMULATION    49
+#define BDOOR_CMD_BIOSBBS               50
+#define BDOOR_CMD_MAX                   51
 
 /* 
  * IMPORTANT NOTE: When modifying the behavior of an existing backdoor command,
diff --git a/ubuntu/vmhgfs/bdhandler.c b/ubuntu/vmhgfs/bdhandler.c
index 74853aa..a64f4b9 100644
--- a/ubuntu/vmhgfs/bdhandler.c
+++ b/ubuntu/vmhgfs/bdhandler.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * bdhandler.c --
diff --git a/ubuntu/vmhgfs/bdhandler.h b/ubuntu/vmhgfs/bdhandler.h
index af696b4..1c6f01b 100644
--- a/ubuntu/vmhgfs/bdhandler.h
+++ b/ubuntu/vmhgfs/bdhandler.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * bdhandler.h --
diff --git a/ubuntu/vmhgfs/compat_completion.h b/ubuntu/vmhgfs/compat_completion.h
index 35f081f..e690fff 100644
--- a/ubuntu/vmhgfs/compat_completion.h
+++ b/ubuntu/vmhgfs/compat_completion.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2004 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_COMPLETION_H__
 #   define __COMPAT_COMPLETION_H__
diff --git a/ubuntu/vmhgfs/compat_dcache.h b/ubuntu/vmhgfs/compat_dcache.h
index b0fb25b..0450aee 100644
--- a/ubuntu/vmhgfs/compat_dcache.h
+++ b/ubuntu/vmhgfs/compat_dcache.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_DCACHE_H__
 #   define __COMPAT_DCACHE_H__
diff --git a/ubuntu/vmhgfs/compat_file.h b/ubuntu/vmhgfs/compat_file.h
index 9d16904..5af3010 100644
--- a/ubuntu/vmhgfs/compat_file.h
+++ b/ubuntu/vmhgfs/compat_file.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_FILE_H__
 #   define __COMPAT_FILE_H__
diff --git a/ubuntu/vmhgfs/compat_fs.h b/ubuntu/vmhgfs/compat_fs.h
index 01d39a6..d1c083a 100644
--- a/ubuntu/vmhgfs/compat_fs.h
+++ b/ubuntu/vmhgfs/compat_fs.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_FS_H__
 #   define __COMPAT_FS_H__
@@ -159,7 +159,7 @@
 #define compat_i_size_read(inode) ((inode)->i_size)
 #define compat_i_size_write(inode, size) ((inode)->i_size = size)
 #else
-#define compat_i_size_read(node) i_size_read(inode)
+#define compat_i_size_read(inode) i_size_read(inode)
 #define compat_i_size_write(inode, size) i_size_write(inode, size)
 #endif
 
diff --git a/ubuntu/vmhgfs/compat_highmem.h b/ubuntu/vmhgfs/compat_highmem.h
index b1085c1..3458087 100644
--- a/ubuntu/vmhgfs/compat_highmem.h
+++ b/ubuntu/vmhgfs/compat_highmem.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_HIGHMEM_H__
 #   define __COMPAT_HIGHMEM_H__
diff --git a/ubuntu/vmhgfs/compat_kernel.h b/ubuntu/vmhgfs/compat_kernel.h
index d278ae7..76b47cf 100644
--- a/ubuntu/vmhgfs/compat_kernel.h
+++ b/ubuntu/vmhgfs/compat_kernel.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2004 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_KERNEL_H__
 #   define __COMPAT_KERNEL_H__
diff --git a/ubuntu/vmhgfs/compat_list.h b/ubuntu/vmhgfs/compat_list.h
index baaa8ac..333557b 100644
--- a/ubuntu/vmhgfs/compat_list.h
+++ b/ubuntu/vmhgfs/compat_list.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_LIST_H__
 #   define __COMPAT_LIST_H__
@@ -22,6 +22,16 @@
 #include <linux/list.h>
 
 /*
+ * list_add_tail is with us since 2.4.0, or something like that.
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
+#define list_add_tail(newe, head) do {  \
+   struct list_head *__h = (head);      \
+   __list_add((newe), __h->prev, __h);  \
+} while (0)
+#endif
+
+/*
  * list_for_each_safe() showed up in 2.4.10, but it may be backported so we
  * just check for its existence.
  */
diff --git a/ubuntu/vmhgfs/compat_mm.h b/ubuntu/vmhgfs/compat_mm.h
index 9e9605b..9265a82 100644
--- a/ubuntu/vmhgfs/compat_mm.h
+++ b/ubuntu/vmhgfs/compat_mm.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_MM_H__
 #   define __COMPAT_MM_H__
diff --git a/ubuntu/vmhgfs/compat_module.h b/ubuntu/vmhgfs/compat_module.h
index 6576fb6..66fc469 100644
--- a/ubuntu/vmhgfs/compat_module.h
+++ b/ubuntu/vmhgfs/compat_module.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2007 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * compat_module.h --
diff --git a/ubuntu/vmhgfs/compat_namei.h b/ubuntu/vmhgfs/compat_namei.h
index 9ca3290..a3176f5 100644
--- a/ubuntu/vmhgfs/compat_namei.h
+++ b/ubuntu/vmhgfs/compat_namei.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_NAMEI_H__
 #   define __COMPAT_NAMEI_H__
diff --git a/ubuntu/vmhgfs/compat_page-flags.h b/ubuntu/vmhgfs/compat_page-flags.h
index 1760fbb..d8a1833 100644
--- a/ubuntu/vmhgfs/compat_page-flags.h
+++ b/ubuntu/vmhgfs/compat_page-flags.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2007 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_PAGE_FLAGS_H__
 #   define __COMPAT_PAGE_FLAGS_H__
diff --git a/ubuntu/vmhgfs/compat_page.h b/ubuntu/vmhgfs/compat_page.h
index 3aeab98..0bf0e25 100644
--- a/ubuntu/vmhgfs/compat_page.h
+++ b/ubuntu/vmhgfs/compat_page.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_PAGE_H__
 #   define __COMPAT_PAGE_H__
diff --git a/ubuntu/vmhgfs/compat_sched.h b/ubuntu/vmhgfs/compat_sched.h
index e54e1b6..6fc79dc 100644
--- a/ubuntu/vmhgfs/compat_sched.h
+++ b/ubuntu/vmhgfs/compat_sched.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SCHED_H__
 #   define __COMPAT_SCHED_H__
@@ -42,6 +42,34 @@
 #   define cond_resched() (need_resched() ? schedule() : (void) 0)
 #endif
 
+/* Oh well.  We need yield...  Happy us! */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 20)
+#   ifdef __x86_64__
+#      define compat_yield() there_is_nothing_like_yield()
+#   else
+#      include <linux/unistd.h>
+#      include <linux/kernel.h>
+
+/*
+ * Used by _syscallX macros. Note that this is global variable, so
+ * do not rely on its contents too much. As exit() is only function
+ * we use, and we never check return value from exit(), we have
+ * no problem...
+ */
+extern int errno;
+
+/*
+ * compat_exit() provides an access to the exit() function. It must 
+ * be named compat_exit(), as exit() (with different signature) is 
+ * provided by x86-64, arm and other (but not by i386).
+ */
+#      define __NR_compat_yield __NR_sched_yield
+static inline _syscall0(int, compat_yield);
+#   endif
+#else
+#   define compat_yield() yield()
+#endif
+
 
 /*
  * Since 2.5.34 there are two methods to enumerate tasks:
diff --git a/ubuntu/vmhgfs/compat_semaphore.h b/ubuntu/vmhgfs/compat_semaphore.h
index 23f92f3..8c6df97 100644
--- a/ubuntu/vmhgfs/compat_semaphore.h
+++ b/ubuntu/vmhgfs/compat_semaphore.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SEMAPHORE_H__
 #   define __COMPAT_SEMAPHORE_H__
diff --git a/ubuntu/vmhgfs/compat_slab.h b/ubuntu/vmhgfs/compat_slab.h
index c0d504b..8654a9a 100644
--- a/ubuntu/vmhgfs/compat_slab.h
+++ b/ubuntu/vmhgfs/compat_slab.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SLAB_H__
 #   define __COMPAT_SLAB_H__
@@ -40,7 +40,10 @@
 #endif
 
 /*
- * Destructor is gone since 2.6.23-pre1.
+ * Up to 2.6.22 kmem_cache_create has 6 arguments - name, size, alignment, flags,
+ * constructor, and destructor.  Then for some time kernel was asserting that
+ * destructor is NULL, and since 2.6.23-pre1 kmem_cache_create takes only 5
+ * arguments - destructor is gone.
  */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)
 #define compat_kmem_cache_create(name, size, align, flags, ctor) \
@@ -50,4 +53,18 @@
 		kmem_cache_create(name, size, align, flags, ctor)
 #endif
 
+/*
+ * 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...
+ */
+#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
+typedef void compat_kmem_cache_ctor(void *, compat_kmem_cache *, unsigned long);
+#else
+typedef void compat_kmem_cache_ctor(compat_kmem_cache *, void *);
+#endif
+
 #endif /* __COMPAT_SLAB_H__ */
diff --git a/ubuntu/vmhgfs/compat_spinlock.h b/ubuntu/vmhgfs/compat_spinlock.h
index c069db9..ea867f2 100644
--- a/ubuntu/vmhgfs/compat_spinlock.h
+++ b/ubuntu/vmhgfs/compat_spinlock.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SPINLOCK_H__
 #   define __COMPAT_SPINLOCK_H__
diff --git a/ubuntu/vmhgfs/compat_statfs.h b/ubuntu/vmhgfs/compat_statfs.h
index 0dc191d..29ec4f8 100644
--- a/ubuntu/vmhgfs/compat_statfs.h
+++ b/ubuntu/vmhgfs/compat_statfs.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_STATFS_H__
 #   define __COMPAT_STATFS_H__
diff --git a/ubuntu/vmhgfs/compat_string.h b/ubuntu/vmhgfs/compat_string.h
index 6ea0ebf..b74f875 100644
--- a/ubuntu/vmhgfs/compat_string.h
+++ b/ubuntu/vmhgfs/compat_string.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2007 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_STRING_H__
 #   define __COMPAT_STRING_H__
diff --git a/ubuntu/vmhgfs/compat_uaccess.h b/ubuntu/vmhgfs/compat_uaccess.h
index d272269..d58ee05 100644
--- a/ubuntu/vmhgfs/compat_uaccess.h
+++ b/ubuntu/vmhgfs/compat_uaccess.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_UACCESS_H__
 #   define __COMPAT_UACCESS_H__
diff --git a/ubuntu/vmhgfs/compat_version.h b/ubuntu/vmhgfs/compat_version.h
index 2f4c546..baf9634 100644
--- a/ubuntu/vmhgfs/compat_version.h
+++ b/ubuntu/vmhgfs/compat_version.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_VERSION_H__
 #   define __COMPAT_VERSION_H__
diff --git a/ubuntu/vmhgfs/compat_wait.h b/ubuntu/vmhgfs/compat_wait.h
index e3aca6c..ebcf087 100644
--- a/ubuntu/vmhgfs/compat_wait.h
+++ b/ubuntu/vmhgfs/compat_wait.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_WAIT_H__
 #   define __COMPAT_WAIT_H__
diff --git a/ubuntu/vmhgfs/cpName.c b/ubuntu/vmhgfs/cpName.c
index cfa5e27..7383ecc 100644
--- a/ubuntu/vmhgfs/cpName.c
+++ b/ubuntu/vmhgfs/cpName.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * cpName.c --
diff --git a/ubuntu/vmhgfs/cpName.h b/ubuntu/vmhgfs/cpName.h
index ab809f0..135f5bd 100644
--- a/ubuntu/vmhgfs/cpName.h
+++ b/ubuntu/vmhgfs/cpName.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * cpName.h --
@@ -30,11 +30,20 @@
 #ifdef __KERNEL__
 #include "driver-config.h"
 #include <linux/string.h>
-#elif !defined(sun)
+#elif !defined(sun) && !defined(__FreeBSD__)
 #include <stdlib.h>
 #include <string.h>
 #endif
 
+#if defined(__FreeBSD__)
+#   if defined(_KERNEL)
+#      include <sys/libkern.h>
+#      define strchr(s,c)       index(s,c)
+#   else
+#      include <string.h>
+#   endif
+#endif
+
 #include "vm_basic_types.h"
 
 
diff --git a/ubuntu/vmhgfs/cpNameInt.h b/ubuntu/vmhgfs/cpNameInt.h
index 21f5031..6783001 100644
--- a/ubuntu/vmhgfs/cpNameInt.h
+++ b/ubuntu/vmhgfs/cpNameInt.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * cpNameInt.h --
diff --git a/ubuntu/vmhgfs/cpNameLinux.c b/ubuntu/vmhgfs/cpNameLinux.c
index ae1e3dd..7bec48d 100644
--- a/ubuntu/vmhgfs/cpNameLinux.c
+++ b/ubuntu/vmhgfs/cpNameLinux.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * cpNameLinux.c --
diff --git a/ubuntu/vmhgfs/cpNameLite.c b/ubuntu/vmhgfs/cpNameLite.c
index 343c0d4..f68773d 100644
--- a/ubuntu/vmhgfs/cpNameLite.c
+++ b/ubuntu/vmhgfs/cpNameLite.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * cpNameLite.c --
diff --git a/ubuntu/vmhgfs/cpNameLite.h b/ubuntu/vmhgfs/cpNameLite.h
index d6e63f0..653e12d 100644
--- a/ubuntu/vmhgfs/cpNameLite.h
+++ b/ubuntu/vmhgfs/cpNameLite.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * cpLiteName.h --
diff --git a/ubuntu/vmhgfs/dbllnklst.h b/ubuntu/vmhgfs/dbllnklst.h
index 50d04c5..645b722 100644
--- a/ubuntu/vmhgfs/dbllnklst.h
+++ b/ubuntu/vmhgfs/dbllnklst.h
@@ -1,6 +1,5 @@
-/*
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- *
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * dbllnklst.h --
diff --git a/ubuntu/vmhgfs/dentry.c b/ubuntu/vmhgfs/dentry.c
index 71be7fb..9783b0d 100644
--- a/ubuntu/vmhgfs/dentry.c
+++ b/ubuntu/vmhgfs/dentry.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * dentry.c --
diff --git a/ubuntu/vmhgfs/dir.c b/ubuntu/vmhgfs/dir.c
index 4b87a9b..174958a 100644
--- a/ubuntu/vmhgfs/dir.c
+++ b/ubuntu/vmhgfs/dir.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * dir.c --
diff --git a/ubuntu/vmhgfs/driver-config.h b/ubuntu/vmhgfs/driver-config.h
index b9aec7f..3722731 100644
--- a/ubuntu/vmhgfs/driver-config.h
+++ b/ubuntu/vmhgfs/driver-config.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * Sets the proper defines from the Linux header files
diff --git a/ubuntu/vmhgfs/escBitvector.h b/ubuntu/vmhgfs/escBitvector.h
index cd49d3d..72f812d 100644
--- a/ubuntu/vmhgfs/escBitvector.h
+++ b/ubuntu/vmhgfs/escBitvector.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 
 
@@ -36,6 +36,9 @@
 #include <string.h>
 #endif
 
+#if defined(_KERNEL) && defined(__FreeBSD__)
+# include <sys/libkern.h>
+#endif
 
 #include "vm_assert.h"
 
diff --git a/ubuntu/vmhgfs/file.c b/ubuntu/vmhgfs/file.c
index fca786d..210c58e 100644
--- a/ubuntu/vmhgfs/file.c
+++ b/ubuntu/vmhgfs/file.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * file.c --
diff --git a/ubuntu/vmhgfs/filesystem.c b/ubuntu/vmhgfs/filesystem.c
index 97cec3f..8418bee 100644
--- a/ubuntu/vmhgfs/filesystem.c
+++ b/ubuntu/vmhgfs/filesystem.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * filesystem.c --
@@ -87,9 +87,7 @@ atomic_t hgfsVersionCreateDir;
 
 /* Private functions. */
 static inline unsigned long HgfsComputeBlockBits(unsigned long blockSize);
-static void HgfsInodeCacheCtor(void *slabElem,
-                               compat_kmem_cache *cache,
-                               unsigned long flags);
+static compat_kmem_cache_ctor HgfsInodeCacheCtor;
 static HgfsSuperInfo *HgfsInitSuperInfo(HgfsMountInfo *mountInfo);
 static int HgfsReadSuper(struct super_block *sb,
                          void *rawData,
@@ -188,10 +186,16 @@ HgfsComputeBlockBits(unsigned long blockSize)
  *-----------------------------------------------------------------------------
  */
 
+#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS
 static void
 HgfsInodeCacheCtor(void *slabElem,           // IN: slab item to initialize
                    compat_kmem_cache *cache, // IN: cache slab is from
                    unsigned long flags)      // IN: flags associated with allocation
+#else
+static void
+HgfsInodeCacheCtor(compat_kmem_cache *cache, // IN: cache slab is from
+                   void *slabElem)           // IN: slab item to initialize
+#endif
 {
 #ifdef VMW_EMBED_INODE
    HgfsInodeInfo *iinfo = (HgfsInodeInfo *)slabElem;
diff --git a/ubuntu/vmhgfs/filesystem.h b/ubuntu/vmhgfs/filesystem.h
index 4c89c40..e9c6bac 100644
--- a/ubuntu/vmhgfs/filesystem.h
+++ b/ubuntu/vmhgfs/filesystem.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * filesystem.h --
diff --git a/ubuntu/vmhgfs/fsutil.c b/ubuntu/vmhgfs/fsutil.c
index ad69c1d..4e961e3 100644
--- a/ubuntu/vmhgfs/fsutil.c
+++ b/ubuntu/vmhgfs/fsutil.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * fsutil.c --
@@ -1601,6 +1601,9 @@ HgfsStatusConvertToLinux(HgfsStatus hgfsStatus) // IN: Status code to convert
    case HGFS_STATUS_OPERATION_NOT_SUPPORTED:
       return -EOPNOTSUPP;
 
+   case HGFS_STATUS_NAME_TOO_LONG:
+      return -ENAMETOOLONG;
+
    case HGFS_STATUS_GENERIC_ERROR:
       return -EIO;
 
diff --git a/ubuntu/vmhgfs/fsutil.h b/ubuntu/vmhgfs/fsutil.h
index 1129410..acfe0dd 100644
--- a/ubuntu/vmhgfs/fsutil.h
+++ b/ubuntu/vmhgfs/fsutil.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * fsutil.h --
diff --git a/ubuntu/vmhgfs/guest_msg_def.h b/ubuntu/vmhgfs/guest_msg_def.h
index 44ae0fa..292bfd0 100644
--- a/ubuntu/vmhgfs/guest_msg_def.h
+++ b/ubuntu/vmhgfs/guest_msg_def.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * guest_msg_def.h --
diff --git a/ubuntu/vmhgfs/hgfs.h b/ubuntu/vmhgfs/hgfs.h
index 3e26521..a2a607c 100644
--- a/ubuntu/vmhgfs/hgfs.h
+++ b/ubuntu/vmhgfs/hgfs.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 
 
@@ -135,6 +135,7 @@ typedef enum {
    HGFS_STATUS_SHARING_VIOLATION,
    HGFS_STATUS_NO_SPACE,
    HGFS_STATUS_OPERATION_NOT_SUPPORTED,
+   HGFS_STATUS_NAME_TOO_LONG,
 } HgfsStatus;
 
 /*
diff --git a/ubuntu/vmhgfs/hgfsBd.c b/ubuntu/vmhgfs/hgfsBd.c
index d934b79..d0e9a9a 100644
--- a/ubuntu/vmhgfs/hgfsBd.c
+++ b/ubuntu/vmhgfs/hgfsBd.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * hgfsBd.c --
@@ -22,7 +22,7 @@
  *    Backdoor calls used by hgfs pserver. [bac]
  */
 
-#ifdef __KERNEL__
+#if defined(__KERNEL__) || defined(_KERNEL)
 #   include "kernelStubs.h"
 #else
 #   include <stdio.h>
diff --git a/ubuntu/vmhgfs/hgfsBd.h b/ubuntu/vmhgfs/hgfsBd.h
index 4639ea3..10ccec0 100644
--- a/ubuntu/vmhgfs/hgfsBd.h
+++ b/ubuntu/vmhgfs/hgfsBd.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef _HGFS_BD_H_
 # define _HGFS_BD_H_
diff --git a/ubuntu/vmhgfs/hgfsDevLinux.h b/ubuntu/vmhgfs/hgfsDevLinux.h
index 1a18c32..beeddea 100644
--- a/ubuntu/vmhgfs/hgfsDevLinux.h
+++ b/ubuntu/vmhgfs/hgfsDevLinux.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * hgfsDev.h --
diff --git a/ubuntu/vmhgfs/hgfsProto.h b/ubuntu/vmhgfs/hgfsProto.h
index dc139c3..e8d8d72 100644
--- a/ubuntu/vmhgfs/hgfsProto.h
+++ b/ubuntu/vmhgfs/hgfsProto.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 
 /*
@@ -393,6 +393,31 @@ HgfsAttrV2;
  * server's minimum packet size can be changed, but the client should continue
  * to send an extra byte, otherwise older servers with a slightly longer 
  * minimum packet size may consider the new client's packets to be too short.
+ *
+ * UTF-8 representation
+ * --------------------
+ * XXX: It is expected that file names in the HGFS protocol will be a valid UTF-8
+ * encoding.
+ * See RFC 3629 (http://tools.ietf.org/html/rfc3629)
+ *
+ * Unicode Format
+ * --------------
+ * HGFS protocol requests that contain file names as in the structure below,
+ * should contain unicode normal form C (precomposed see explanation below)
+ * characters therefore hosts such as Mac OS X which
+ * use HFS+ and unicode form D should convert names before
+ * processing or sending HGFS requests.
+ *
+ * Precomposed (normal form C) versus Decomposed (normal form D)
+ * -------------------------------------------------------------
+ * Certain Unicode characters can be encoded in more than one way. 
+ * For example, an Á (A acute) can be encoded either precomposed,
+ * as U+00C1 (LATIN CAPITAL LETTER A WITH ACUTE), or decomposed, 
+ * as U+0041 U+0301 (LATIN CAPITAL LETTER A followed by a COMBINING ACUTE ACCENT).
+ * Precomposed characters are more common in the Windows world, 
+ * whereas decomposed characters are more common on the Mac.
+ *
+ * See UAX 15 (http://unicode.org/reports/tr15/)
  */
 
 typedef
diff --git a/ubuntu/vmhgfs/hgfsUtil.c b/ubuntu/vmhgfs/hgfsUtil.c
index 5070483..6b259f4 100644
--- a/ubuntu/vmhgfs/hgfsUtil.c
+++ b/ubuntu/vmhgfs/hgfsUtil.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * hgfsUtil.c --
@@ -251,6 +251,8 @@ HgfsConvertFromInternalStatus(HgfsInternalStatus status) // IN
       return HGFS_STATUS_NO_SPACE;
    case EOPNOTSUPP:
       return HGFS_STATUS_OPERATION_NOT_SUPPORTED;
+   case ENAMETOOLONG:
+      return HGFS_STATUS_NAME_TOO_LONG;
    case HGFS_INTERNAL_STATUS_ERROR:
    default:
       return HGFS_STATUS_GENERIC_ERROR;
diff --git a/ubuntu/vmhgfs/hgfsUtil.h b/ubuntu/vmhgfs/hgfsUtil.h
index 0af683e..3f19a63 100644
--- a/ubuntu/vmhgfs/hgfsUtil.h
+++ b/ubuntu/vmhgfs/hgfsUtil.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 
 /*
@@ -27,10 +27,10 @@
 #ifndef _HGFSUTIL_H_
 #   define _HGFSUTIL_H_
 
-#   ifdef __KERNEL__
+#   if defined(__linux__) && defined(__KERNEL__)
 #      include "driver-config.h"
 #      include <linux/time.h> // for time_t and timespec
-#   else
+#   elif !defined(_KERNEL)
 #      include <time.h>
 #   endif
 #   include "vm_basic_types.h"
@@ -51,8 +51,12 @@ struct timespec {
 
 /* Cross-platform representation of a platform-specific error code. */
 #ifndef _WIN32
-#   ifdef __KERNEL__
-#      include <linux/errno.h>
+#   if defined(__KERNEL__) || defined(_KERNEL)
+#      if defined(__linux__)
+#         include <linux/errno.h>
+#      elif defined(sun) || defined(__FreeBSD__)
+#         include <sys/errno.h>
+#      endif
 #   else
 #      include <errno.h>
 #   endif
@@ -73,7 +77,7 @@ struct timespec {
 #define HGFS_INTERNAL_STATUS_ERROR -1
 
 /*
- * Older FreeBSDs do not define EPROTO, so we'll define our own error code.
+ * FreeBSD (pre-6.0) does not define EPROTO, so we'll define our own error code.
  */
 #if defined(__FreeBSD__) && !defined(EPROTO)
 #define EPROTO (ELAST + 1)
@@ -90,7 +94,7 @@ struct timespec {
 
 uint64 HgfsConvertToNtTime(time_t unixTime, // IN
 			   long   nsec);    // IN
-static INLINE uint64 
+static INLINE uint64
 HgfsConvertTimeSpecToNtTime(const struct timespec *unixTime) // IN
 {
    return HgfsConvertToNtTime(unixTime->tv_sec, unixTime->tv_nsec);
diff --git a/ubuntu/vmhgfs/includeCheck.h b/ubuntu/vmhgfs/includeCheck.h
index f694d02..b3d5bb3 100644
--- a/ubuntu/vmhgfs/includeCheck.h
+++ b/ubuntu/vmhgfs/includeCheck.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * includeCheck.h --
diff --git a/ubuntu/vmhgfs/inode.c b/ubuntu/vmhgfs/inode.c
index 6ecb579..9d3739a 100644
--- a/ubuntu/vmhgfs/inode.c
+++ b/ubuntu/vmhgfs/inode.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * inode.c --
diff --git a/ubuntu/vmhgfs/inode.h b/ubuntu/vmhgfs/inode.h
index bd22a38..e5f758b 100644
--- a/ubuntu/vmhgfs/inode.h
+++ b/ubuntu/vmhgfs/inode.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * inode.h --
diff --git a/ubuntu/vmhgfs/kernelStubs.h b/ubuntu/vmhgfs/kernelStubs.h
index 1301bc0..6c92300 100644
--- a/ubuntu/vmhgfs/kernelStubs.h
+++ b/ubuntu/vmhgfs/kernelStubs.h
@@ -1,6 +1,5 @@
-/* ************************************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * ***********************************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * kernelStubs.h
@@ -39,10 +39,22 @@
 #include <stdarg.h>  /* for va_start stuff */
 #include <stdlib.h>  /* for min macro. */
 #include "vm_assert.h"  /* Our assert macros */
-#endif /* _WIN32 */
-
-
-#ifdef linux
+#elif defined(__FreeBSD__)
+#   ifndef _KERNEL
+#      error "_KERNEL is not defined"
+#   endif
+#   include "vm_basic_types.h"
+#   include <sys/types.h>
+#   include <sys/malloc.h>
+#   include <sys/param.h>
+#   include <sys/kernel.h>
+#   include <machine/stdarg.h>
+#   include <sys/libkern.h>
+#   include "vm_assert.h"
+#endif
+
+
+#ifdef linux                                    /* if (linux) { */
 char *strdup(const char *source);
 
 void *malloc(size_t size);
@@ -50,7 +62,7 @@ void free(void *mem);
 void *calloc(size_t num, size_t len);
 void *realloc(void *ptr, size_t newSize);
 
-#elif defined(_WIN32)
+#elif defined(_WIN32)                           /* } else if (Win32) { */
 
 #if (_WIN32_WINNT == 0x0400)
 /* The following declarations are missing on NT4. */
@@ -66,7 +78,34 @@ typedef unsigned int SIZE_T;
 NTKERNELAPI VOID ExFreePoolWithTag(IN PVOID  P, IN ULONG  Tag);
 #endif /* _WIN32_WINNT */
 
-#endif /* _WIN32 */
+#elif defined(__FreeBSD__)                      /* } else if (FreeBSD) { */
+
+/* Kernel memory on FreeBSD is tagged for statistics and sanity checking. */
+MALLOC_DECLARE(M_VMWARE_TEMP);
+
+/*
+ * On FreeBSD, the general memory allocator for both userland and the kernel is named
+ * malloc, but the kernel malloc() takes more arguments.  The following alias & macros
+ * work around this, to provide the standard malloc() API for userspace code that is
+ * being used in the kernel.
+ */
+
+#   undef malloc
+
+static INLINE void *
+__compat_malloc(unsigned long size, struct malloc_type *type, int flags) {
+   return malloc(size, type, flags);
+}
+
+#   define malloc(size)         __compat_malloc(size, M_VMWARE_TEMP, M_NOWAIT)
+#   define calloc(count, size)  __compat_malloc((count) * (size),       \
+                                                M_VMWARE_TEMP, M_NOWAIT|M_ZERO)
+#   define realloc(buf, size)   realloc(buf, size, M_VMWARE_TEMP, M_NOWAIT)
+#   define free(buf)            free(buf, M_VMWARE_TEMP)
+#   define strchr(s,c)          index(s,c)
+#   define strrchr(s,c)         rindex(s,c)
+
+#endif                                          /* } */
 
 /*
  * Stub functions we provide.
@@ -77,7 +116,7 @@ uint64 System_Uptime(void);
 char *Str_Strcpy(char *buf, const char *src, size_t maxSize);
 int Str_Vsnprintf(char *str, size_t size, const char *format,
                   va_list arguments);
-char *Str_Vasprintf(size_t *length, const char *format, 
+char *Str_Vasprintf(size_t *length, const char *format,
                     va_list arguments);
 char *Str_Asprintf(size_t *length, const char *Format, ...);
 char *StrUtil_GetNextToken(unsigned int *index,
diff --git a/ubuntu/vmhgfs/kernelStubsLinux.c b/ubuntu/vmhgfs/kernelStubsLinux.c
index 81f2e1f..c83e75c 100644
--- a/ubuntu/vmhgfs/kernelStubsLinux.c
+++ b/ubuntu/vmhgfs/kernelStubsLinux.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * kernelStubsLinux.c
@@ -193,6 +193,8 @@ Str_Vasprintf(size_t *length,       // OUT
        * XXX Yes, this could overflow and spin forever when you get near 2GB
        *     allocations. I don't care. --rrdharan
        */
+      va_list args2;
+
       bufSize *= 2;
       buf = realloc(buf, bufSize);
 
@@ -200,8 +202,9 @@ Str_Vasprintf(size_t *length,       // OUT
          return NULL;
       }
 
-      retval = Str_Vsnprintf(buf, bufSize, format, arguments);
-
+      va_copy(args2, arguments);
+      retval = Str_Vsnprintf(buf, bufSize, format, args2);
+      va_end(args2);
    } while (retval == -1);
 
    if (length) {
diff --git a/ubuntu/vmhgfs/link.c b/ubuntu/vmhgfs/link.c
index 04e21c5..b716234 100644
--- a/ubuntu/vmhgfs/link.c
+++ b/ubuntu/vmhgfs/link.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * link.c --
diff --git a/ubuntu/vmhgfs/message.c b/ubuntu/vmhgfs/message.c
index 441ce97..1bceec9 100644
--- a/ubuntu/vmhgfs/message.c
+++ b/ubuntu/vmhgfs/message.c
@@ -1,6 +1,5 @@
-/*
- * Copyright 1999 VMware, Inc.  All rights reserved. 
- *
+/*********************************************************
+ * Copyright (C) 1999 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * message.c --
@@ -41,7 +41,7 @@
 extern "C" {
 #endif
 
-#ifdef __KERNEL__
+#if defined(__KERNEL__) || defined(_KERNEL)
 #   include "kernelStubs.h"
 #else
 #   include <stdio.h>
diff --git a/ubuntu/vmhgfs/message.h b/ubuntu/vmhgfs/message.h
index f2488b0..264f4ec 100644
--- a/ubuntu/vmhgfs/message.h
+++ b/ubuntu/vmhgfs/message.h
@@ -1,6 +1,5 @@
-/*
- * Copyright 1999 VMware, Inc.  All rights reserved. 
- *
+/*********************************************************
+ * Copyright (C) 1999 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * message.h --
diff --git a/ubuntu/vmhgfs/messageBackdoor.c b/ubuntu/vmhgfs/messageBackdoor.c
index 38d26ab..e0c64ea 100644
--- a/ubuntu/vmhgfs/messageBackdoor.c
+++ b/ubuntu/vmhgfs/messageBackdoor.c
@@ -1,6 +1,5 @@
-/*
- * Copyright 1999 VMware, Inc.  All rights reserved. 
- *
+/*********************************************************
+ * Copyright (C) 1999 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * messageBackdoor.c --
@@ -42,7 +42,7 @@ extern "C" {
 #endif
 
 
-#ifdef __KERNEL__
+#if defined(__KERNEL__) || defined(_KERNEL)
 #   include "kernelStubs.h"
 #else
 #   include <stdio.h>
@@ -297,7 +297,7 @@ retry:
             myBufSize -= 3;
             break;
          default:
-            bp.in.size = *(uint32 *)myBuf;
+            bp.in.size = *(const uint32 *)myBuf;
             myBufSize -= 4;
             break;
          }
diff --git a/ubuntu/vmhgfs/module.c b/ubuntu/vmhgfs/module.c
index cf154e0..35cb2aa 100644
--- a/ubuntu/vmhgfs/module.c
+++ b/ubuntu/vmhgfs/module.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * module.c --
diff --git a/ubuntu/vmhgfs/module.h b/ubuntu/vmhgfs/module.h
index 20f186f..8840b2c 100644
--- a/ubuntu/vmhgfs/module.h
+++ b/ubuntu/vmhgfs/module.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * module.h --
diff --git a/ubuntu/vmhgfs/page.c b/ubuntu/vmhgfs/page.c
index 9e3c6cc..c17f5a7 100644
--- a/ubuntu/vmhgfs/page.c
+++ b/ubuntu/vmhgfs/page.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * page.c --
diff --git a/ubuntu/vmhgfs/request.c b/ubuntu/vmhgfs/request.c
index 96170fb..03a3e4b 100644
--- a/ubuntu/vmhgfs/request.c
+++ b/ubuntu/vmhgfs/request.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * request.c --
diff --git a/ubuntu/vmhgfs/request.h b/ubuntu/vmhgfs/request.h
index a0a9262..8e93ba8 100644
--- a/ubuntu/vmhgfs/request.h
+++ b/ubuntu/vmhgfs/request.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * request.h --
diff --git a/ubuntu/vmhgfs/rpcout.c b/ubuntu/vmhgfs/rpcout.c
index 9a9182a..82ea16a 100644
--- a/ubuntu/vmhgfs/rpcout.c
+++ b/ubuntu/vmhgfs/rpcout.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2004 VMware, Inc. All Rights Reserved 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * rpcout.c --
@@ -29,7 +29,7 @@
  */
 
 
-#ifdef __KERNEL__
+#if defined(__KERNEL__) || defined(_KERNEL)
 #   include "kernelStubs.h"
 #else
 #   include <stdio.h>
@@ -171,7 +171,7 @@ RpcOut_send(RpcOut *out,         // IN
    ASSERT(out);
 
    ASSERT(out->channel);
-   if (Message_Send(out->channel, request, reqLen) == FALSE) {
+   if (Message_Send(out->channel, (const unsigned char *)request, reqLen) == FALSE) {
       *reply = "RpcOut: Unable to send the RPCI command";
       *repLen = strlen(*reply);
 
@@ -185,16 +185,16 @@ RpcOut_send(RpcOut *out,         // IN
       return FALSE;
    }
 
-   if (   myRepLen < 2
-       || (   (success = strncmp(myReply, "1 ", 2) == 0) == FALSE
-	   && strncmp(myReply, "0 ", 2))) {
+   if (myRepLen < 2
+       || (   (success = strncmp((const char *)myReply, "1 ", 2) == 0) == FALSE
+              && strncmp((const char *)myReply, "0 ", 2))) {
       *reply = "RpcOut: Invalid format for the result of the RPCI command";
       *repLen = strlen(*reply);
 
       return FALSE;
    }
 
-   *reply = myReply + 2;
+   *reply = ((const char *)myReply) + 2;
    *repLen = myRepLen - 2;
 
    return success;
diff --git a/ubuntu/vmhgfs/rpcout.h b/ubuntu/vmhgfs/rpcout.h
index 7c9d59d..f46751b 100644
--- a/ubuntu/vmhgfs/rpcout.h
+++ b/ubuntu/vmhgfs/rpcout.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2007 VMware, Inc. All Rights Reserved 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * rpcout.h --
diff --git a/ubuntu/vmhgfs/staticEscape.c b/ubuntu/vmhgfs/staticEscape.c
index 437dbc4..c7f206d 100644
--- a/ubuntu/vmhgfs/staticEscape.c
+++ b/ubuntu/vmhgfs/staticEscape.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * staticEscape.c --
@@ -25,8 +25,15 @@
  *
  */
 
-#ifdef sun
-# include <string.h>
+#if defined(sun)
+#   include <string.h>
+#elif defined(__FreeBSD__)
+#   if defined(_KERNEL)
+#      include <sys/libkern.h>
+#      define memmove(dst0, src0, len)  bcopy(src0, dst0, len)
+#   else
+#      include <string.h>
+#   endif
 #endif
 
 #include "vm_assert.h"
diff --git a/ubuntu/vmhgfs/staticEscape.h b/ubuntu/vmhgfs/staticEscape.h
index ffa5794..0c89d2e 100644
--- a/ubuntu/vmhgfs/staticEscape.h
+++ b/ubuntu/vmhgfs/staticEscape.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * staticEscape.h --
diff --git a/ubuntu/vmhgfs/stubs.c b/ubuntu/vmhgfs/stubs.c
index e01c6ae..f79b765 100644
--- a/ubuntu/vmhgfs/stubs.c
+++ b/ubuntu/vmhgfs/stubs.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * stubs.c
diff --git a/ubuntu/vmhgfs/super.c b/ubuntu/vmhgfs/super.c
index 9af83b4..9f73d8e 100644
--- a/ubuntu/vmhgfs/super.c
+++ b/ubuntu/vmhgfs/super.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2006 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * super.c --
diff --git a/ubuntu/vmhgfs/vm_assert.h b/ubuntu/vmhgfs/vm_assert.h
index 07b987f..12b67f3 100644
--- a/ubuntu/vmhgfs/vm_assert.h
+++ b/ubuntu/vmhgfs/vm_assert.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 1998-2004 VMware, Inc.  All rights reserved.
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998-2004 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vm_assert.h --
diff --git a/ubuntu/vmhgfs/vm_basic_asm.h b/ubuntu/vmhgfs/vm_basic_asm.h
index 314be65..0d29068 100644
--- a/ubuntu/vmhgfs/vm_basic_asm.h
+++ b/ubuntu/vmhgfs/vm_basic_asm.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 2003 VMware, Inc.  All rights reserved.
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vm_basic_asm.h
@@ -775,14 +774,15 @@ RDTSC(void)
 #ifdef __GNUC__
 {
 #ifdef VM_X86_64
-   uint32 tscLow, tscHigh;
+   uint64 tscLow;
+   uint64 tscHigh;
 
    __asm__ __volatile__(
       "rdtsc"
       : "=a" (tscLow), "=d" (tscHigh)
    );
 
-   return (uint64) tscHigh << 32 | tscLow;
+   return tscHigh << 32 | tscLow;
 #else
    uint64 tim;
 
diff --git a/ubuntu/vmhgfs/vm_basic_asm_x86.h b/ubuntu/vmhgfs/vm_basic_asm_x86.h
index d85d253..e40035a 100644
--- a/ubuntu/vmhgfs/vm_basic_asm_x86.h
+++ b/ubuntu/vmhgfs/vm_basic_asm_x86.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 1998-2003 VMware, Inc.  All rights reserved.
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998-2003 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vm_basic_asm_x86.h
diff --git a/ubuntu/vmhgfs/vm_basic_asm_x86_64.h b/ubuntu/vmhgfs/vm_basic_asm_x86_64.h
index 57506b4..5647a84 100644
--- a/ubuntu/vmhgfs/vm_basic_asm_x86_64.h
+++ b/ubuntu/vmhgfs/vm_basic_asm_x86_64.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 1998-2004 VMware, Inc.  All rights reserved.
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998-2004 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vm_basic_asm_x86_64.h
diff --git a/ubuntu/vmhgfs/vm_basic_defs.h b/ubuntu/vmhgfs/vm_basic_defs.h
index e01cb24..8da371b 100644
--- a/ubuntu/vmhgfs/vm_basic_defs.h
+++ b/ubuntu/vmhgfs/vm_basic_defs.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 2003 VMware, Inc.  All rights reserved.
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vm_basic_defs.h --
@@ -152,8 +151,6 @@ Max(int a, int b)
 #ifndef PAGE_SHIFT // {
 #if defined VM_I386
    #define PAGE_SHIFT    12
-#elif defined VM_IA64
-   #define PAGE_SHIFT    14	// On IA-64, the default page size is 16K
 #elif defined __APPLE__
    #define PAGE_SHIFT    12
 #else
@@ -382,6 +379,31 @@ typedef int pid_t;
 
 #endif // }
 
+#ifndef va_copy
+#ifdef _WIN32
+
+/*
+ * Windows needs va_copy. This works for both 32 and 64-bit Windows
+ * based on inspection of how varags.h from the Visual C CRTL is
+ * implemented. (Future versions of the RTL may break this).
+ */
+
+#define va_copy(dest, src) ((dest) = (src))
+
+#endif // _WIN32
+
+#if defined(__APPLE__) && defined(KERNEL)
+
+/*
+ * MacOS kernel-mode needs va_copy. Based on inspection of stdarg.h
+ * from the MacOSX10.4u.sdk kernel framework, this should work.
+ * (Future versions of the SDK may break this).
+ */
+
+#define va_copy(dest, src) ((dest) = (src))
+
+#endif // __APPLE__ && KERNEL
+#endif // va_copy
 
 /*
  * This one is outside USERLEVEL because it's used by
diff --git a/ubuntu/vmhgfs/vm_basic_types.h b/ubuntu/vmhgfs/vm_basic_types.h
index 5fc0231..bdefa6f 100644
--- a/ubuntu/vmhgfs/vm_basic_types.h
+++ b/ubuntu/vmhgfs/vm_basic_types.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (c) 1998-2007 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998-2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  *
@@ -63,10 +63,6 @@ typedef char           Bool;
 #define VM_I386
 #endif
 
-#ifdef __ia64__
-#define VM_IA64
-#endif
-
 #ifdef _WIN64
 #define __x86_64__
 #endif
@@ -86,10 +82,6 @@ typedef char           Bool;
 #define VM_I386
 #endif
 
-#if defined VM_I386 && defined VM_IA64
-#error "Only one CPU platform is allowed."
-#endif
-
 #ifdef _MSC_VER
 typedef unsigned __int64 uint64;
 typedef signed __int64 int64;
@@ -109,7 +101,7 @@ typedef signed __int64 int64;
 #elif __GNUC__
 /* The Xserver source compiles with -ansi -pendantic */
 #ifndef __STRICT_ANSI__
-#if defined(VM_IA64) || defined(VM_X86_64)
+#if defined(VM_X86_64)
 typedef unsigned long uint64;
 typedef long int64;
 #else
@@ -140,54 +132,71 @@ typedef char      int8;
  * This applies to Solaris as well.
  */
 
-#if defined(__FreeBSD__) || defined(sun)
-#   ifdef KLD_MODULE
-#      include <sys/types.h>
-#   else
-#      if (BSD_VERSION >= 50) || defined(HAVE_INTTYPES_H)
-#         include <inttypes.h>
+/*
+ * Before trying to do the includes based on OS defines, see if we can use
+ * feature-based defines to get as much functionality as possible
+ */
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_INTTYPES_H
+#include <sys/inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if !defined(USING_AUTOCONF)
+#   if defined(__FreeBSD__) || defined(sun)
+#      ifdef KLD_MODULE
 #         include <sys/types.h>
 #      else
-#         include <sys/inttypes.h>
-#      endif
-#   endif
-#elif defined __APPLE__
-#   if KERNEL
-#       include <sys/types.h> /* mostly for size_t */
-#       include <stdint.h>
-#   else
-#       include <inttypes.h>
-#       include <stdlib.h>
-#       include <stdint.h>
-#   endif
-#else
-#   if !defined(__intptr_t_defined) && !defined(intptr_t)
-#      define __intptr_t_defined
-#      define intptr_t  intptr_t
-#      ifdef VM_I386
-#         ifdef VM_X86_64
-             typedef int64     intptr_t;
+#         if (BSD_VERSION >= 50)
+#            include <inttypes.h>
+#            include <sys/types.h>
 #         else
-             typedef int32     intptr_t;
+#            include <sys/inttypes.h>
 #         endif
 #      endif
-
-#      ifdef VM_IA64
-          typedef int64     intptr_t;
+#   elif defined __APPLE__
+#      if KERNEL
+#         include <sys/unistd.h>
+#         include <sys/types.h> /* mostly for size_t */
+#         include <stdint.h>
+#      else
+#         include <unistd.h>
+#         include <inttypes.h>
+#         include <stdlib.h>
+#         include <stdint.h>
 #      endif
-#   endif
-
-#   ifndef _STDINT_H
-#      ifdef VM_I386
-#         ifdef VM_X86_64
-             typedef uint64    uintptr_t;
-#         else
-             typedef uint32    uintptr_t;
+#   else
+#      if !defined(__intptr_t_defined) && !defined(intptr_t)
+#         define __intptr_t_defined
+#         define intptr_t  intptr_t
+#         ifdef VM_I386
+#            ifdef VM_X86_64
+typedef int64     intptr_t;
+#            else
+typedef int32     intptr_t;
+#            endif
 #         endif
 #      endif
 
-#      ifdef VM_IA64
-          typedef uint64    uintptr_t;
+#      ifndef _STDINT_H
+#         ifdef VM_I386
+#            ifdef VM_X86_64
+typedef uint64    uintptr_t;
+#            else
+typedef uint32    uintptr_t;
+#            endif
+#         endif
 #      endif
 #   endif
 #endif
@@ -233,10 +242,20 @@ typedef int64 VmTimeVirtualClock;  /* Virtual Clock kept in CPU cycles */
          #define FMTSZ  ""
          #define FMTPD  ""
       #endif
-   #else
+   #elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) \
+      || (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \
+      || (defined(_POSIX2_VERSION) && _POSIX2_VERSION >= 200112L)
       /* BSD/Darwin, Linux */
       #define FMTSZ     "z"
       #define FMTPD     "t"
+   #else
+      /* Systems with a pre-C99 libc */
+      #define FMTSZ     "Z"
+      #ifdef VM_X86_64
+         #define FMTPD  "l"
+      #else
+         #define FMTPD  ""
+      #endif
    #endif
    #ifdef VM_X86_64
       #define FMT64     "l"
@@ -618,6 +637,16 @@ typedef void * UserVA;
 #define ALIGNED(n)
 #endif
 
+/*
+ * __func__ is a stringified function name that is part of the C99 standard. The block
+ * below defines __func__ on older systems where the compiler does not support that
+ * macro.
+ */
+#if defined(__GNUC__) \
+   && ((__GNUC__ == 2 && __GNUC_MINOR < 96) \
+       || (__GNUC__ < 2))
+#   define __func__ __FUNCTION__
+#endif
 
 /*
  * Once upon a time, this was used to silence compiler warnings that
@@ -642,9 +671,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef uint64 size_t;
-#      endif
 #   endif
 #else
 #   ifndef _SIZE_T
@@ -657,9 +683,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef uint64 size_t;
-#      endif
 #   endif
 #   if !defined(FROBOS) && !defined(_SSIZE_T) && !defined(ssize_t)  && !defined(__ssize_t_defined) && !defined(_SSIZE_T_DECLARED)
 #      define _SSIZE_T
@@ -673,9 +696,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef int64 ssize_t;
-#      endif
 #   endif
 #endif
 
@@ -724,4 +744,17 @@ typedef void * UserVA;
 # define FMTMODE "o"
 #endif
 
+/*
+ * Format modifier for printing time_t. Most platforms define a time_t to be
+ * a long int, but on FreeBSD (as of 5.0, it seems), the time_t is a signed
+ * size quantity. Refer to the definition of FMTSZ to see why we need silly
+ * preprocessor arithmetic.
+ * Use this like this: printf("The mode is %"FMTTIME".\n", time);
+ */
+#if defined(__FreeBSD__) && (__FreeBSD__ + 0) && ((__FreeBSD__ + 0) >= 5)
+#   define FMTTIME FMTSZ"d"
+#else
+#   define FMTTIME "ld"
+#endif
+
 #endif  /* _VM_BASIC_TYPES_H_ */
diff --git a/ubuntu/vmhgfs/vmhgfs_version.h b/ubuntu/vmhgfs/vmhgfs_version.h
index 8580c2e..a25db6c 100644
--- a/ubuntu/vmhgfs/vmhgfs_version.h
+++ b/ubuntu/vmhgfs/vmhgfs_version.h
@@ -1,6 +1,5 @@
-/* ************************************************************************
- * Copyright 2007 VMware, Inc.  All rights reserved. 
- * ************************************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vmhgfs_version.h --
@@ -25,8 +25,8 @@
 #ifndef _VMHGFS_VERSION_H_
 #define _VMHGFS_VERSION_H_
 
-#define VMHGFS_DRIVER_VERSION          1.0.1.0
-#define VMHGFS_DRIVER_VERSION_COMMAS   1,0,1,0
-#define VMHGFS_DRIVER_VERSION_STRING   "1.0.1.0"
+#define VMHGFS_DRIVER_VERSION          1.0.1.1
+#define VMHGFS_DRIVER_VERSION_COMMAS   1,0,1,1
+#define VMHGFS_DRIVER_VERSION_STRING   "1.0.1.1"
 
 #endif /* _VMHGFS_VERSION_H_ */
diff --git a/ubuntu/vmhgfs/vmware.h b/ubuntu/vmhgfs/vmware.h
index 1bf3dab..b7cf86c 100644
--- a/ubuntu/vmhgfs/vmware.h
+++ b/ubuntu/vmhgfs/vmware.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 2003 VMware, Inc.  All rights reserved.
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vmware.h --
diff --git a/ubuntu/vmhgfs/vmware_pack_begin.h b/ubuntu/vmhgfs/vmware_pack_begin.h
index f33728f..8bec457 100644
--- a/ubuntu/vmhgfs/vmware_pack_begin.h
+++ b/ubuntu/vmhgfs/vmware_pack_begin.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vmware_pack_begin.h --
diff --git a/ubuntu/vmhgfs/vmware_pack_end.h b/ubuntu/vmhgfs/vmware_pack_end.h
index fcda62c..c87cda9 100644
--- a/ubuntu/vmhgfs/vmware_pack_end.h
+++ b/ubuntu/vmhgfs/vmware_pack_end.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vmware_pack_end.h --
diff --git a/ubuntu/vmhgfs/vmware_pack_init.h b/ubuntu/vmhgfs/vmware_pack_init.h
index 657841f..ecb636a 100644
--- a/ubuntu/vmhgfs/vmware_pack_init.h
+++ b/ubuntu/vmhgfs/vmware_pack_init.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __VMWARE_PACK_INIT_H__
 #   define __VMWARE_PACK_INIT_H__
diff --git a/ubuntu/vmhgfs/x86cpuid.h b/ubuntu/vmhgfs/x86cpuid.h
index aceff35..b3ac170 100644
--- a/ubuntu/vmhgfs/x86cpuid.h
+++ b/ubuntu/vmhgfs/x86cpuid.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef _X86CPUID_H_
 #define _X86CPUID_H_
@@ -239,6 +239,7 @@ FLAGDEFA(  1, ECX, COMMON, 13,  1, CMPX16,              HOST,    0, CMPX16)    \
 FLAGDEF(   1, ECX, INTEL,  14,  1, xPPR,                MASK,    0)            \
 FLAGDEF(   1, ECX, INTEL,  15,  1, PERF_MSR,            MASK,    0)            \
 FLAGDEF(   1, ECX, INTEL,  16,  1, NDA16,               MASK,    0)            \
+FLAGDEF(   1, ECX, INTEL,  18,  1, DCA,                 MASK,    0)            \
 FLAGDEFA(  1, ECX, INTEL,  19,  1, SSE41,               HOST,    0, SSE41)     \
 FLAGDEFA(  1, ECX, INTEL,  20,  1, SSE42,               HOST,    0, SSE42)     \
 FLAGDEFA(  1, ECX, COMMON, 23,  1, POPCNT,              HOST,    0, POPCNT)    \
@@ -372,7 +373,8 @@ FIELDDEF( 8A, ECX, AMD,     0, 32, SVMECX_RSVD,         MASK,    0)            \
 FLAGDEF(  8A, EDX, AMD,     0,  1, SVM_NP,              MASK,    0)            \
 FLAGDEF(  8A, EDX, AMD,     1,  1, SVM_LBR,             MASK,    0)            \
 FLAGDEF(  8A, EDX, AMD,     2,  1, SVM_LOCK,            MASK,    0)            \
-FIELDDEF( 8A, EDX, AMD,     3, 29, SVMEDX_RSVD,         MASK,    0)
+FLAGDEF(  8A, EDX, AMD,     3,  1, SVM_NRIP,            MASK,    0)            \
+FIELDDEF( 8A, EDX, AMD,     4, 28, SVMEDX_RSVD,         MASK,    0)
 
 #define CPUID_FIELD_DATA                                              \
    CPUID_FIELD_DATA_LEVEL_0                                           \
@@ -515,21 +517,33 @@ FIELD_FUNC(NUM_PMCS,         CPUID_INTEL_IDAEAX_NUM_PMCS)
  */
 
 /* Effective Intel CPU Families */
-#define CPUID_FAMILY_486     4
-#define CPUID_FAMILY_P5      5
-#define CPUID_FAMILY_P6      6
-#define CPUID_FAMILY_P4      15
+#define CPUID_FAMILY_486      4
+#define CPUID_FAMILY_P5       5
+#define CPUID_FAMILY_P6       6
+#define CPUID_FAMILY_P4       15
 
 /* Effective AMD CPU Families */
-#define CPUID_FAMILY_5x86    4
-#define CPUID_FAMILY_K5      5
-#define CPUID_FAMILY_K6      5
-#define CPUID_FAMILY_K7      6
-#define CPUID_FAMILY_K8      15
-#define CPUID_FAMILY_K8L     16
-
+#define CPUID_FAMILY_5x86     4
+#define CPUID_FAMILY_K5       5
+#define CPUID_FAMILY_K6       5
+#define CPUID_FAMILY_K7       6
+#define CPUID_FAMILY_K8       15
+#define CPUID_FAMILY_K8L      16
+#define CPUID_FAMILY_K8MOBILE 17
 #define CPUID_FAMILY_EXTENDED 15
 
+/* Intel model information */
+#define CPUID_MODEL_PPRO       1
+#define CPUID_MODEL_PII_3      3
+#define CPUID_MODEL_PII_5      5
+#define CPUID_MODEL_CELERON_6  6
+#define CPUID_MODEL_PIII_7     7
+#define CPUID_MODEL_PIII_8     8
+#define CPUID_MODEL_PM         9
+#define CPUID_MODEL_PIII_A     10
+#define CPUID_MODEL_CORE       14
+#define CPUID_MODEL_CORE2      15
+
 static INLINE uint32
 CPUID_EFFECTIVE_FAMILY(uint32 v) /* %eax from CPUID with %eax=1. */
 {
@@ -583,7 +597,8 @@ static INLINE Bool
 CPUID_FAMILY_IS_CORE(uint32 v) // IN: %eax from CPUID with %eax=1.
 {
    /* Assumes the CPU manufacturer is Intel. */
-   return CPUID_FAMILY_IS_P6(v) && CPUID_EFFECTIVE_MODEL(v) > 13;
+   return CPUID_FAMILY_IS_P6(v) &&
+          CPUID_EFFECTIVE_MODEL(v) >= CPUID_MODEL_CORE;
 }
 
 
@@ -617,23 +632,23 @@ CPUID_FAMILY_IS_K8L(uint32 _eax)
 }
 
 static INLINE Bool
+CPUID_FAMILY_IS_K8MOBILE(uint32 _eax)
+{
+   /* Essentially a K8 (not K8L) part, but with mobile features. */
+   return CPUID_EFFECTIVE_FAMILY(_eax) == CPUID_FAMILY_K8MOBILE;
+}
+
+static INLINE Bool
 CPUID_FAMILY_IS_K8STAR(uint32 _eax)
 {
-   /* Read function name as "K8*", as in wildcard.  Matches K8 or K8L */
-   return CPUID_FAMILY_IS_K8(_eax) || CPUID_FAMILY_IS_K8L(_eax);
+   /*
+    * Read function name as "K8*", as in wildcard.
+    * Matches K8 or K8L or K8MOBILE
+    */
+   return CPUID_FAMILY_IS_K8(_eax) || CPUID_FAMILY_IS_K8L(_eax) ||
+          CPUID_FAMILY_IS_K8MOBILE(_eax);
 }
 
-#define CPUID_MODEL_PPRO       1
-#define CPUID_MODEL_PII_3      3
-#define CPUID_MODEL_PII_5      5
-#define CPUID_MODEL_CELERON_6  6
-#define CPUID_MODEL_PIII_7     7
-#define CPUID_MODEL_PIII_8     8
-#define CPUID_MODEL_PM         9
-#define CPUID_MODEL_PIII_A     10
-#define CPUID_MODEL_CORE       14
-#define CPUID_MODEL_CORE2      15
-#define CPUID_MODEL_EXTENDED   15
 
 #define CPUID_TYPE_PRIMARY     0
 #define CPUID_TYPE_OVERDRIVE   1
@@ -656,9 +671,20 @@ static INLINE Bool
 CPUID_FullyWritableTSC(Bool isIntel, // IN
                        uint32 v)     // IN: %eax from CPUID with %eax=1.
 {
-   return (isIntel && CPUID_FAMILY_IS_CORE(v)) ||
-          (CPUID_FAMILY(v) == CPUID_FAMILY_EXTENDED &&
-           !(isIntel && CPUID_FAMILY_IS_PENTIUM4(v) && CPUID_MODEL(v) < 3));
+   /*
+    * Returns FALSE if:
+    *   - Intel && P6 (pre-core) or
+    *   - Intel && P4 (model < 3) or
+    *   - !Intel && pre-K8 Opteron
+    * Otherwise, returns TRUE.
+    */
+   return !((isIntel &&
+             ((CPUID_FAMILY_IS_P6(v) &&
+               CPUID_EFFECTIVE_MODEL(v) < CPUID_MODEL_CORE) ||
+              (CPUID_FAMILY_IS_PENTIUM4(v) &&
+               CPUID_EFFECTIVE_MODEL(v) < 3))) ||
+            (!isIntel &&
+             CPUID_FAMILY(v) < CPUID_FAMILY_K8));
 }
 
 /*
diff --git a/ubuntu/vmmemctl/Makefile b/ubuntu/vmmemctl/Makefile
index 6f79501..8d8f157 100644
--- a/ubuntu/vmmemctl/Makefile
+++ b/ubuntu/vmmemctl/Makefile
@@ -1,20 +1,21 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 1998 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
+##########################################################
+# Copyright (C) 1998 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
+#
+##########################################################
 
 ####
 ####  VMware kernel module Makefile to be distributed externally
@@ -107,6 +108,22 @@ endif
 
 endif
 
+vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
+	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
+	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+	-DKBUILD_BASENAME=\"$(DRIVER)\" \
+	-Werror -S -o /dev/null -xc $(1) \
+	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
+
+CC_WARNINGS := -Wall -Wstrict-prototypes
+CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS) -DVMW_USING_KBUILD
+ifdef VMX86_DEVEL
+CC_OPTS += -DVMX86_DEVEL
+endif
+ifdef VMX86_DEBUG
+CC_OPTS += -DVMX86_DEBUG
+endif
+
 include $(SRCROOT)/Makefile.kernel
 
 ifdef TOPDIR
diff --git a/ubuntu/vmmemctl/Makefile.kernel b/ubuntu/vmmemctl/Makefile.kernel
index 2426c3d..2112a2e 100644
--- a/ubuntu/vmmemctl/Makefile.kernel
+++ b/ubuntu/vmmemctl/Makefile.kernel
@@ -1,37 +1,25 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 1998 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
+##########################################################
+# Copyright (C) 1998 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
+#
+##########################################################
 
 ####
 ####  VMware vmballoon Makefile to be distributed externally
 ####
-####
-
-vm_check_build = $(shell if $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
-	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
-	-DKBUILD_BASENAME=\"$(DRIVER)\" \
-	-Werror -S -o /dev/null -xc $(1) \
-	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
-
-CC_WARNINGS := -Wall -Wstrict-prototypes
-
-CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS)
-
-CC_OPTS += -DVMW_USING_KBUILD
 
 INCLUDE := -I.
 
diff --git a/ubuntu/vmmemctl/Makefile.normal b/ubuntu/vmmemctl/Makefile.normal
index fe528f4..fb1f063 100644
--- a/ubuntu/vmmemctl/Makefile.normal
+++ b/ubuntu/vmmemctl/Makefile.normal
@@ -1,25 +1,25 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 1998 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
+##########################################################
+# Copyright (C) 1998 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
+#
+##########################################################
 
 ####
 ####  VMware vmmemctl Makefile to be distributed externally
 ####
-####
 
 vm_check_build = $(shell if $(CC) $(CC_OPTS) $(INCLUDE) \
 	-Werror -S -o /dev/null -xc $(1) \
@@ -78,17 +78,17 @@ LIBS :=
 
 default: all
 
-all: $(DRIVERNAME)
+all: $(DRIVER).o
 
 $(DRIVERNAME): $(OBJS)
 	$(LD) -r -o $@ $^
 
-$(DRIVER) ../$(DRIVER).o: $(DRIVERNAME)
+$(DRIVER) $(DRIVER).o ../$(DRIVER).o: $(DRIVERNAME)
 	cp -f $< $@
 
 auto-build: ../$(DRIVER).o
 
 clean:
-	rm -f $(DRIVERNAME) ../$(DRIVERNAME) $(DRIVER) $(OBJS)
+	rm -f $(DRIVERNAME) ../$(DRIVERNAME) $(DRIVER) $(DRIVER).o ../$(DRIVER).o $(OBJS)
 
 .SILENT:
diff --git a/ubuntu/vmmemctl/autoconf/epoll.c b/ubuntu/vmmemctl/autoconf/epoll.c
index fc6ac4c..44083c6 100644
--- a/ubuntu/vmmemctl/autoconf/epoll.c
+++ b/ubuntu/vmmemctl/autoconf/epoll.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2004 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * Detect whether we have 'struct poll_wqueues'
diff --git a/ubuntu/vmmemctl/autoconf/geninclude.c b/ubuntu/vmmemctl/autoconf/geninclude.c
index 681bb52..f37a20f 100644
--- a/ubuntu/vmmemctl/autoconf/geninclude.c
+++ b/ubuntu/vmmemctl/autoconf/geninclude.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2003 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -14,7 +13,8 @@
  * 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>
 
diff --git a/ubuntu/vmmemctl/autoconf/setnice.c b/ubuntu/vmmemctl/autoconf/setnice.c
index ebd452a..8d5ebf2 100644
--- a/ubuntu/vmmemctl/autoconf/setnice.c
+++ b/ubuntu/vmmemctl/autoconf/setnice.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * set_user_nice appeared in 2.4.21.  But some distros
diff --git a/ubuntu/vmmemctl/backdoor.h b/ubuntu/vmmemctl/backdoor.h
index ceba29d..3dc6b6c 100644
--- a/ubuntu/vmmemctl/backdoor.h
+++ b/ubuntu/vmmemctl/backdoor.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1999 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1999 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * backdoor.h --
diff --git a/ubuntu/vmmemctl/backdoorGcc32.c b/ubuntu/vmmemctl/backdoorGcc32.c
index 654c564..aa62270 100644
--- a/ubuntu/vmmemctl/backdoorGcc32.c
+++ b/ubuntu/vmmemctl/backdoorGcc32.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2005 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * backdoorGcc32.c --
diff --git a/ubuntu/vmmemctl/backdoorGcc64.c b/ubuntu/vmmemctl/backdoorGcc64.c
index 1557499..555dea3 100644
--- a/ubuntu/vmmemctl/backdoorGcc64.c
+++ b/ubuntu/vmmemctl/backdoorGcc64.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2005 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * backdoorGcc64.c --
diff --git a/ubuntu/vmmemctl/backdoorInt.h b/ubuntu/vmmemctl/backdoorInt.h
index 09e01fc..d85afa7 100644
--- a/ubuntu/vmmemctl/backdoorInt.h
+++ b/ubuntu/vmmemctl/backdoorInt.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * backdoorInt.h --
diff --git a/ubuntu/vmmemctl/backdoor_balloon.h b/ubuntu/vmmemctl/backdoor_balloon.h
index cf12d3d..7d06d08 100644
--- a/ubuntu/vmmemctl/backdoor_balloon.h
+++ b/ubuntu/vmmemctl/backdoor_balloon.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2007 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * backdoor_balloon.h --
diff --git a/ubuntu/vmmemctl/balloon_def.h b/ubuntu/vmmemctl/balloon_def.h
index 342fb0b..b463c2b 100644
--- a/ubuntu/vmmemctl/balloon_def.h
+++ b/ubuntu/vmmemctl/balloon_def.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2000 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2000 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * balloon_def.h -- 
diff --git a/ubuntu/vmmemctl/compat_completion.h b/ubuntu/vmmemctl/compat_completion.h
index 35f081f..e690fff 100644
--- a/ubuntu/vmmemctl/compat_completion.h
+++ b/ubuntu/vmmemctl/compat_completion.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2004 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_COMPLETION_H__
 #   define __COMPAT_COMPLETION_H__
diff --git a/ubuntu/vmmemctl/compat_file.h b/ubuntu/vmmemctl/compat_file.h
index 9d16904..5af3010 100644
--- a/ubuntu/vmmemctl/compat_file.h
+++ b/ubuntu/vmmemctl/compat_file.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_FILE_H__
 #   define __COMPAT_FILE_H__
diff --git a/ubuntu/vmmemctl/compat_kernel.h b/ubuntu/vmmemctl/compat_kernel.h
index d278ae7..76b47cf 100644
--- a/ubuntu/vmmemctl/compat_kernel.h
+++ b/ubuntu/vmmemctl/compat_kernel.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2004 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_KERNEL_H__
 #   define __COMPAT_KERNEL_H__
diff --git a/ubuntu/vmmemctl/compat_list.h b/ubuntu/vmmemctl/compat_list.h
index baaa8ac..333557b 100644
--- a/ubuntu/vmmemctl/compat_list.h
+++ b/ubuntu/vmmemctl/compat_list.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_LIST_H__
 #   define __COMPAT_LIST_H__
@@ -22,6 +22,16 @@
 #include <linux/list.h>
 
 /*
+ * list_add_tail is with us since 2.4.0, or something like that.
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
+#define list_add_tail(newe, head) do {  \
+   struct list_head *__h = (head);      \
+   __list_add((newe), __h->prev, __h);  \
+} while (0)
+#endif
+
+/*
  * list_for_each_safe() showed up in 2.4.10, but it may be backported so we
  * just check for its existence.
  */
diff --git a/ubuntu/vmmemctl/compat_mm.h b/ubuntu/vmmemctl/compat_mm.h
index 9e9605b..9265a82 100644
--- a/ubuntu/vmmemctl/compat_mm.h
+++ b/ubuntu/vmmemctl/compat_mm.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_MM_H__
 #   define __COMPAT_MM_H__
diff --git a/ubuntu/vmmemctl/compat_module.h b/ubuntu/vmmemctl/compat_module.h
index 6576fb6..66fc469 100644
--- a/ubuntu/vmmemctl/compat_module.h
+++ b/ubuntu/vmmemctl/compat_module.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2007 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * compat_module.h --
diff --git a/ubuntu/vmmemctl/compat_page.h b/ubuntu/vmmemctl/compat_page.h
index 3aeab98..0bf0e25 100644
--- a/ubuntu/vmmemctl/compat_page.h
+++ b/ubuntu/vmmemctl/compat_page.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_PAGE_H__
 #   define __COMPAT_PAGE_H__
diff --git a/ubuntu/vmmemctl/compat_sched.h b/ubuntu/vmmemctl/compat_sched.h
index e54e1b6..6fc79dc 100644
--- a/ubuntu/vmmemctl/compat_sched.h
+++ b/ubuntu/vmmemctl/compat_sched.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SCHED_H__
 #   define __COMPAT_SCHED_H__
@@ -42,6 +42,34 @@
 #   define cond_resched() (need_resched() ? schedule() : (void) 0)
 #endif
 
+/* Oh well.  We need yield...  Happy us! */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 20)
+#   ifdef __x86_64__
+#      define compat_yield() there_is_nothing_like_yield()
+#   else
+#      include <linux/unistd.h>
+#      include <linux/kernel.h>
+
+/*
+ * Used by _syscallX macros. Note that this is global variable, so
+ * do not rely on its contents too much. As exit() is only function
+ * we use, and we never check return value from exit(), we have
+ * no problem...
+ */
+extern int errno;
+
+/*
+ * compat_exit() provides an access to the exit() function. It must 
+ * be named compat_exit(), as exit() (with different signature) is 
+ * provided by x86-64, arm and other (but not by i386).
+ */
+#      define __NR_compat_yield __NR_sched_yield
+static inline _syscall0(int, compat_yield);
+#   endif
+#else
+#   define compat_yield() yield()
+#endif
+
 
 /*
  * Since 2.5.34 there are two methods to enumerate tasks:
diff --git a/ubuntu/vmmemctl/compat_semaphore.h b/ubuntu/vmmemctl/compat_semaphore.h
index 23f92f3..8c6df97 100644
--- a/ubuntu/vmmemctl/compat_semaphore.h
+++ b/ubuntu/vmmemctl/compat_semaphore.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SEMAPHORE_H__
 #   define __COMPAT_SEMAPHORE_H__
diff --git a/ubuntu/vmmemctl/compat_spinlock.h b/ubuntu/vmmemctl/compat_spinlock.h
index c069db9..ea867f2 100644
--- a/ubuntu/vmmemctl/compat_spinlock.h
+++ b/ubuntu/vmmemctl/compat_spinlock.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SPINLOCK_H__
 #   define __COMPAT_SPINLOCK_H__
diff --git a/ubuntu/vmmemctl/compat_version.h b/ubuntu/vmmemctl/compat_version.h
index 2f4c546..baf9634 100644
--- a/ubuntu/vmmemctl/compat_version.h
+++ b/ubuntu/vmmemctl/compat_version.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_VERSION_H__
 #   define __COMPAT_VERSION_H__
diff --git a/ubuntu/vmmemctl/compat_wait.h b/ubuntu/vmmemctl/compat_wait.h
index e3aca6c..ebcf087 100644
--- a/ubuntu/vmmemctl/compat_wait.h
+++ b/ubuntu/vmmemctl/compat_wait.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_WAIT_H__
 #   define __COMPAT_WAIT_H__
diff --git a/ubuntu/vmmemctl/driver-config.h b/ubuntu/vmmemctl/driver-config.h
index b9aec7f..3722731 100644
--- a/ubuntu/vmmemctl/driver-config.h
+++ b/ubuntu/vmmemctl/driver-config.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * Sets the proper defines from the Linux header files
diff --git a/ubuntu/vmmemctl/includeCheck.h b/ubuntu/vmmemctl/includeCheck.h
index f694d02..b3d5bb3 100644
--- a/ubuntu/vmmemctl/includeCheck.h
+++ b/ubuntu/vmmemctl/includeCheck.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * includeCheck.h --
diff --git a/ubuntu/vmmemctl/os.c b/ubuntu/vmmemctl/os.c
index 19d5961..b813cb6 100644
--- a/ubuntu/vmmemctl/os.c
+++ b/ubuntu/vmmemctl/os.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2000 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2000 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /* 
  * os.c --
@@ -516,6 +516,16 @@ os_timer_hz(void)
    return HZ;
 }
 
+void CDECL
+os_yield(void)
+{
+#ifdef OS_KTHREAD
+   cond_resched();
+#else
+   /* Do nothing.  Timer callbacks should not sleep. */
+#endif
+}
+
 #ifdef	CONFIG_PROC_FS
 #if	LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 static int os_proc_read(char *buf,
diff --git a/ubuntu/vmmemctl/os.h b/ubuntu/vmmemctl/os.h
index ae4ad4b..8a5f690 100644
--- a/ubuntu/vmmemctl/os.h
+++ b/ubuntu/vmmemctl/os.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2000 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2000 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /* 
  * os.h --
@@ -50,6 +50,7 @@ typedef int  CDECL (*os_status_handler)(char *);
 
 extern void CDECL *os_kmalloc_nosleep(unsigned int size);
 extern void CDECL os_kfree(void *obj, unsigned int size);
+extern void CDECL os_yield(void);
 extern void CDECL os_bzero(void *s, unsigned int n);
 extern void CDECL os_memcpy(void *dest, const void *src, unsigned int size);
 extern int  CDECL os_sprintf(char *str, const char *format, ...);
diff --git a/ubuntu/vmmemctl/vm_assert.h b/ubuntu/vmmemctl/vm_assert.h
index 07b987f..12b67f3 100644
--- a/ubuntu/vmmemctl/vm_assert.h
+++ b/ubuntu/vmmemctl/vm_assert.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 1998-2004 VMware, Inc.  All rights reserved.
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998-2004 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vm_assert.h --
diff --git a/ubuntu/vmmemctl/vm_basic_defs.h b/ubuntu/vmmemctl/vm_basic_defs.h
index e01cb24..8da371b 100644
--- a/ubuntu/vmmemctl/vm_basic_defs.h
+++ b/ubuntu/vmmemctl/vm_basic_defs.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 2003 VMware, Inc.  All rights reserved.
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vm_basic_defs.h --
@@ -152,8 +151,6 @@ Max(int a, int b)
 #ifndef PAGE_SHIFT // {
 #if defined VM_I386
    #define PAGE_SHIFT    12
-#elif defined VM_IA64
-   #define PAGE_SHIFT    14	// On IA-64, the default page size is 16K
 #elif defined __APPLE__
    #define PAGE_SHIFT    12
 #else
@@ -382,6 +379,31 @@ typedef int pid_t;
 
 #endif // }
 
+#ifndef va_copy
+#ifdef _WIN32
+
+/*
+ * Windows needs va_copy. This works for both 32 and 64-bit Windows
+ * based on inspection of how varags.h from the Visual C CRTL is
+ * implemented. (Future versions of the RTL may break this).
+ */
+
+#define va_copy(dest, src) ((dest) = (src))
+
+#endif // _WIN32
+
+#if defined(__APPLE__) && defined(KERNEL)
+
+/*
+ * MacOS kernel-mode needs va_copy. Based on inspection of stdarg.h
+ * from the MacOSX10.4u.sdk kernel framework, this should work.
+ * (Future versions of the SDK may break this).
+ */
+
+#define va_copy(dest, src) ((dest) = (src))
+
+#endif // __APPLE__ && KERNEL
+#endif // va_copy
 
 /*
  * This one is outside USERLEVEL because it's used by
diff --git a/ubuntu/vmmemctl/vm_basic_types.h b/ubuntu/vmmemctl/vm_basic_types.h
index 5fc0231..bdefa6f 100644
--- a/ubuntu/vmmemctl/vm_basic_types.h
+++ b/ubuntu/vmmemctl/vm_basic_types.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (c) 1998-2007 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998-2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  *
@@ -63,10 +63,6 @@ typedef char           Bool;
 #define VM_I386
 #endif
 
-#ifdef __ia64__
-#define VM_IA64
-#endif
-
 #ifdef _WIN64
 #define __x86_64__
 #endif
@@ -86,10 +82,6 @@ typedef char           Bool;
 #define VM_I386
 #endif
 
-#if defined VM_I386 && defined VM_IA64
-#error "Only one CPU platform is allowed."
-#endif
-
 #ifdef _MSC_VER
 typedef unsigned __int64 uint64;
 typedef signed __int64 int64;
@@ -109,7 +101,7 @@ typedef signed __int64 int64;
 #elif __GNUC__
 /* The Xserver source compiles with -ansi -pendantic */
 #ifndef __STRICT_ANSI__
-#if defined(VM_IA64) || defined(VM_X86_64)
+#if defined(VM_X86_64)
 typedef unsigned long uint64;
 typedef long int64;
 #else
@@ -140,54 +132,71 @@ typedef char      int8;
  * This applies to Solaris as well.
  */
 
-#if defined(__FreeBSD__) || defined(sun)
-#   ifdef KLD_MODULE
-#      include <sys/types.h>
-#   else
-#      if (BSD_VERSION >= 50) || defined(HAVE_INTTYPES_H)
-#         include <inttypes.h>
+/*
+ * Before trying to do the includes based on OS defines, see if we can use
+ * feature-based defines to get as much functionality as possible
+ */
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_INTTYPES_H
+#include <sys/inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if !defined(USING_AUTOCONF)
+#   if defined(__FreeBSD__) || defined(sun)
+#      ifdef KLD_MODULE
 #         include <sys/types.h>
 #      else
-#         include <sys/inttypes.h>
-#      endif
-#   endif
-#elif defined __APPLE__
-#   if KERNEL
-#       include <sys/types.h> /* mostly for size_t */
-#       include <stdint.h>
-#   else
-#       include <inttypes.h>
-#       include <stdlib.h>
-#       include <stdint.h>
-#   endif
-#else
-#   if !defined(__intptr_t_defined) && !defined(intptr_t)
-#      define __intptr_t_defined
-#      define intptr_t  intptr_t
-#      ifdef VM_I386
-#         ifdef VM_X86_64
-             typedef int64     intptr_t;
+#         if (BSD_VERSION >= 50)
+#            include <inttypes.h>
+#            include <sys/types.h>
 #         else
-             typedef int32     intptr_t;
+#            include <sys/inttypes.h>
 #         endif
 #      endif
-
-#      ifdef VM_IA64
-          typedef int64     intptr_t;
+#   elif defined __APPLE__
+#      if KERNEL
+#         include <sys/unistd.h>
+#         include <sys/types.h> /* mostly for size_t */
+#         include <stdint.h>
+#      else
+#         include <unistd.h>
+#         include <inttypes.h>
+#         include <stdlib.h>
+#         include <stdint.h>
 #      endif
-#   endif
-
-#   ifndef _STDINT_H
-#      ifdef VM_I386
-#         ifdef VM_X86_64
-             typedef uint64    uintptr_t;
-#         else
-             typedef uint32    uintptr_t;
+#   else
+#      if !defined(__intptr_t_defined) && !defined(intptr_t)
+#         define __intptr_t_defined
+#         define intptr_t  intptr_t
+#         ifdef VM_I386
+#            ifdef VM_X86_64
+typedef int64     intptr_t;
+#            else
+typedef int32     intptr_t;
+#            endif
 #         endif
 #      endif
 
-#      ifdef VM_IA64
-          typedef uint64    uintptr_t;
+#      ifndef _STDINT_H
+#         ifdef VM_I386
+#            ifdef VM_X86_64
+typedef uint64    uintptr_t;
+#            else
+typedef uint32    uintptr_t;
+#            endif
+#         endif
 #      endif
 #   endif
 #endif
@@ -233,10 +242,20 @@ typedef int64 VmTimeVirtualClock;  /* Virtual Clock kept in CPU cycles */
          #define FMTSZ  ""
          #define FMTPD  ""
       #endif
-   #else
+   #elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) \
+      || (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \
+      || (defined(_POSIX2_VERSION) && _POSIX2_VERSION >= 200112L)
       /* BSD/Darwin, Linux */
       #define FMTSZ     "z"
       #define FMTPD     "t"
+   #else
+      /* Systems with a pre-C99 libc */
+      #define FMTSZ     "Z"
+      #ifdef VM_X86_64
+         #define FMTPD  "l"
+      #else
+         #define FMTPD  ""
+      #endif
    #endif
    #ifdef VM_X86_64
       #define FMT64     "l"
@@ -618,6 +637,16 @@ typedef void * UserVA;
 #define ALIGNED(n)
 #endif
 
+/*
+ * __func__ is a stringified function name that is part of the C99 standard. The block
+ * below defines __func__ on older systems where the compiler does not support that
+ * macro.
+ */
+#if defined(__GNUC__) \
+   && ((__GNUC__ == 2 && __GNUC_MINOR < 96) \
+       || (__GNUC__ < 2))
+#   define __func__ __FUNCTION__
+#endif
 
 /*
  * Once upon a time, this was used to silence compiler warnings that
@@ -642,9 +671,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef uint64 size_t;
-#      endif
 #   endif
 #else
 #   ifndef _SIZE_T
@@ -657,9 +683,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef uint64 size_t;
-#      endif
 #   endif
 #   if !defined(FROBOS) && !defined(_SSIZE_T) && !defined(ssize_t)  && !defined(__ssize_t_defined) && !defined(_SSIZE_T_DECLARED)
 #      define _SSIZE_T
@@ -673,9 +696,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef int64 ssize_t;
-#      endif
 #   endif
 #endif
 
@@ -724,4 +744,17 @@ typedef void * UserVA;
 # define FMTMODE "o"
 #endif
 
+/*
+ * Format modifier for printing time_t. Most platforms define a time_t to be
+ * a long int, but on FreeBSD (as of 5.0, it seems), the time_t is a signed
+ * size quantity. Refer to the definition of FMTSZ to see why we need silly
+ * preprocessor arithmetic.
+ * Use this like this: printf("The mode is %"FMTTIME".\n", time);
+ */
+#if defined(__FreeBSD__) && (__FreeBSD__ + 0) && ((__FreeBSD__ + 0) >= 5)
+#   define FMTTIME FMTSZ"d"
+#else
+#   define FMTTIME "ld"
+#endif
+
 #endif  /* _VM_BASIC_TYPES_H_ */
diff --git a/ubuntu/vmmemctl/vmballoon.c b/ubuntu/vmmemctl/vmballoon.c
index e7a8f92..ad1a59a 100644
--- a/ubuntu/vmmemctl/vmballoon.c
+++ b/ubuntu/vmmemctl/vmballoon.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2000 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2000 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /* 
  * vmballoon.c --
@@ -569,9 +569,15 @@ Balloon_Init(Balloon *b)
 static void
 Balloon_Deallocate(Balloon *b)
 {
+   unsigned int cnt = 0;
+
    /* free all pages, skipping monitor unlock */
    while (b->nChunks > 0) {
       (void) Balloon_FreePage(b, FALSE);
+      if (++cnt >= b->rateFree) {
+         cnt = 0;
+         os_yield();
+      }
    }
 }
 
diff --git a/ubuntu/vmmemctl/vmballoon.h b/ubuntu/vmmemctl/vmballoon.h
index 93c513e..a31c4b3 100644
--- a/ubuntu/vmmemctl/vmballoon.h
+++ b/ubuntu/vmmemctl/vmballoon.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2000 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2000 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /* 
  * vmballoon.h: Definitions and macros for vmballoon driver.
diff --git a/ubuntu/vmmemctl/vmmemctl_version.h b/ubuntu/vmmemctl/vmmemctl_version.h
index b8ec95f..67c2a54 100644
--- a/ubuntu/vmmemctl/vmmemctl_version.h
+++ b/ubuntu/vmmemctl/vmmemctl_version.h
@@ -1,6 +1,5 @@
-/* ************************************************************************
- * Copyright 2007 VMware, Inc.  All rights reserved. 
- * ************************************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vmmemctl_version.h --
diff --git a/ubuntu/vmxnet/Makefile b/ubuntu/vmxnet/Makefile
index 733f396..b32bdd5 100644
--- a/ubuntu/vmxnet/Makefile
+++ b/ubuntu/vmxnet/Makefile
@@ -1,20 +1,21 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 1998 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
+##########################################################
+# Copyright (C) 1998 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
+#
+##########################################################
 
 ####
 ####  VMware kernel module Makefile to be distributed externally
@@ -107,6 +108,22 @@ endif
 
 endif
 
+vm_check_build = $(shell if $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \
+	$(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
+	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default \
+	-DKBUILD_BASENAME=\"$(DRIVER)\" \
+	-Werror -S -o /dev/null -xc $(1) \
+	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
+
+CC_WARNINGS := -Wall -Wstrict-prototypes
+CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS) -DVMW_USING_KBUILD
+ifdef VMX86_DEVEL
+CC_OPTS += -DVMX86_DEVEL
+endif
+ifdef VMX86_DEBUG
+CC_OPTS += -DVMX86_DEBUG
+endif
+
 include $(SRCROOT)/Makefile.kernel
 
 ifdef TOPDIR
diff --git a/ubuntu/vmxnet/Makefile.kernel b/ubuntu/vmxnet/Makefile.kernel
index 0748db5..3ffb458 100644
--- a/ubuntu/vmxnet/Makefile.kernel
+++ b/ubuntu/vmxnet/Makefile.kernel
@@ -1,36 +1,25 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 1998 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
+##########################################################
+# Copyright (C) 1998 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
+#
+##########################################################
 
 ####
 ####  VMware vmxnet Makefile to be distributed externally
 ####
-####
-
-vm_check_build = $(shell if $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_KERNEL) \
-	$(EXTRA_CFLAGS) -Iinclude2/asm/mach-default -DKBUILD_BASENAME=\"$(DRIVER)\" \
-	-Werror -S -o /dev/null -xc $(1) \
-	> /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
-
-CC_WARNINGS := -Wall -Wstrict-prototypes
-
-CC_OPTS := $(GLOBAL_DEFS) $(CC_WARNINGS)
-
-CC_OPTS += -DVMW_USING_KBUILD
 
 INCLUDE := -I.
 
diff --git a/ubuntu/vmxnet/Makefile.normal b/ubuntu/vmxnet/Makefile.normal
index acda5eb..c1c5fdd 100644
--- a/ubuntu/vmxnet/Makefile.normal
+++ b/ubuntu/vmxnet/Makefile.normal
@@ -1,25 +1,25 @@
 #!/usr/bin/make -f
-#############################################################
-# Copyright 1998 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
+##########################################################
+# Copyright (C) 1998 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
+#
+##########################################################
 
 ####
 ####  VMware vmxnet Makefile to be distributed externally
 ####
-####
 
 vm_check_build = $(shell if $(CC) $(CC_OPTS) $(INCLUDE) -Werror -S -o /dev/null -xc $(1) \
         > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)
diff --git a/ubuntu/vmxnet/autoconf/geninclude.c b/ubuntu/vmxnet/autoconf/geninclude.c
index 681bb52..f37a20f 100644
--- a/ubuntu/vmxnet/autoconf/geninclude.c
+++ b/ubuntu/vmxnet/autoconf/geninclude.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2003 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -14,7 +13,8 @@
  * 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>
 
diff --git a/ubuntu/vmxnet/autoconf/skblin.c b/ubuntu/vmxnet/autoconf/skblin.c
index 7bb3961..abdcd47 100644
--- a/ubuntu/vmxnet/autoconf/skblin.c
+++ b/ubuntu/vmxnet/autoconf/skblin.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2006 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2006 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * Detect whether skb_linearize takes one or two arguments.
diff --git a/ubuntu/vmxnet/bpf_meta.h b/ubuntu/vmxnet/bpf_meta.h
new file mode 100644
index 0000000..77d71cc
--- /dev/null
+++ b/ubuntu/vmxnet/bpf_meta.h
@@ -0,0 +1,59 @@
+/*********************************************************
+ * Copyright (C) 2007 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
+ *
+ *********************************************************/
+
+#ifndef _BPF_META_H_ 
+#define _BPF_META_H_
+
+/* This file is to be shared between vmxnet and afpacket */
+
+/* The Control byte flags of bpf_meta_data */
+
+#define VMXNET_BPF_PROCESSED    0x01
+
+/* The following is the definition for dev feature bpf in linux */
+
+#ifndef NETIF_F_BPF             
+#define NETIF_F_BPF             (1<<31) /* BPF Capable Virtual Nic */
+#endif /* NETIF_F_BPF */
+
+
+/* TODO: These three definitions are picked up from vmkernel/public/net_pkt.h.
+ * Reorg the code and take this from a common place 
+ */
+
+#define MAX_BPF_FILTERS 8       /* Maximum number of Filters supported */
+typedef unsigned int BpfSnapLen;
+typedef unsigned int BpfSnapLens[MAX_BPF_FILTERS];
+
+/*
+ * skb->cb[40] maps to this structure. The bpf Trailer in vmxnet is stashed to
+ * this structure in skb.
+ *
+ */
+
+struct BPF_MetaData {
+
+    BpfSnapLens bpfSnapLens; /* 4 * 8 = 32 bytes of SnapLens as recved from VMK*/
+
+    unsigned char unused[7]; /* 7  bytes unused */
+
+    unsigned char controlByte; /* 1  used as controlbyte. For now indicates
+                                  whether VMK processed BPF or not*/ 
+};
+
+#endif
diff --git a/ubuntu/vmxnet/compat_ethtool.h b/ubuntu/vmxnet/compat_ethtool.h
index 76694bb..726ccb7 100644
--- a/ubuntu/vmxnet/compat_ethtool.h
+++ b/ubuntu/vmxnet/compat_ethtool.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2007 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef _COMPAT_ETHTOOL_H
 #define _COMPAT_ETHTOOL_H
diff --git a/ubuntu/vmxnet/compat_highmem.h b/ubuntu/vmxnet/compat_highmem.h
new file mode 100644
index 0000000..3458087
--- /dev/null
+++ b/ubuntu/vmxnet/compat_highmem.h
@@ -0,0 +1,40 @@
+/*********************************************************
+ * Copyright (C) 2002 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
+ *
+ *********************************************************/
+
+#ifndef __COMPAT_HIGHMEM_H__
+#   define __COMPAT_HIGHMEM_H__
+
+
+/*
+ *  BIGMEM  (4 GB)         support appeared in 2.3.16: kmap() API added
+ *  HIGHMEM (4 GB + 64 GB) support appeared in 2.3.23: kmap() API modified
+ *  In 2.3.27, kmap() API modified again
+ *
+ *   --hpreg
+ */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 27)
+#   include <linux/highmem.h>
+#else
+/* For page_address --hpreg */
+#   include <linux/pagemap.h>
+
+#   define kmap(_page) (void*)page_address(_page)
+#   define kunmap(_page)
+#endif
+
+#endif /* __COMPAT_HIGHMEM_H__ */
diff --git a/ubuntu/vmxnet/compat_init.h b/ubuntu/vmxnet/compat_init.h
index 0115d9e..48d7075 100644
--- a/ubuntu/vmxnet/compat_init.h
+++ b/ubuntu/vmxnet/compat_init.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1999 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1999 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * compat_init.h: Initialization compatibility wrappers.
diff --git a/ubuntu/vmxnet/compat_interrupt.h b/ubuntu/vmxnet/compat_interrupt.h
index 06a4533..e3f9a85 100644
--- a/ubuntu/vmxnet/compat_interrupt.h
+++ b/ubuntu/vmxnet/compat_interrupt.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2003 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_INTERRUPT_H__
 #   define __COMPAT_INTERRUPT_H__
diff --git a/ubuntu/vmxnet/compat_ioport.h b/ubuntu/vmxnet/compat_ioport.h
index f7eeae7..43b55b7 100644
--- a/ubuntu/vmxnet/compat_ioport.h
+++ b/ubuntu/vmxnet/compat_ioport.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2003 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2003 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_IOPORT_H__
 #   define __COMPAT_IOPORT_H__
diff --git a/ubuntu/vmxnet/compat_module.h b/ubuntu/vmxnet/compat_module.h
index 6576fb6..66fc469 100644
--- a/ubuntu/vmxnet/compat_module.h
+++ b/ubuntu/vmxnet/compat_module.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2007 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * compat_module.h --
diff --git a/ubuntu/vmxnet/compat_netdevice.h b/ubuntu/vmxnet/compat_netdevice.h
index 8fc6203..f788c9e 100644
--- a/ubuntu/vmxnet/compat_netdevice.h
+++ b/ubuntu/vmxnet/compat_netdevice.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2002 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2002 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_NETDEVICE_H__
 #   define __COMPAT_NETDEVICE_H__
@@ -49,7 +49,8 @@
 /*
  * SET_MODULE_OWNER appeared sometime during 2.3.x. It was setting
  * dev->owner = THIS_MODULE until 2.5.70, where netdevice refcounting
- * was completely changed.
+ * was completely changed.  SET_MODULE_OWNER was nop for whole
+ * 2.6.x series, and finally disappeared in 2.6.24.
  *
  * MOD_xxx_USE_COUNT wrappers are here, as they must be mutually
  * exclusive with SET_MODULE_OWNER call.
@@ -59,11 +60,24 @@
 #   define COMPAT_NETDEV_MOD_INC_USE_COUNT MOD_INC_USE_COUNT
 #   define COMPAT_NETDEV_MOD_DEC_USE_COUNT MOD_DEC_USE_COUNT
 #else
-#   define COMPAT_SET_MODULE_OWNER(dev) SET_MODULE_OWNER(dev)
+#   if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+#      define COMPAT_SET_MODULE_OWNER(dev) SET_MODULE_OWNER(dev)
+#   else
+#      define COMPAT_SET_MODULE_OWNER(dev) do {} while (0)
+#   endif
 #   define COMPAT_NETDEV_MOD_INC_USE_COUNT do {} while (0)
 #   define COMPAT_NETDEV_MOD_DEC_USE_COUNT do {} while (0)
 #endif
 
+/*
+ * SET_NETDEV_DEV appeared sometime during 2.5.x, and later was
+ * crossported to various 2.4.x kernels (as dummy macro).
+ */
+#ifdef SET_NETDEV_DEV
+#   define COMPAT_SET_NETDEV_DEV(dev, pdev) SET_NETDEV_DEV(dev, pdev)
+#else
+#   define COMPAT_SET_NETDEV_DEV(dev, pdev) do {} while (0)
+#endif
 
 /*
  * Build alloc_etherdev API on the top of init_etherdev.  For 2.0.x kernels
@@ -118,11 +132,41 @@ compat_alloc_etherdev(int priv_size)
 #endif
 
 
-/* free_netdev() is available since 2.4.23.  Use kfree() on older kernels. */
+/*
+ * alloc_netdev and free_netdev are there since 2.4.23.  Their use is mandatory
+ * since 2.6.24.
+ */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 23)
-#define compat_free_netdev(dev)     kfree(dev)
+static inline struct net_device *
+compat_alloc_netdev(int priv_size,
+                    const char *mask,
+                    void (*setup)(struct net_device *))
+{
+   struct net_device *dev;
+   int netdev_size = sizeof *dev;
+   int alloc_size;
+
+#   if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
+   netdev_size += IFNAMSIZ;
+#   endif
+
+   alloc_size = netdev_size + priv_size;
+   dev = kmalloc(alloc_size, GFP_KERNEL);
+   if (dev) {
+      memset(dev, 0, alloc_size);
+      dev->priv = (char*)dev + netdev_size;
+      setup(dev);
+#   if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
+      dev->name = (char*)(dev + 1);
+#   endif
+      strcpy(dev->name, mask);   
+   }
+   return dev;
+}
+#   define compat_free_netdev(dev)     kfree(dev)
 #else
-#define compat_free_netdev(dev)     free_netdev(dev)
+#   define compat_alloc_netdev(size, mask, setup) alloc_netdev(size, mask, setup)
+#   define compat_free_netdev(dev)                free_netdev(dev)
 #endif
 
 
diff --git a/ubuntu/vmxnet/compat_pci.h b/ubuntu/vmxnet/compat_pci.h
index adcb35d..e726c05 100644
--- a/ubuntu/vmxnet/compat_pci.h
+++ b/ubuntu/vmxnet/compat_pci.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1999 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1999 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * compat_pci.h: PCI compatibility wrappers.
diff --git a/ubuntu/vmxnet/compat_skbuff.h b/ubuntu/vmxnet/compat_skbuff.h
index 32c5d05..5c243c4 100644
--- a/ubuntu/vmxnet/compat_skbuff.h
+++ b/ubuntu/vmxnet/compat_skbuff.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2007 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SKBUFF_H__
 #   define __COMPAT_SKBUFF_H__
diff --git a/ubuntu/vmxnet/compat_slab.h b/ubuntu/vmxnet/compat_slab.h
index c0d504b..8654a9a 100644
--- a/ubuntu/vmxnet/compat_slab.h
+++ b/ubuntu/vmxnet/compat_slab.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SLAB_H__
 #   define __COMPAT_SLAB_H__
@@ -40,7 +40,10 @@
 #endif
 
 /*
- * Destructor is gone since 2.6.23-pre1.
+ * Up to 2.6.22 kmem_cache_create has 6 arguments - name, size, alignment, flags,
+ * constructor, and destructor.  Then for some time kernel was asserting that
+ * destructor is NULL, and since 2.6.23-pre1 kmem_cache_create takes only 5
+ * arguments - destructor is gone.
  */
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)
 #define compat_kmem_cache_create(name, size, align, flags, ctor) \
@@ -50,4 +53,18 @@
 		kmem_cache_create(name, size, align, flags, ctor)
 #endif
 
+/*
+ * 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...
+ */
+#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
+typedef void compat_kmem_cache_ctor(void *, compat_kmem_cache *, unsigned long);
+#else
+typedef void compat_kmem_cache_ctor(compat_kmem_cache *, void *);
+#endif
+
 #endif /* __COMPAT_SLAB_H__ */
diff --git a/ubuntu/vmxnet/compat_spinlock.h b/ubuntu/vmxnet/compat_spinlock.h
index c069db9..ea867f2 100644
--- a/ubuntu/vmxnet/compat_spinlock.h
+++ b/ubuntu/vmxnet/compat_spinlock.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (C) 2005 VMware, Inc.  All Rights Reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2005 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_SPINLOCK_H__
 #   define __COMPAT_SPINLOCK_H__
diff --git a/ubuntu/vmxnet/compat_timer.h b/ubuntu/vmxnet/compat_timer.h
new file mode 100644
index 0000000..ebbb172
--- /dev/null
+++ b/ubuntu/vmxnet/compat_timer.h
@@ -0,0 +1,95 @@
+/*********************************************************
+ * Copyright (C) 2002 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
+ *
+ *********************************************************/
+
+#ifndef __COMPAT_TIMER_H__
+#   define __COMPAT_TIMER_H__
+
+
+/*
+ * The del_timer_sync() API appeared in 2.3.43
+ * It became reliable in 2.4.0-test3
+ *
+ *   --hpreg
+ */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0)
+#   define compat_del_timer_sync(timer) del_timer_sync(timer)
+#else
+#   if LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 43)
+       /* 2.3.43 removed asm/softirq.h's reference to bh_base. */
+#      include <linux/interrupt.h>
+#   endif
+#   include <asm/softirq.h>
+
+static inline int
+compat_del_timer_sync(struct timer_list *timer) // IN
+{
+   int wasPending;
+
+   start_bh_atomic();
+   wasPending = del_timer(timer);
+   end_bh_atomic();
+
+   return wasPending;
+}
+#endif
+
+
+/*
+ * The msleep_interruptible() API appeared in 2.6.9.
+ * It is based on the msleep() API, which appeared in 2.4.29.
+ */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
+#   include <linux/delay.h>
+#   define compat_msleep_interruptible(msecs) msleep_interruptible(msecs)
+#else
+#   include <linux/sched.h>
+/* 
+ * msecs_to_jiffies appeared in 2.6.7.  For earlier kernels,
+ * fall back to slow-case code (we don't use this operation
+ * enough to need the performance).
+ */
+#   if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 7)
+#      define msecs_to_jiffies(msecs) (((msecs) * HZ + 999) / 1000)
+#   endif
+/*
+ * set_current_state appeared in 2.2.18.
+ */
+#   if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18)
+#      define set_current_state(a) do { current->state = (a); } while(0)
+#   endif
+
+static inline void
+compat_msleep_interruptible(unsigned long msecs) // IN
+{
+   set_current_state(TASK_INTERRUPTIBLE);
+   schedule_timeout(msecs_to_jiffies(msecs) + 1);
+}
+#endif
+
+
+/*
+ * There is init_timer_deferrable() since 2.6.22.
+ */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
+#   define compat_init_timer_deferrable(timer) init_timer_deferrable(timer)
+#else
+#   define compat_init_timer_deferrable(timer) init_timer(timer)
+#endif
+
+
+#endif /* __COMPAT_TIMER_H__ */
diff --git a/ubuntu/vmxnet/compat_version.h b/ubuntu/vmxnet/compat_version.h
index 2f4c546..baf9634 100644
--- a/ubuntu/vmxnet/compat_version.h
+++ b/ubuntu/vmxnet/compat_version.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __COMPAT_VERSION_H__
 #   define __COMPAT_VERSION_H__
diff --git a/ubuntu/vmxnet/driver-config.h b/ubuntu/vmxnet/driver-config.h
index b9aec7f..3722731 100644
--- a/ubuntu/vmxnet/driver-config.h
+++ b/ubuntu/vmxnet/driver-config.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * Sets the proper defines from the Linux header files
diff --git a/ubuntu/vmxnet/includeCheck.h b/ubuntu/vmxnet/includeCheck.h
index f694d02..b3d5bb3 100644
--- a/ubuntu/vmxnet/includeCheck.h
+++ b/ubuntu/vmxnet/includeCheck.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * includeCheck.h --
diff --git a/ubuntu/vmxnet/net.h b/ubuntu/vmxnet/net.h
index 9f9b7e3..018173b 100644
--- a/ubuntu/vmxnet/net.h
+++ b/ubuntu/vmxnet/net.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /************************************************************
  *
diff --git a/ubuntu/vmxnet/net_dist.h b/ubuntu/vmxnet/net_dist.h
index 71b4c61..68d6ff3 100644
--- a/ubuntu/vmxnet/net_dist.h
+++ b/ubuntu/vmxnet/net_dist.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 2004 VMware, Inc.  All rights reserved. 
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * net_dist.h --
@@ -56,9 +55,10 @@ typedef struct PktList PktList;
  * (e.g. sizeof(esskaybee_or_whatever))
  */
 #ifdef VM_X86_64
+
 #define NET_MAX_IMPL_PKT_OVHD   (616)
 #else
-#define NET_MAX_IMPL_PKT_OVHD   (432)
+#define NET_MAX_IMPL_PKT_OVHD   (436)
 #endif
 
 /*
diff --git a/ubuntu/vmxnet/net_sg.h b/ubuntu/vmxnet/net_sg.h
index e844fcf..daf8a14 100644
--- a/ubuntu/vmxnet/net_sg.h
+++ b/ubuntu/vmxnet/net_sg.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2000 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2000 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * net_sg.h --
diff --git a/ubuntu/vmxnet/return_status.h b/ubuntu/vmxnet/return_status.h
index dcabcbd..55fbd4e 100644
--- a/ubuntu/vmxnet/return_status.h
+++ b/ubuntu/vmxnet/return_status.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * return_status.h --
diff --git a/ubuntu/vmxnet/vm_basic_types.h b/ubuntu/vmxnet/vm_basic_types.h
index 5fc0231..bdefa6f 100644
--- a/ubuntu/vmxnet/vm_basic_types.h
+++ b/ubuntu/vmxnet/vm_basic_types.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright (c) 1998-2007 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998-2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  *
@@ -63,10 +63,6 @@ typedef char           Bool;
 #define VM_I386
 #endif
 
-#ifdef __ia64__
-#define VM_IA64
-#endif
-
 #ifdef _WIN64
 #define __x86_64__
 #endif
@@ -86,10 +82,6 @@ typedef char           Bool;
 #define VM_I386
 #endif
 
-#if defined VM_I386 && defined VM_IA64
-#error "Only one CPU platform is allowed."
-#endif
-
 #ifdef _MSC_VER
 typedef unsigned __int64 uint64;
 typedef signed __int64 int64;
@@ -109,7 +101,7 @@ typedef signed __int64 int64;
 #elif __GNUC__
 /* The Xserver source compiles with -ansi -pendantic */
 #ifndef __STRICT_ANSI__
-#if defined(VM_IA64) || defined(VM_X86_64)
+#if defined(VM_X86_64)
 typedef unsigned long uint64;
 typedef long int64;
 #else
@@ -140,54 +132,71 @@ typedef char      int8;
  * This applies to Solaris as well.
  */
 
-#if defined(__FreeBSD__) || defined(sun)
-#   ifdef KLD_MODULE
-#      include <sys/types.h>
-#   else
-#      if (BSD_VERSION >= 50) || defined(HAVE_INTTYPES_H)
-#         include <inttypes.h>
+/*
+ * Before trying to do the includes based on OS defines, see if we can use
+ * feature-based defines to get as much functionality as possible
+ */
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_INTTYPES_H
+#include <sys/inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if !defined(USING_AUTOCONF)
+#   if defined(__FreeBSD__) || defined(sun)
+#      ifdef KLD_MODULE
 #         include <sys/types.h>
 #      else
-#         include <sys/inttypes.h>
-#      endif
-#   endif
-#elif defined __APPLE__
-#   if KERNEL
-#       include <sys/types.h> /* mostly for size_t */
-#       include <stdint.h>
-#   else
-#       include <inttypes.h>
-#       include <stdlib.h>
-#       include <stdint.h>
-#   endif
-#else
-#   if !defined(__intptr_t_defined) && !defined(intptr_t)
-#      define __intptr_t_defined
-#      define intptr_t  intptr_t
-#      ifdef VM_I386
-#         ifdef VM_X86_64
-             typedef int64     intptr_t;
+#         if (BSD_VERSION >= 50)
+#            include <inttypes.h>
+#            include <sys/types.h>
 #         else
-             typedef int32     intptr_t;
+#            include <sys/inttypes.h>
 #         endif
 #      endif
-
-#      ifdef VM_IA64
-          typedef int64     intptr_t;
+#   elif defined __APPLE__
+#      if KERNEL
+#         include <sys/unistd.h>
+#         include <sys/types.h> /* mostly for size_t */
+#         include <stdint.h>
+#      else
+#         include <unistd.h>
+#         include <inttypes.h>
+#         include <stdlib.h>
+#         include <stdint.h>
 #      endif
-#   endif
-
-#   ifndef _STDINT_H
-#      ifdef VM_I386
-#         ifdef VM_X86_64
-             typedef uint64    uintptr_t;
-#         else
-             typedef uint32    uintptr_t;
+#   else
+#      if !defined(__intptr_t_defined) && !defined(intptr_t)
+#         define __intptr_t_defined
+#         define intptr_t  intptr_t
+#         ifdef VM_I386
+#            ifdef VM_X86_64
+typedef int64     intptr_t;
+#            else
+typedef int32     intptr_t;
+#            endif
 #         endif
 #      endif
 
-#      ifdef VM_IA64
-          typedef uint64    uintptr_t;
+#      ifndef _STDINT_H
+#         ifdef VM_I386
+#            ifdef VM_X86_64
+typedef uint64    uintptr_t;
+#            else
+typedef uint32    uintptr_t;
+#            endif
+#         endif
 #      endif
 #   endif
 #endif
@@ -233,10 +242,20 @@ typedef int64 VmTimeVirtualClock;  /* Virtual Clock kept in CPU cycles */
          #define FMTSZ  ""
          #define FMTPD  ""
       #endif
-   #else
+   #elif (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) \
+      || (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \
+      || (defined(_POSIX2_VERSION) && _POSIX2_VERSION >= 200112L)
       /* BSD/Darwin, Linux */
       #define FMTSZ     "z"
       #define FMTPD     "t"
+   #else
+      /* Systems with a pre-C99 libc */
+      #define FMTSZ     "Z"
+      #ifdef VM_X86_64
+         #define FMTPD  "l"
+      #else
+         #define FMTPD  ""
+      #endif
    #endif
    #ifdef VM_X86_64
       #define FMT64     "l"
@@ -618,6 +637,16 @@ typedef void * UserVA;
 #define ALIGNED(n)
 #endif
 
+/*
+ * __func__ is a stringified function name that is part of the C99 standard. The block
+ * below defines __func__ on older systems where the compiler does not support that
+ * macro.
+ */
+#if defined(__GNUC__) \
+   && ((__GNUC__ == 2 && __GNUC_MINOR < 96) \
+       || (__GNUC__ < 2))
+#   define __func__ __FUNCTION__
+#endif
 
 /*
  * Once upon a time, this was used to silence compiler warnings that
@@ -642,9 +671,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef uint64 size_t;
-#      endif
 #   endif
 #else
 #   ifndef _SIZE_T
@@ -657,9 +683,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef uint64 size_t;
-#      endif
 #   endif
 #   if !defined(FROBOS) && !defined(_SSIZE_T) && !defined(ssize_t)  && !defined(__ssize_t_defined) && !defined(_SSIZE_T_DECLARED)
 #      define _SSIZE_T
@@ -673,9 +696,6 @@ typedef void * UserVA;
 #         endif
 #      endif /* VM_I386 */
 
-#      ifdef VM_IA64
-             typedef int64 ssize_t;
-#      endif
 #   endif
 #endif
 
@@ -724,4 +744,17 @@ typedef void * UserVA;
 # define FMTMODE "o"
 #endif
 
+/*
+ * Format modifier for printing time_t. Most platforms define a time_t to be
+ * a long int, but on FreeBSD (as of 5.0, it seems), the time_t is a signed
+ * size quantity. Refer to the definition of FMTSZ to see why we need silly
+ * preprocessor arithmetic.
+ * Use this like this: printf("The mode is %"FMTTIME".\n", time);
+ */
+#if defined(__FreeBSD__) && (__FreeBSD__ + 0) && ((__FreeBSD__ + 0) >= 5)
+#   define FMTTIME FMTSZ"d"
+#else
+#   define FMTTIME "ld"
+#endif
+
 #endif  /* _VM_BASIC_TYPES_H_ */
diff --git a/ubuntu/vmxnet/vm_device_version.h b/ubuntu/vmxnet/vm_device_version.h
index a5f77c8..09235f3 100644
--- a/ubuntu/vmxnet/vm_device_version.h
+++ b/ubuntu/vmxnet/vm_device_version.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef VM_DEVICE_VERSION_H
 #define VM_DEVICE_VERSION_H
@@ -37,6 +37,7 @@
  *    VMware vmxscsi (Abortive idealized SCSI controller)
  *    VMware chipset (Subsystem ID for our motherboards)
  *    VMware e1000 (Subsystem ID)
+ *    VMware vmxnet3 (Uniform Pass Through NIC)
  */
 #define PCI_VENDOR_ID_VMWARE            0x15AD
 #define PCI_DEVICE_ID_VMWARE_SVGA2      0x0405
@@ -51,6 +52,7 @@
 #define PCI_DEVICE_ID_VMWARE_1394       0x0780
 #define PCI_DEVICE_ID_VMWARE_BRIDGE     0x0790
 #define PCI_DEVICE_ID_VMWARE_ROOTPORT   0x07A0
+#define PCI_DEVICE_ID_VMWARE_VMXNET3    0x07B0
 
 /* The hypervisor device might grow.  Please leave room
  * for 7 more subfunctions.
diff --git a/ubuntu/vmxnet/vmkapi_status.h b/ubuntu/vmxnet/vmkapi_status.h
index c68102b..a443e68 100644
--- a/ubuntu/vmxnet/vmkapi_status.h
+++ b/ubuntu/vmxnet/vmkapi_status.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 2004 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * @VMKAPIMOD_LICENSE@
@@ -288,6 +288,17 @@
    DEFINE_VMK_ERR(VMK_NO_LICENSE,               "Not licensed to access VMFS volumes",        EACCES)\
    DEFINE_VMK_ERR(VMK_VSI_MODULE_NOT_FOUND,     "Vmkernel module necessary for this vsi call not loaded",    ENOENT)\
    DEFINE_VMK_ERR(VMK_LVM_RETRY_OPERATION,      "Transient LVM device condition, suggest retry", EAGAIN)\
+   DEFINE_VMK_ERR(VMK_SNAPSHOT_LV_INCOMPLETE,   "Snapshot LV incomplete",                        EAGAIN)\
+   DEFINE_VMK_ERR(VMK_MEDIUM_NOT_FOUND,         "Medium not found",                           EIO)\
+   DEFINE_VMK_ERR(VMK_MAX_PATHS_CLAIMED,        "Maximum allowed SCSI paths have already been claimed",  ENOMEM)\
+   DEFINE_VMK_ERR(VMK_NOT_MOUNTABLE,            "Filesystem is not mountable",                ENODEV)\
+   DEFINE_VMK_ERR(VMK_MEMSIZE_GT_MEMSIZELIMIT,  "Memory size exceeds memSizeLimit",           EINVAL)\
+   DEFINE_VMK_ERR(VMK_RECORD_WRITE_ERROR,       "An error occurred trying to write to the log",                EIO)\
+   DEFINE_VMK_ERR(VMK_REPLAY_READ_ERROR,        "An error occurred trying to read from the log",                EIO)\
+   DEFINE_VMK_ERR(VMK_REPLAY_TYPE_MISMATCH,     "There was a type mismatch while reading from the log",                EIO)\
+   DEFINE_VMK_ERR(VMK_REPLAY_DIVERGENCE,        "A divergence was detected during replay",                EIO)\
+   DEFINE_VMK_ERR(VMK_FT_NOT_RESPONDING,        "The remote side of an FT pair isn't responding",                ENOTCONN)\
+   DEFINE_VMK_ERR(VMK_NET_REPLAY_ERROR,         "An error occurred during replay of networking.",                EIO)\
 /* 
  * --- ADD NEW ERROR CODES ABOVE THIS COMMENT. --- VMK_GENERIC_LINUX_ERROR must be last.                   \
  */                                                                                                        \
diff --git a/ubuntu/vmxnet/vmkapi_types.h b/ubuntu/vmxnet/vmkapi_types.h
index 4fee05d..f076417 100644
--- a/ubuntu/vmxnet/vmkapi_types.h
+++ b/ubuntu/vmxnet/vmkapi_types.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998-2004 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998-2004 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * @VMKAPIMOD_LICENSE@
@@ -73,7 +73,7 @@ typedef unsigned int       vmk_uint32;
 typedef long               vmk_int64;
 typedef unsigned long      vmk_uint64;
 typedef vmk_uint64         vmk_VirtAddr;
-#else 
+#else
 typedef long long          vmk_int64;
 typedef unsigned long long vmk_uint64;
 typedef vmk_uint32         vmk_VirtAddr;
@@ -93,4 +93,17 @@ typedef union {
    void *ptr;
 } vmk_AddrCookie __attribute__ ((__transparent_union__));
 
+/**
+ *  \brief Wrapper for 64 bit signed and unsigned constants
+ */
+#if defined(__ia64__) || defined(__x86_64__)
+#define VMK_CONST64(c)     c##L
+#define VMK_CONST64U(c)    c##UL
+#else
+#define VMK_CONST64(c)     c##LL
+#define VMK_CONST64U(c)    c##ULL
+#endif
+
+
+
 #endif //_VMKAPI_TYPES_H_
diff --git a/ubuntu/vmxnet/vmnet_def.h b/ubuntu/vmxnet/vmnet_def.h
index 3efca1b..636a1ca 100644
--- a/ubuntu/vmxnet/vmnet_def.h
+++ b/ubuntu/vmxnet/vmnet_def.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 2004 VMware, Inc.  All rights reserved. 
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vmnet_def.h 
@@ -57,4 +56,5 @@
 #define VMNET_CAP_TX_CHAIN      0x4000  /* Guest can use multiple tx entries for a pkt */
 #define VMNET_CAP_RX_CHAIN      0x8000  /* a pkt can span multiple rx entries */
 #define VMNET_CAP_LPD           0x10000 /* large pkt delivery */
+#define VMNET_CAP_BPF           0x20000 /* BPF Support in VMXNET Virtual Hardware */
 #endif // _VMNET_DEF_H_
diff --git a/ubuntu/vmxnet/vmxnet.c b/ubuntu/vmxnet/vmxnet.c
index 3b13cdc..6b4272f 100644
--- a/ubuntu/vmxnet/vmxnet.c
+++ b/ubuntu/vmxnet/vmxnet.c
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1999 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1999 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
@@ -14,14 +13,13 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /* 
  * vmxnet.c: A virtual network driver for VMware.
  */
-
 #include "driver-config.h"
-
 #include "compat_module.h"
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9)
@@ -32,6 +30,7 @@
 #include "compat_spinlock.h"
 #include "compat_pci.h"
 #include "compat_init.h"
+#include "compat_timer.h"
 #include <asm/dma.h>
 #include <asm/page.h>
 #include <asm/uaccess.h>
@@ -42,7 +41,7 @@
 #include <linux/etherdevice.h>
 #include "compat_ioport.h"
 #ifndef KERNEL_2_1
-#   include <linux/delay.h>
+#include <linux/delay.h>
 #endif
 #include "compat_interrupt.h"
 
@@ -55,6 +54,11 @@
 #include "net.h"
 #include "vmxnet_version.h"
 
+#ifdef BPF_SUPPORT_ENABLED
+#include "bpf_meta.h"
+#include "compat_highmem.h"
+#endif
+
 static int vmxnet_debug = 1;
 
 #define VMXNET_WATCHDOG_TIMEOUT (5 * HZ) 
@@ -503,6 +507,58 @@ vmxnet_tx_timeout(struct net_device *dev)
 /*
  *-----------------------------------------------------------------------------
  *
+ * vmxnet_link_check --
+ *
+ *      Propagate device link status to netdev.
+ *
+ * Results:
+ *      None.
+ *
+ * Side effects:
+ *      Rearms timer for next check.
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+static void
+vmxnet_link_check(unsigned long data)   // IN: netdevice pointer
+{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,43)
+   struct net_device *dev = (struct net_device *)data;
+   struct Vmxnet_Private *lp;
+   uint32 status;
+   int ok;
+
+   lp = dev->priv;
+   status = inl(dev->base_addr + VMXNET_STATUS_ADDR);
+   ok = (status & VMXNET_STATUS_CONNECTED) != 0;
+   if (ok != netif_carrier_ok(dev)) {
+      if (ok) {
+         netif_carrier_on(dev);
+      } else {
+         netif_carrier_off(dev);
+      }
+   }
+
+   /*
+    * It would be great if vmxnet2 could generate interrupt when link
+    * state changes.  Maybe next time.  Let's just poll media every
+    * two seconds (2 seconds is same interval pcnet32 uses).
+    */
+   mod_timer(&lp->linkCheckTimer, jiffies + 2 * HZ);
+#else
+   /*
+    * Nothing to do on kernels before 2.3.43.  They do not have
+    * netif_carrier_*, and as we've lived without link state for
+    * years, let's live without it forever on these kernels.
+    */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,43) */
+}
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
  * vmxnet_probe_device --
  *
  *      Most of the initialization at module load time is done here.
@@ -732,6 +788,16 @@ vmxnet_probe_device(struct pci_dev             *pdev, // IN: vmxnet PCI device
 #endif
 #endif
 
+#ifdef BPF_SUPPORT_ENABLED
+    if(lp->capabilities & VMNET_CAP_BPF && 
+       lp->features & VMXNET_FEATURE_BPF) {
+       dev->features |= NETIF_F_BPF;
+       printk(" bpf");
+    }    
+#endif
+
+
+
    printk("\n");
 
    /* determine rx/tx ring sizes */
@@ -864,11 +930,20 @@ vmxnet_probe_device(struct pci_dev             *pdev, // IN: vmxnet PCI device
    dev->do_ioctl = vmxnet_ioctl;
 
    COMPAT_SET_MODULE_OWNER(dev);
+   COMPAT_SET_NETDEV_DEV(dev, &pdev->dev);
 
    if (register_netdev(dev)) {
       printk(KERN_ERR "Unable to register device\n");
       goto free_dev_dd;
    }
+   /*
+    * Use deferrable timer - we want 2s interval, but if it will
+    * be 2 seconds or 10 seconds, we do not care.
+    */
+   compat_init_timer_deferrable(&lp->linkCheckTimer);
+   lp->linkCheckTimer.data = (unsigned long)dev;
+   lp->linkCheckTimer.function = vmxnet_link_check;
+   vmxnet_link_check(lp->linkCheckTimer.data);
 
    /* Do this after register_netdev(), which sets device name */
    VMXNET_LOG("%s: %s at %#3lx assigned IRQ %d.\n",
@@ -915,6 +990,11 @@ vmxnet_remove_device(struct pci_dev* pdev)
    struct net_device *dev = pci_get_drvdata(pdev);
    struct Vmxnet_Private *lp = dev->priv;
 
+   /*
+    * Do this before device is gone so we never call netif_carrier_* after
+    * unregistering netdevice.
+    */
+   compat_del_timer_sync(&lp->linkCheckTimer);
    unregister_netdev(dev);
 
    /* Unmorph adapter if it was morphed. */
@@ -1826,6 +1906,10 @@ vmxnet_rx(struct net_device *dev)
    Vmxnet_Private *lp = (Vmxnet_Private *)dev->priv;
    Vmxnet2_DriverData *dd = lp->dd;
 
+#ifdef BPF_SUPPORT_ENABLED
+   struct BPF_MetaData *meta = NULL;
+#endif
+
    if (!lp->devOpen) {
       return 0;
    }
@@ -1897,6 +1981,52 @@ vmxnet_rx(struct net_device *dev)
          if (rre->flags & VMXNET2_RX_HW_XSUM_OK) {
             skb->ip_summed = CHECKSUM_UNNECESSARY;
          }
+#ifdef BPF_SUPPORT_ENABLED
+         
+         meta = (struct BPF_MetaData *)skb->cb;
+
+         if(rre->flags & VMXNET2_RX_BPF_TRAILER) {
+            char *vaddr;
+            int numFrags = skb_shinfo(skb)->nr_frags;
+            
+            if (numFrags > 0) {
+
+               /* If fragments are present, the trailer is present in the
+                * last fragement. Map it and remove the trailer 
+                */
+	       vaddr = kmap_atomic(skb_shinfo(skb)->frags[numFrags - 1].page,
+                                   KM_USER0);
+               if (vaddr) {
+
+                  memcpy(meta->bpfSnapLens, 
+                         vaddr + skb_shinfo(skb)->frags[numFrags-1].size, 
+                         sizeof meta->bpfSnapLens);
+                  kunmap_atomic((struct page *)vaddr, KM_USER0);
+
+               } else  {
+                  printk(KERN_ERR"Error mapping Last Fragment of Packet\n");
+                  /* Act as if there was no bpf trailer at all*/
+                  meta->controlByte = 0;
+                  goto error;
+               }
+            } else { 
+
+               /* The trailer is present in the linear data array */
+
+               vaddr = (char *)skb->data;
+
+               memcpy(meta->bpfSnapLens, vaddr + skb->len,
+                      sizeof meta->bpfSnapLens);
+            }
+
+            meta->controlByte |= VMXNET_BPF_PROCESSED;
+
+         } else {
+            meta->controlByte = 0;
+         }
+error:
+#endif
+
          skb->dev = dev;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
          lp->stats.rx_bytes += skb->len;
diff --git a/ubuntu/vmxnet/vmxnet2_def.h b/ubuntu/vmxnet/vmxnet2_def.h
index 121bfad..f371b94 100644
--- a/ubuntu/vmxnet/vmxnet2_def.h
+++ b/ubuntu/vmxnet/vmxnet2_def.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 2004 VMware, Inc.  All rights reserved. 
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 2004 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef _VMXNET2_DEF_H_
 #define _VMXNET2_DEF_H_
@@ -109,6 +108,10 @@ typedef struct Vmxnet2_RxRingEntry {
 #define VMXNET2_RX_WITH_FRAG   0x02
 #define VMXNET2_RX_FRAG_EOP    0x04
 
+#ifdef BPF_SUPPORT_ENABLED
+#define VMXNET2_RX_BPF_TRAILER 0x08
+#endif /* BPF_SUPPORT_ENABLED */
+
 typedef struct Vmxnet2_TxRingEntry {
    uint16		flags;		/* Flags as defined below. */
    uint16 	        ownership;	/* Who owns this packet. */
diff --git a/ubuntu/vmxnet/vmxnetInt.h b/ubuntu/vmxnet/vmxnetInt.h
index 101f8eb..4216490 100644
--- a/ubuntu/vmxnet/vmxnetInt.h
+++ b/ubuntu/vmxnet/vmxnetInt.h
@@ -1,6 +1,5 @@
-/* **********************************************************
- * Copyright 1998 VMware, Inc.  All rights reserved. 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1998 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef __VMXNETINT_H__
 #define __VMXNETINT_H__
@@ -169,6 +169,7 @@ typedef struct Vmxnet_Private {
    char                        *txBufferStartRaw;
    char                        *txBufferStart;
    struct pci_dev              *pdev;
+   struct timer_list            linkCheckTimer;
 } Vmxnet_Private;
 
 #endif /* __VMXNETINT_H__ */
diff --git a/ubuntu/vmxnet/vmxnet_def.h b/ubuntu/vmxnet/vmxnet_def.h
index e056848..b274796 100644
--- a/ubuntu/vmxnet/vmxnet_def.h
+++ b/ubuntu/vmxnet/vmxnet_def.h
@@ -1,7 +1,5 @@
-/* **********************************************************
- * Copyright 1999 VMware, Inc.  All rights reserved. 
- * 
- * **********************************************************
+/*********************************************************
+ * Copyright (C) 1999 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
@@ -15,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 #ifndef _VMXNET_DEF_H_
 #define _VMXNET_DEF_H_
@@ -121,6 +120,7 @@
 #define VMXNET_FEATURE_TSO                      0x02
 #define VMXNET_FEATURE_JUMBO_FRAME              0x04
 #define VMXNET_FEATURE_LPD                      0x08
+#define VMXNET_FEATURE_BPF                      0x10
 
 /*
  * Define the set of capabilities required by each feature above
@@ -128,6 +128,7 @@
 #define VMXNET_FEATURE_ZERO_COPY_TX_CAPS        VMXNET_CAP_SG
 #define VMXNET_FEATURE_TSO_CAPS                 VMXNET_CAP_TSO
 #define VMXNET_HIGHEST_FEATURE_BIT              VMXNET_FEATURE_TSO
+#define VMXNET_FEATURE_BPF_CAPS                 VMNET_CAP_BPF
 
 #define VMXNET_INC(val, max)     \
    val++;                        \
diff --git a/ubuntu/vmxnet/vmxnet_version.h b/ubuntu/vmxnet/vmxnet_version.h
index 50f5fa8..fc7ed3b 100644
--- a/ubuntu/vmxnet/vmxnet_version.h
+++ b/ubuntu/vmxnet/vmxnet_version.h
@@ -1,6 +1,5 @@
-/* ************************************************************************
- * Copyright 2007 VMware, Inc.  All rights reserved. 
- * ************************************************************************
+/*********************************************************
+ * Copyright (C) 2007 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
@@ -14,7 +13,8 @@
  * 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
- */
+ *
+ *********************************************************/
 
 /*
  * vmxnet_version.h --
-- 
1.5.3.7





More information about the kernel-team mailing list