Search
j0ke.net Open Build Service
>
Projects
>
virtualization
:
VMware
>
open-vm-tools
> open-vm-tools-2008.08.08-2.6.27.kernels.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File open-vm-tools-2008.08.08-2.6.27.kernels.patch of Package open-vm-tools (Revision 2)
Currently displaying revision
2
,
show latest
diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/autoconf/cachector1.c ./vmblock/autoconf/cachector1.c --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/autoconf/cachector1.c 1969-12-31 16:00:00.000000000 -0800 +++ ./vmblock/autoconf/cachector1.c 2008-08-24 02:51:19.000000000 -0700 @@ -0,0 +1,38 @@ +/********************************************************* + * Copyright (C) 2008 VMware, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2 and no later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *********************************************************/ + +#include <linux/autoconf.h> +#include <linux/version.h> + +/* + * Between 2.6.27-rc1 and 2.6.27-rc2 ctor prototype was changed from + * ctor(cache, ptr) to ctor(ptr). Unfortunately there + * is no typedef for ctor, so we have to redefine kmem_cache_create + * to find out ctor prototype. If prototype matches, then this is old + * kernel. + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) +#error "This test intentionally fails on 2.6.28 and newer kernels." +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +#include <linux/slab.h> + +struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, + unsigned long, + void (*)(struct kmem_cache *, void *)); + +#endif diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_sched.h ./vmblock/include/compat_sched.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_sched.h 2008-04-28 15:36:04.000000000 -0700 +++ ./vmblock/include/compat_sched.h 2008-08-24 02:51:19.000000000 -0700 @@ -271,4 +271,21 @@ #define compat_set_freezable() do {} while (0) #endif +/* + * Since 2.6.27-rc2 kill_proc() is gone... Replacement (GPL-only!) + * API is available since 2.6.19. Use them from 2.6.27-rc1 up. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +typedef int compat_pid; +#define compat_find_get_pid(pid) (pid) +#define compat_put_pid(pid) do { } while (0) +#define compat_kill_pid(pid, sig, flag) kill_proc(pid, sig, flag) +#else +typedef struct pid * compat_pid; +#define compat_find_get_pid(pid) find_get_pid(pid) +#define compat_put_pid(pid) put_pid(pid) +#define compat_kill_pid(pid, sig, flag) kill_pid(pid, sig, flag) +#endif + + #endif /* __COMPAT_SCHED_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_semaphore.h ./vmblock/include/compat_semaphore.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_semaphore.h 2008-04-28 15:36:04.000000000 -0700 +++ ./vmblock/include/compat_semaphore.h 2008-08-24 02:51:19.000000000 -0700 @@ -20,7 +20,12 @@ # define __COMPAT_SEMAPHORE_H__ -#include <asm/semaphore.h> +/* <= 2.6.25 have asm only, 2.6.26 has both, and 2.6.27-rc2+ has linux only. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +# include <asm/semaphore.h> +#else +# include <linux/semaphore.h> +#endif /* diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_slab.h ./vmblock/include/compat_slab.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/include/compat_slab.h 2008-04-28 15:36:04.000000000 -0700 +++ ./vmblock/include/compat_slab.h 2008-08-24 02:51:19.000000000 -0700 @@ -57,14 +57,29 @@ * Up to 2.6.23 kmem_cache constructor has three arguments - pointer to block to * prepare (aka "this"), from which cache it came, and some unused flags. After * 2.6.23 flags were removed, and order of "this" and cache parameters was swapped... + * Since 2.6.27-rc2 everything is different again, and ctor has only one argument. + * + * HAS_3_ARGS has precedence over HAS_2_ARGS if both are defined. */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) && !defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) # define VMW_KMEMCR_CTOR_HAS_3_ARGS #endif -#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && !defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) +# define VMW_KMEMCR_CTOR_HAS_2_ARGS +#endif + +#if defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) typedef void compat_kmem_cache_ctor(void *, compat_kmem_cache *, unsigned long); -#else +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg, \ + compat_kmem_cache *cache, \ + unsigned long flags +#elif defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) typedef void compat_kmem_cache_ctor(compat_kmem_cache *, void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) compat_kmem_cache *cache, \ + void *arg +#else +typedef void compat_kmem_cache_ctor(void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg #endif #endif /* __COMPAT_SLAB_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/linux/filesystem.c ./vmblock/linux/filesystem.c --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/linux/filesystem.c 2008-04-28 15:36:04.000000000 -0700 +++ ./vmblock/linux/filesystem.c 2008-08-24 02:51:19.000000000 -0700 @@ -411,19 +411,11 @@ *---------------------------------------------------------------------------- */ -#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS static void -InodeCacheCtor(void *slabElem, // IN: allocated slab item to initialize - compat_kmem_cache *cache, // IN: cache slab is from - unsigned long flags) // IN: flags associated with allocation -#else -static void -InodeCacheCtor(compat_kmem_cache *cache, // IN: cache slab is from - void *slabElem) // IN: allocated slab item to initialize -#endif +InodeCacheCtor(COMPAT_KMEM_CACHE_CTOR_ARGS(slabElem)) // IN: allocated slab item to initialize { #ifdef VMW_EMBED_INODE - VMBlockInodeInfo *iinfo = (VMBlockInodeInfo *)slabElem; + VMBlockInodeInfo *iinfo = slabElem; inode_init_once(&iinfo->inode); #endif diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/Makefile.kernel ./vmblock/Makefile.kernel --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmblock/Makefile.kernel 2008-04-28 15:36:04.000000000 -0700 +++ ./vmblock/Makefile.kernel 2008-08-24 02:51:19.000000000 -0700 @@ -25,7 +25,8 @@ EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/epoll.c, -DVMW_HAVE_EPOLL, ) EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/skas1.c, -DVMW_SKAS_MMAP, ) EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachecreate.c, -DVMW_KMEMCR_HAS_DTOR, ) -EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachector.c, -DVMW_KMEMCR_CTOR_HAS_3_ARGS, ) +EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachector.c, -DVMW_KMEMCR_CTOR_HAS_3_ARGS, ) +EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachector1.c, -DVMW_KMEMCR_CTOR_HAS_2_ARGS, ) # Note: These tests are inverted. EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/getsb1.c, , -DVMW_GETSB_2618) diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmci/compat_sched.h ./vmci/compat_sched.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmci/compat_sched.h 2008-08-11 12:40:15.000000000 -0700 +++ ./vmci/compat_sched.h 2008-08-24 02:51:23.000000000 -0700 @@ -271,4 +271,21 @@ #define compat_set_freezable() do {} while (0) #endif +/* + * Since 2.6.27-rc2 kill_proc() is gone... Replacement (GPL-only!) + * API is available since 2.6.19. Use them from 2.6.27-rc1 up. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +typedef int compat_pid; +#define compat_find_get_pid(pid) (pid) +#define compat_put_pid(pid) do { } while (0) +#define compat_kill_pid(pid, sig, flag) kill_proc(pid, sig, flag) +#else +typedef struct pid * compat_pid; +#define compat_find_get_pid(pid) find_get_pid(pid) +#define compat_put_pid(pid) put_pid(pid) +#define compat_kill_pid(pid, sig, flag) kill_pid(pid, sig, flag) +#endif + + #endif /* __COMPAT_SCHED_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmci/compat_semaphore.h ./vmci/compat_semaphore.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmci/compat_semaphore.h 2008-08-11 12:40:15.000000000 -0700 +++ ./vmci/compat_semaphore.h 2008-08-24 02:51:22.000000000 -0700 @@ -20,7 +20,12 @@ # define __COMPAT_SEMAPHORE_H__ -#include <asm/semaphore.h> +/* <= 2.6.25 have asm only, 2.6.26 has both, and 2.6.27-rc2+ has linux only. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +# include <asm/semaphore.h> +#else +# include <linux/semaphore.h> +#endif /* diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmci/compat_slab.h ./vmci/compat_slab.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmci/compat_slab.h 2008-08-11 12:40:15.000000000 -0700 +++ ./vmci/compat_slab.h 2008-08-24 02:51:22.000000000 -0700 @@ -57,14 +57,29 @@ * Up to 2.6.23 kmem_cache constructor has three arguments - pointer to block to * prepare (aka "this"), from which cache it came, and some unused flags. After * 2.6.23 flags were removed, and order of "this" and cache parameters was swapped... + * Since 2.6.27-rc2 everything is different again, and ctor has only one argument. + * + * HAS_3_ARGS has precedence over HAS_2_ARGS if both are defined. */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) && !defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) # define VMW_KMEMCR_CTOR_HAS_3_ARGS #endif -#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && !defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) +# define VMW_KMEMCR_CTOR_HAS_2_ARGS +#endif + +#if defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) typedef void compat_kmem_cache_ctor(void *, compat_kmem_cache *, unsigned long); -#else +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg, \ + compat_kmem_cache *cache, \ + unsigned long flags +#elif defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) typedef void compat_kmem_cache_ctor(compat_kmem_cache *, void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) compat_kmem_cache *cache, \ + void *arg +#else +typedef void compat_kmem_cache_ctor(void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg #endif #endif /* __COMPAT_SLAB_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/autoconf/cachector1.c ./vmhgfs/autoconf/cachector1.c --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/autoconf/cachector1.c 1969-12-31 16:00:00.000000000 -0800 +++ ./vmhgfs/autoconf/cachector1.c 2008-08-24 02:51:24.000000000 -0700 @@ -0,0 +1,38 @@ +/********************************************************* + * Copyright (C) 2008 VMware, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2 and no later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *********************************************************/ + +#include <linux/autoconf.h> +#include <linux/version.h> + +/* + * Between 2.6.27-rc1 and 2.6.27-rc2 ctor prototype was changed from + * ctor(cache, ptr) to ctor(ptr). Unfortunately there + * is no typedef for ctor, so we have to redefine kmem_cache_create + * to find out ctor prototype. If prototype matches, then this is old + * kernel. + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) +#error "This test intentionally fails on 2.6.28 and newer kernels." +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +#include <linux/slab.h> + +struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, + unsigned long, + void (*)(struct kmem_cache *, void *)); + +#endif diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/bdhandler.c ./vmhgfs/bdhandler.c --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/bdhandler.c 2008-06-03 01:30:52.000000000 -0700 +++ ./vmhgfs/bdhandler.c 2008-08-24 02:51:24.000000000 -0700 @@ -26,18 +26,19 @@ #include "driver-config.h" #include <asm/atomic.h> -#include <asm/semaphore.h> #include <linux/errno.h> -#include <linux/timer.h> #include "compat_completion.h" #include "compat_kernel.h" #include "compat_kthread.h" #include "compat_list.h" #include "compat_sched.h" +#include "compat_semaphore.h" #include "compat_slab.h" #include "compat_spinlock.h" #include "compat_version.h" +/* Must be included after semaphore.h. */ +#include <linux/timer.h> /* Must be included after sched.h. */ #include <linux/smp_lock.h> diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/compat_sched.h ./vmhgfs/compat_sched.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/compat_sched.h 2008-04-28 15:36:05.000000000 -0700 +++ ./vmhgfs/compat_sched.h 2008-08-24 02:51:24.000000000 -0700 @@ -271,4 +271,21 @@ #define compat_set_freezable() do {} while (0) #endif +/* + * Since 2.6.27-rc2 kill_proc() is gone... Replacement (GPL-only!) + * API is available since 2.6.19. Use them from 2.6.27-rc1 up. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +typedef int compat_pid; +#define compat_find_get_pid(pid) (pid) +#define compat_put_pid(pid) do { } while (0) +#define compat_kill_pid(pid, sig, flag) kill_proc(pid, sig, flag) +#else +typedef struct pid * compat_pid; +#define compat_find_get_pid(pid) find_get_pid(pid) +#define compat_put_pid(pid) put_pid(pid) +#define compat_kill_pid(pid, sig, flag) kill_pid(pid, sig, flag) +#endif + + #endif /* __COMPAT_SCHED_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/compat_semaphore.h ./vmhgfs/compat_semaphore.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/compat_semaphore.h 2008-04-28 15:36:05.000000000 -0700 +++ ./vmhgfs/compat_semaphore.h 2008-08-24 02:51:24.000000000 -0700 @@ -20,7 +20,12 @@ # define __COMPAT_SEMAPHORE_H__ -#include <asm/semaphore.h> +/* <= 2.6.25 have asm only, 2.6.26 has both, and 2.6.27-rc2+ has linux only. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +# include <asm/semaphore.h> +#else +# include <linux/semaphore.h> +#endif /* diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/compat_slab.h ./vmhgfs/compat_slab.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/compat_slab.h 2008-04-28 15:36:05.000000000 -0700 +++ ./vmhgfs/compat_slab.h 2008-08-24 02:51:24.000000000 -0700 @@ -57,14 +57,29 @@ * Up to 2.6.23 kmem_cache constructor has three arguments - pointer to block to * prepare (aka "this"), from which cache it came, and some unused flags. After * 2.6.23 flags were removed, and order of "this" and cache parameters was swapped... + * Since 2.6.27-rc2 everything is different again, and ctor has only one argument. + * + * HAS_3_ARGS has precedence over HAS_2_ARGS if both are defined. */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) && !defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) # define VMW_KMEMCR_CTOR_HAS_3_ARGS #endif -#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && !defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) +# define VMW_KMEMCR_CTOR_HAS_2_ARGS +#endif + +#if defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) typedef void compat_kmem_cache_ctor(void *, compat_kmem_cache *, unsigned long); -#else +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg, \ + compat_kmem_cache *cache, \ + unsigned long flags +#elif defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) typedef void compat_kmem_cache_ctor(compat_kmem_cache *, void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) compat_kmem_cache *cache, \ + void *arg +#else +typedef void compat_kmem_cache_ctor(void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg #endif #endif /* __COMPAT_SLAB_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/filesystem.c ./vmhgfs/filesystem.c --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/filesystem.c 2008-06-03 01:30:52.000000000 -0700 +++ ./vmhgfs/filesystem.c 2008-08-24 02:51:24.000000000 -0700 @@ -27,7 +27,6 @@ #include "driver-config.h" #include <asm/atomic.h> -#include <asm/semaphore.h> #include <linux/errno.h> #include <linux/list.h> #include <linux/module.h> @@ -38,6 +37,7 @@ #include "compat_kernel.h" #include "compat_kthread.h" #include "compat_sched.h" +#include "compat_semaphore.h" #include "compat_slab.h" #include "compat_spinlock.h" #include "compat_string.h" @@ -200,16 +200,8 @@ *----------------------------------------------------------------------------- */ -#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 +HgfsInodeCacheCtor(COMPAT_KMEM_CACHE_CTOR_ARGS(slabElem)) // IN: slab item to initialize { #ifdef VMW_EMBED_INODE HgfsInodeInfo *iinfo = (HgfsInodeInfo *)slabElem; diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/Makefile.kernel ./vmhgfs/Makefile.kernel --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/Makefile.kernel 2008-04-28 15:36:05.000000000 -0700 +++ ./vmhgfs/Makefile.kernel 2008-08-24 02:51:25.000000000 -0700 @@ -30,6 +30,7 @@ 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, ) +EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachector1.c, -DVMW_KMEMCR_CTOR_HAS_2_ARGS, ) # Note: These tests are inverted EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/getsb1.c,, -DVMW_GETSB_2618) diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/module.h ./vmhgfs/module.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/module.h 2008-06-03 01:30:52.000000000 -0700 +++ ./vmhgfs/module.h 2008-08-24 02:51:24.000000000 -0700 @@ -29,10 +29,10 @@ #include "driver-config.h" #include <asm/atomic.h> -#include <asm/semaphore.h> #include "compat_completion.h" #include "compat_fs.h" #include "compat_kthread.h" +#include "compat_semaphore.h" #include "compat_slab.h" #include "compat_spinlock.h" #include "compat_version.h" diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/request.c ./vmhgfs/request.c --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmhgfs/request.c 2008-05-19 22:06:01.000000000 -0700 +++ ./vmhgfs/request.c 2008-08-24 02:51:24.000000000 -0700 @@ -27,11 +27,11 @@ #include "driver-config.h" #include <asm/atomic.h> -#include <asm/semaphore.h> #include <linux/list.h> #include <linux/signal.h> #include "compat_kernel.h" #include "compat_sched.h" +#include "compat_semaphore.h" #include "compat_slab.h" #include "compat_spinlock.h" diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmmemctl/compat_sched.h ./vmmemctl/compat_sched.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmmemctl/compat_sched.h 2008-04-28 15:36:05.000000000 -0700 +++ ./vmmemctl/compat_sched.h 2008-08-24 02:51:27.000000000 -0700 @@ -271,4 +271,21 @@ #define compat_set_freezable() do {} while (0) #endif +/* + * Since 2.6.27-rc2 kill_proc() is gone... Replacement (GPL-only!) + * API is available since 2.6.19. Use them from 2.6.27-rc1 up. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +typedef int compat_pid; +#define compat_find_get_pid(pid) (pid) +#define compat_put_pid(pid) do { } while (0) +#define compat_kill_pid(pid, sig, flag) kill_proc(pid, sig, flag) +#else +typedef struct pid * compat_pid; +#define compat_find_get_pid(pid) find_get_pid(pid) +#define compat_put_pid(pid) put_pid(pid) +#define compat_kill_pid(pid, sig, flag) kill_pid(pid, sig, flag) +#endif + + #endif /* __COMPAT_SCHED_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmmemctl/compat_semaphore.h ./vmmemctl/compat_semaphore.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmmemctl/compat_semaphore.h 2008-04-28 15:36:05.000000000 -0700 +++ ./vmmemctl/compat_semaphore.h 2008-08-24 02:51:26.000000000 -0700 @@ -20,7 +20,12 @@ # define __COMPAT_SEMAPHORE_H__ -#include <asm/semaphore.h> +/* <= 2.6.25 have asm only, 2.6.26 has both, and 2.6.27-rc2+ has linux only. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +# include <asm/semaphore.h> +#else +# include <linux/semaphore.h> +#endif /* diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmsync/autoconf/cachector1.c ./vmsync/autoconf/cachector1.c --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmsync/autoconf/cachector1.c 1969-12-31 16:00:00.000000000 -0800 +++ ./vmsync/autoconf/cachector1.c 2008-08-24 02:51:29.000000000 -0700 @@ -0,0 +1,38 @@ +/********************************************************* + * Copyright (C) 2008 VMware, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation version 2 and no later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + *********************************************************/ + +#include <linux/autoconf.h> +#include <linux/version.h> + +/* + * Between 2.6.27-rc1 and 2.6.27-rc2 ctor prototype was changed from + * ctor(cache, ptr) to ctor(ptr). Unfortunately there + * is no typedef for ctor, so we have to redefine kmem_cache_create + * to find out ctor prototype. If prototype matches, then this is old + * kernel. + */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28) +#error "This test intentionally fails on 2.6.28 and newer kernels." +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) +#include <linux/slab.h> + +struct kmem_cache *kmem_cache_create(const char *, size_t, size_t, + unsigned long, + void (*)(struct kmem_cache *, void *)); + +#endif diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmsync/compat_semaphore.h ./vmsync/compat_semaphore.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmsync/compat_semaphore.h 1969-12-31 16:00:00.000000000 -0800 +++ ./vmsync/compat_semaphore.h 2008-08-24 02:51:29.000000000 -0700 @@ -0,0 +1,49 @@ +/********************************************************* + * 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_SEMAPHORE_H__ +# define __COMPAT_SEMAPHORE_H__ + + +/* <= 2.6.25 have asm only, 2.6.26 has both, and 2.6.27-rc2+ has linux only. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +# include <asm/semaphore.h> +#else +# include <linux/semaphore.h> +#endif + + +/* +* The init_MUTEX_LOCKED() API appeared in 2.2.18, and is also in +* 2.2.17-21mdk --hpreg +*/ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18) + #ifndef init_MUTEX_LOCKED + #define init_MUTEX_LOCKED(_sem) *(_sem) = MUTEX_LOCKED + #endif + #ifndef DECLARE_MUTEX + #define DECLARE_MUTEX(name) struct semaphore name = MUTEX + #endif + #ifndef DECLARE_MUTEX_LOCKED + #define DECLARE_MUTEX_LOCKED(name) struct semaphore name = MUTEX_LOCKED + #endif +#endif + + +#endif /* __COMPAT_SEMAPHORE_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmsync/compat_slab.h ./vmsync/compat_slab.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmsync/compat_slab.h 2008-04-28 15:36:05.000000000 -0700 +++ ./vmsync/compat_slab.h 2008-08-24 02:51:29.000000000 -0700 @@ -57,14 +57,29 @@ * Up to 2.6.23 kmem_cache constructor has three arguments - pointer to block to * prepare (aka "this"), from which cache it came, and some unused flags. After * 2.6.23 flags were removed, and order of "this" and cache parameters was swapped... + * Since 2.6.27-rc2 everything is different again, and ctor has only one argument. + * + * HAS_3_ARGS has precedence over HAS_2_ARGS if both are defined. */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) && !defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) # define VMW_KMEMCR_CTOR_HAS_3_ARGS #endif -#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && !defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) +# define VMW_KMEMCR_CTOR_HAS_2_ARGS +#endif + +#if defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) typedef void compat_kmem_cache_ctor(void *, compat_kmem_cache *, unsigned long); -#else +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg, \ + compat_kmem_cache *cache, \ + unsigned long flags +#elif defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) typedef void compat_kmem_cache_ctor(compat_kmem_cache *, void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) compat_kmem_cache *cache, \ + void *arg +#else +typedef void compat_kmem_cache_ctor(void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg #endif #endif /* __COMPAT_SLAB_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmsync/Makefile.kernel ./vmsync/Makefile.kernel --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmsync/Makefile.kernel 2008-04-28 15:36:05.000000000 -0700 +++ ./vmsync/Makefile.kernel 2008-08-24 03:26:56.000000000 -0700 @@ -26,6 +26,7 @@ EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachecreate.c, -DVMW_KMEMCR_HAS_DTOR, ) EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachector.c, -DVMW_KMEMCR_CTOR_HAS_3_ARGS, ) +EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/cachector1.c, -DVMW_KMEMCR_CTOR_HAS_2_ARGS, ) obj-m += $(DRIVER).o diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmsync/sync.c ./vmsync/sync.c --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmsync/sync.c 2008-08-11 12:40:15.000000000 -0700 +++ ./vmsync/sync.c 2008-08-24 02:51:29.000000000 -0700 @@ -40,7 +40,6 @@ #include <asm/bug.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> #include <asm/string.h> #include <linux/buffer_head.h> #include <linux/proc_fs.h> @@ -48,6 +47,7 @@ #include "compat_fs.h" #include "compat_module.h" #include "compat_namei.h" +#include "compat_semaphore.h" #include "compat_slab.h" #include "compat_workqueue.h" @@ -576,18 +576,11 @@ *----------------------------------------------------------------------------- */ -#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS static void -VmSyncBlockDeviceCtor(void *slabelem, // IN - compat_kmem_cache *cache, // IN - unsigned long flags) // IN -#else -static void -VmSyncBlockDeviceCtor(compat_kmem_cache *cache, // IN - void *slabelem) // IN -#endif +VmSyncBlockDeviceCtor(COMPAT_KMEM_CACHE_CTOR_ARGS(slabelem)) // IN { - VmSyncBlockDevice *dev = (VmSyncBlockDevice *) slabelem; + VmSyncBlockDevice *dev = slabelem; + INIT_LIST_HEAD(&dev->list); dev->bdev = NULL; dev->sb = NULL; @@ -610,18 +603,11 @@ *----------------------------------------------------------------------------- */ -#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS static void -VmSyncStateCtor(void *slabelem, // IN - compat_kmem_cache *cache, // IN - unsigned long flags) // IN -#else -static void -VmSyncStateCtor(compat_kmem_cache *cache, // IN - void *slabelem) // IN -#endif +VmSyncStateCtor(COMPAT_KMEM_CACHE_CTOR_ARGS(slabelem)) // IN { - VmSyncState *state = (VmSyncState *) slabelem; + VmSyncState *state = slabelem; + INIT_LIST_HEAD(&state->devices); COMPAT_INIT_DELAYED_WORK(&state->thawTask, VmSyncThawDevicesCallback, &state); diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmxnet/compat_slab.h ./vmxnet/compat_slab.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmxnet/compat_slab.h 2008-04-28 15:36:05.000000000 -0700 +++ ./vmxnet/compat_slab.h 2008-08-24 02:51:28.000000000 -0700 @@ -57,14 +57,29 @@ * Up to 2.6.23 kmem_cache constructor has three arguments - pointer to block to * prepare (aka "this"), from which cache it came, and some unused flags. After * 2.6.23 flags were removed, and order of "this" and cache parameters was swapped... + * Since 2.6.27-rc2 everything is different again, and ctor has only one argument. + * + * HAS_3_ARGS has precedence over HAS_2_ARGS if both are defined. */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) && !defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) # define VMW_KMEMCR_CTOR_HAS_3_ARGS #endif -#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && !defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) +# define VMW_KMEMCR_CTOR_HAS_2_ARGS +#endif + +#if defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) typedef void compat_kmem_cache_ctor(void *, compat_kmem_cache *, unsigned long); -#else +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg, \ + compat_kmem_cache *cache, \ + unsigned long flags +#elif defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) typedef void compat_kmem_cache_ctor(compat_kmem_cache *, void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) compat_kmem_cache *cache, \ + void *arg +#else +typedef void compat_kmem_cache_ctor(void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg #endif #endif /* __COMPAT_SLAB_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmxnet/compat_timer.h ./vmxnet/compat_timer.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vmxnet/compat_timer.h 2008-04-28 15:36:05.000000000 -0700 +++ ./vmxnet/compat_timer.h 2008-08-24 02:51:28.000000000 -0700 @@ -56,6 +56,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 9) # include <linux/delay.h> # define compat_msleep_interruptible(msecs) msleep_interruptible(msecs) +# define compat_msleep(msecs) msleep(msecs) #else # include <linux/sched.h> /* @@ -79,6 +80,13 @@ set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(msecs_to_jiffies(msecs) + 1); } + +static inline void +compat_msleep(unsigned long msecs) // IN +{ + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_timeout(msecs_to_jiffies(msecs) + 1); +} #endif diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vsock/include/compat_sched.h ./vsock/include/compat_sched.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vsock/include/compat_sched.h 2008-08-11 12:40:15.000000000 -0700 +++ ./vsock/include/compat_sched.h 2008-08-24 02:51:21.000000000 -0700 @@ -271,4 +271,21 @@ #define compat_set_freezable() do {} while (0) #endif +/* + * Since 2.6.27-rc2 kill_proc() is gone... Replacement (GPL-only!) + * API is available since 2.6.19. Use them from 2.6.27-rc1 up. + */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +typedef int compat_pid; +#define compat_find_get_pid(pid) (pid) +#define compat_put_pid(pid) do { } while (0) +#define compat_kill_pid(pid, sig, flag) kill_proc(pid, sig, flag) +#else +typedef struct pid * compat_pid; +#define compat_find_get_pid(pid) find_get_pid(pid) +#define compat_put_pid(pid) put_pid(pid) +#define compat_kill_pid(pid, sig, flag) kill_pid(pid, sig, flag) +#endif + + #endif /* __COMPAT_SCHED_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vsock/include/compat_semaphore.h ./vsock/include/compat_semaphore.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vsock/include/compat_semaphore.h 2008-08-11 12:40:15.000000000 -0700 +++ ./vsock/include/compat_semaphore.h 2008-08-24 02:51:21.000000000 -0700 @@ -20,7 +20,12 @@ # define __COMPAT_SEMAPHORE_H__ -#include <asm/semaphore.h> +/* <= 2.6.25 have asm only, 2.6.26 has both, and 2.6.27-rc2+ has linux only. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) +# include <asm/semaphore.h> +#else +# include <linux/semaphore.h> +#endif /* diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vsock/include/compat_slab.h ./vsock/include/compat_slab.h --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vsock/include/compat_slab.h 2008-08-11 12:40:15.000000000 -0700 +++ ./vsock/include/compat_slab.h 2008-08-24 02:51:21.000000000 -0700 @@ -57,14 +57,29 @@ * Up to 2.6.23 kmem_cache constructor has three arguments - pointer to block to * prepare (aka "this"), from which cache it came, and some unused flags. After * 2.6.23 flags were removed, and order of "this" and cache parameters was swapped... + * Since 2.6.27-rc2 everything is different again, and ctor has only one argument. + * + * HAS_3_ARGS has precedence over HAS_2_ARGS if both are defined. */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) && !defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) # define VMW_KMEMCR_CTOR_HAS_3_ARGS #endif -#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && !defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) +# define VMW_KMEMCR_CTOR_HAS_2_ARGS +#endif + +#if defined(VMW_KMEMCR_CTOR_HAS_3_ARGS) typedef void compat_kmem_cache_ctor(void *, compat_kmem_cache *, unsigned long); -#else +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg, \ + compat_kmem_cache *cache, \ + unsigned long flags +#elif defined(VMW_KMEMCR_CTOR_HAS_2_ARGS) typedef void compat_kmem_cache_ctor(compat_kmem_cache *, void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) compat_kmem_cache *cache, \ + void *arg +#else +typedef void compat_kmem_cache_ctor(void *); +#define COMPAT_KMEM_CACHE_CTOR_ARGS(arg) void *arg #endif #endif /* __COMPAT_SLAB_H__ */ diff -Nru /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vsock/linux/af_vsock.c ./vsock/linux/af_vsock.c --- /usr/src/git/open-vm-tools/open-vm-tools/modules/linux/vsock/linux/af_vsock.c 2008-08-11 12:40:15.000000000 -0700 +++ ./vsock/linux/af_vsock.c 2008-08-24 02:51:22.000000000 -0700 @@ -397,9 +397,10 @@ #endif static struct file_operations vsockVmciDeviceOps = { - .ioctl = VSockVmciDevIoctl, #ifdef HAVE_UNLOCKED_IOCTL .unlocked_ioctl = VSockVmciDevUnlockedIoctl, +#else + .ioctl = VSockVmciDevIoctl, #endif #ifdef HAVE_COMPAT_IOCTL .compat_ioctl = VSockVmciDevUnlockedIoctl,