From: VMware, Inc <> Date: Mon, 26 Jul 2010 18:57:43 +0000 (-0700) Subject: Remove compat_wait.h X-Git-Tag: 2010.07.25-280253~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f0a97d7dc017195ba0d1f41f8ee2faa22a515e66;p=thirdparty%2Fopen-vm-tools.git Remove compat_wait.h Another chunk of code thst is not needed on recent (2.6.9+) kernels. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/modules/linux/shared/compat_wait.h b/open-vm-tools/modules/linux/shared/compat_wait.h deleted file mode 100644 index 08ae86cda..000000000 --- a/open-vm-tools/modules/linux/shared/compat_wait.h +++ /dev/null @@ -1,157 +0,0 @@ -/********************************************************* - * 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_WAIT_H__ -# define __COMPAT_WAIT_H__ - - -#include -#include -#include - - -/* - * The DECLARE_WAITQUEUE() API appeared in 2.3.1 - * It was back ported in 2.2.18 - * - * --hpreg - */ - -#ifndef DECLARE_WAITQUEUE - -typedef struct wait_queue *wait_queue_head_t; -# define init_waitqueue_head(_headPtr) *(_headPtr) = NULL -# define DECLARE_WAITQUEUE(_var, _task) \ - struct wait_queue _var = {_task, NULL, } - -typedef struct wait_queue wait_queue_t; -# define init_waitqueue_entry(_wait, _task) ((_wait)->task = (_task)) - -#endif - - -/* - * The wait_event_interruptible_timeout() interface is not - * defined in pre-2.6 kernels. - */ -#ifndef wait_event_interruptible_timeout -#define __wait_event_interruptible_timeout(wq, condition, ret) \ -do { \ - wait_queue_t __wait; \ - init_waitqueue_entry(&__wait, current); \ - \ - add_wait_queue(&wq, &__wait); \ - for (;;) { \ - set_current_state(TASK_INTERRUPTIBLE); \ - if (condition) \ - break; \ - if (!signal_pending(current)) { \ - ret = schedule_timeout(ret); \ - if (!ret) \ - break; \ - continue; \ - } \ - ret = -ERESTARTSYS; \ - break; \ - } \ - set_current_state(TASK_RUNNING); \ - remove_wait_queue(&wq, &__wait); \ -} while (0) - -#define wait_event_interruptible_timeout(wq, condition, timeout) \ -({ \ - long __ret = timeout; \ - if (!(condition)) \ - __wait_event_interruptible_timeout(wq, condition, __ret); \ - __ret; \ -}) -#endif - -/* - * The wait_event_timeout() interface is not - * defined in pre-2.6 kernels. - */ -#ifndef wait_event_timeout -#define __wait_event_timeout(wq, condition, ret) \ -do { \ - wait_queue_t __wait; \ - init_waitqueue_entry(&__wait, current); \ - \ - add_wait_queue(&wq, &__wait); \ - for (;;) { \ - set_current_state(TASK_UNINTERRUPTIBLE); \ - if (condition) \ - break; \ - ret = schedule_timeout(ret); \ - if (!ret) \ - break; \ - } \ - set_current_state(TASK_RUNNING); \ - remove_wait_queue(&wq, &__wait); \ -} while (0) - -#define wait_event_timeout(wq, condition, timeout) \ -({ \ - long __ret = timeout; \ - if (!(condition)) \ - __wait_event_timeout(wq, condition, __ret); \ - __ret; \ -}) -#endif - -/* - * DEFINE_WAIT() and friends were added in 2.5.39 and backported to 2.4.28. - * - * Unfortunately it is not true. While some distros may have done it the - * change has never made it into vanilla 2.4 kernel. Instead of testing - * particular kernel versions let's just test for presence of DEFINE_WAIT - * when figuring out whether we need to provide replacement implementation - * or simply alias existing one. - */ - -#ifndef DEFINE_WAIT - -# define COMPAT_DEFINE_WAIT(_wait) \ - DECLARE_WAITQUEUE(_wait, current) -# define compat_init_prepare_to_wait(_sleep, _wait, _state) \ - do { \ - __set_current_state(_state); \ - add_wait_queue(_sleep, _wait); \ - } while (0) -# define compat_cont_prepare_to_wait(_sleep, _wait, _state) \ - set_current_state(_state) -# define compat_finish_wait(_sleep, _wait, _state) \ - do { \ - __set_current_state(_state); \ - remove_wait_queue(_sleep, _wait); \ - } while (0) - -#else - -# define COMPAT_DEFINE_WAIT(_wait) \ - DEFINE_WAIT(_wait) -# define compat_init_prepare_to_wait(_sleep, _wait, _state) \ - prepare_to_wait(_sleep, _wait, _state) -# define compat_cont_prepare_to_wait(_sleep, _wait, _state) \ - prepare_to_wait(_sleep, _wait, _state) -# define compat_finish_wait(_sleep, _wait, _state) \ - finish_wait(_sleep, _wait) - -#endif /* #ifndef DEFINE_WAIT */ - -#endif /* __COMPAT_WAIT_H__ */ diff --git a/open-vm-tools/modules/linux/shared/vmci_kernel_if.h b/open-vm-tools/modules/linux/shared/vmci_kernel_if.h index ae0fe0f17..74e443368 100644 --- a/open-vm-tools/modules/linux/shared/vmci_kernel_if.h +++ b/open-vm-tools/modules/linux/shared/vmci_kernel_if.h @@ -37,8 +37,8 @@ #endif #if defined(linux) && !defined(VMKERNEL) +# include # include "compat_version.h" -# include "compat_wait.h" # include "compat_spinlock.h" # include "compat_semaphore.h" #endif // linux diff --git a/open-vm-tools/modules/linux/vmci/vmciKernelIf.c b/open-vm-tools/modules/linux/vmci/vmciKernelIf.c index 0589b795d..1fdcced63 100644 --- a/open-vm-tools/modules/linux/vmci/vmciKernelIf.c +++ b/open-vm-tools/modules/linux/vmci/vmciKernelIf.c @@ -37,11 +37,16 @@ #define EXPORT_SYMTAB #define __NO_VERSION__ -#include "compat_module.h" +#include /* For vmalloc_to_page() and get_user_pages()*/ +#include /* For page_cache_release() */ +#include /* For memcpy_{to,from}iovec(). */ +#include +#include + +#include "compat_module.h" #include "compat_version.h" #include "compat_sched.h" -#include "compat_wait.h" #include "compat_workqueue.h" #include "compat_interrupt.h" #include "compat_spinlock.h" @@ -51,10 +56,6 @@ #include "compat_mm.h" #include "compat_highmem.h" #include "vm_basic_types.h" -#include -#include /* For vmalloc_to_page() and get_user_pages()*/ -#include /* For memcpy_{to,from}iovec(). */ -#include /* For page_cache_release() */ #include "vm_assert.h" #include "vmci_kernel_if.h" #ifndef VMX86_TOOLS diff --git a/open-vm-tools/modules/linux/vmci/vmciUtil.c b/open-vm-tools/modules/linux/vmci/vmciUtil.c index f6620abd8..7fb8d7c6d 100644 --- a/open-vm-tools/modules/linux/vmci/vmciUtil.c +++ b/open-vm-tools/modules/linux/vmci/vmciUtil.c @@ -28,11 +28,9 @@ # define EXPORT_SYMTAB -# include # include # include "compat_kernel.h" # include "compat_slab.h" -# include "compat_wait.h" # include "compat_interrupt.h" #elif defined(_WIN32) # ifndef WINNT_DDK diff --git a/open-vm-tools/modules/linux/vmci/vmci_drv.c b/open-vm-tools/modules/linux/vmci/vmci_drv.c index a3d4b5c51..cd85a16ea 100644 --- a/open-vm-tools/modules/linux/vmci/vmci_drv.c +++ b/open-vm-tools/modules/linux/vmci/vmci_drv.c @@ -25,11 +25,11 @@ #include "driver-config.h" #include +#include #include "compat_kernel.h" #include "compat_module.h" #include "compat_pci.h" -#include "compat_wait.h" #include "compat_init.h" #include "compat_ioport.h" #include "compat_interrupt.h" diff --git a/open-vm-tools/modules/linux/vmhgfs/request.h b/open-vm-tools/modules/linux/vmhgfs/request.h index 3eae8389e..055f857d9 100644 --- a/open-vm-tools/modules/linux/vmhgfs/request.h +++ b/open-vm-tools/modules/linux/vmhgfs/request.h @@ -29,10 +29,11 @@ /* Must come before any kernel header file. */ #include "driver-config.h" +#include #include +#include #include "compat_sched.h" #include "compat_spinlock.h" -#include "compat_wait.h" #include "hgfs.h" /* For common HGFS definitions. */ #include "hgfsTransport.h" diff --git a/open-vm-tools/modules/linux/vsock/linux/af_vsock.c b/open-vm-tools/modules/linux/vsock/linux/af_vsock.c index 7968931fe..9ef5d2f86 100644 --- a/open-vm-tools/modules/linux/vsock/linux/af_vsock.c +++ b/open-vm-tools/modules/linux/vsock/linux/af_vsock.c @@ -105,6 +105,7 @@ #include #include #include +#include #include #if defined(__x86_64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12) # include @@ -117,7 +118,6 @@ sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); #include "compat_kernel.h" #include "compat_init.h" #include "compat_sock.h" -#include "compat_wait.h" #include "compat_version.h" #include "compat_workqueue.h" #include "compat_mutex.h" @@ -3385,7 +3385,7 @@ VSockVmciStreamConnect(struct socket *sock, // IN struct sockaddr_vm *remoteAddr; long timeout; Bool oldPktProto = FALSE; - COMPAT_DEFINE_WAIT(wait); + DEFINE_WAIT(wait); err = 0; sk = sock->sk; @@ -3480,7 +3480,7 @@ VSockVmciStreamConnect(struct socket *sock, // IN * a notification of an error. */ timeout = sock_sndtimeo(sk, flags & O_NONBLOCK); - compat_init_prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); + prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); while (sk->sk_state != SS_CONNECTED && sk->sk_err == 0) { if (timeout == 0) { @@ -3503,7 +3503,7 @@ VSockVmciStreamConnect(struct socket *sock, // IN goto outWaitError; } - compat_cont_prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); + prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); } if (sk->sk_err) { @@ -3515,7 +3515,7 @@ VSockVmciStreamConnect(struct socket *sock, // IN } outWait: - compat_finish_wait(sk_sleep(sk), &wait, TASK_RUNNING); + finish_wait(sk_sleep(sk), &wait); out: release_sock(sk); return err; @@ -3553,7 +3553,7 @@ VSockVmciAccept(struct socket *sock, // IN struct sock *connected; VSockVmciSock *vconnected; long timeout; - COMPAT_DEFINE_WAIT(wait); + DEFINE_WAIT(wait); err = 0; listener = sock->sk; @@ -3575,7 +3575,7 @@ VSockVmciAccept(struct socket *sock, // IN * upon connection establishment. */ timeout = sock_sndtimeo(listener, flags & O_NONBLOCK); - compat_init_prepare_to_wait(sk_sleep(listener), &wait, TASK_INTERRUPTIBLE); + prepare_to_wait(sk_sleep(listener), &wait, TASK_INTERRUPTIBLE); while ((connected = VSockVmciDequeueAccept(listener)) == NULL && listener->sk_err == 0) { @@ -3591,7 +3591,7 @@ VSockVmciAccept(struct socket *sock, // IN goto outWait; } - compat_cont_prepare_to_wait(sk_sleep(listener), &wait, TASK_INTERRUPTIBLE); + prepare_to_wait(sk_sleep(listener), &wait, TASK_INTERRUPTIBLE); } if (listener->sk_err) { @@ -3625,7 +3625,7 @@ VSockVmciAccept(struct socket *sock, // IN } outWait: - compat_finish_wait(sk_sleep(listener), &wait, TASK_RUNNING); + finish_wait(sk_sleep(listener), &wait); out: release_sock(listener); return err; @@ -4275,7 +4275,7 @@ VSockVmciStreamSendmsg(struct kiocb *kiocb, // UNUSED int err; VSockVmciSendNotifyData sendData; - COMPAT_DEFINE_WAIT(wait); + DEFINE_WAIT(wait); sk = sock->sk; vsk = vsock_sk(sk); @@ -4322,7 +4322,7 @@ VSockVmciStreamSendmsg(struct kiocb *kiocb, // UNUSED goto out; } - compat_init_prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); + prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); while (totalWritten < len) { Bool sentWrote; @@ -4360,8 +4360,7 @@ VSockVmciStreamSendmsg(struct kiocb *kiocb, // UNUSED goto outWait; } - compat_cont_prepare_to_wait(sk_sleep(sk), - &wait, TASK_INTERRUPTIBLE); + prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); } /* @@ -4412,7 +4411,7 @@ outWait: if (totalWritten > 0) { err = totalWritten; } - compat_finish_wait(sk_sleep(sk), &wait, TASK_RUNNING); + finish_wait(sk_sleep(sk), &wait); out: release_sock(sk); return err; @@ -4543,7 +4542,7 @@ VSockVmciStreamRecvmsg(struct kiocb *kiocb, // UNUSED VSockVmciRecvNotifyData recvData; - COMPAT_DEFINE_WAIT(wait); + DEFINE_WAIT(wait); sk = sock->sk; vsk = vsock_sk(sk); @@ -4598,7 +4597,7 @@ VSockVmciStreamRecvmsg(struct kiocb *kiocb, // UNUSED goto out; } - compat_init_prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); + prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); while ((ready = VSockVmciStreamHasData(vsk)) < target && sk->sk_err == 0 && @@ -4638,7 +4637,7 @@ VSockVmciStreamRecvmsg(struct kiocb *kiocb, // UNUSED goto outWait; } - compat_cont_prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); + prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); } if (sk->sk_err) { @@ -4702,7 +4701,7 @@ VSockVmciStreamRecvmsg(struct kiocb *kiocb, // UNUSED err = copied; outWait: - compat_finish_wait(sk_sleep(sk), &wait, TASK_RUNNING); + finish_wait(sk_sleep(sk), &wait); out: release_sock(sk); return err;