From: VMware, Inc <> Date: Mon, 22 Mar 2010 22:19:01 +0000 (-0700) Subject: VSOCK: fix compile warnings on recent kernels X-Git-Tag: 2010.03.20-243334~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9c62cafba3cb398d7fd3c3f95ee34a46ecd8fb9;p=thirdparty%2Fopen-vm-tools.git VSOCK: fix compile warnings on recent kernels During 2.6.33 merge window net_proto_ops->create() method was changed - a new 'kern' field, signalling whether socket is being created by kernel or userspace application, was added to it. During 2.6.34 merge window type optsize of argument to proto_ops->setsockopt() method was changed from 'int' to 'unsigned int'. Here we are trying to cope with the changes. Signed-off-by: Marcelo Vanzin --- 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 32000128e..c0743e8be 100644 --- a/open-vm-tools/modules/linux/vsock/linux/af_vsock.c +++ b/open-vm-tools/modules/linux/vsock/linux/af_vsock.c @@ -209,8 +209,16 @@ static unsigned int VSockVmciPoll(struct file *file, static int VSockVmciListen(struct socket *sock, int backlog); static int VSockVmciShutdown(struct socket *sock, int mode); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) +typedef int VSockSetsockoptLenType; +#else +typedef unsigned int VSockSetsockoptLenType; +#endif static int VSockVmciStreamSetsockopt(struct socket *sock, int level, int optname, - char __user *optval, int optlen); + char __user *optval, + VSockSetsockoptLenType optlen); + static int VSockVmciStreamGetsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user * optlen); @@ -223,11 +231,16 @@ static int VSockVmciStreamSendmsg(struct kiocb *kiocb, static int VSockVmciStreamRecvmsg(struct kiocb *kiocb, struct socket *sock, struct msghdr *msg, size_t len, int flags); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) -static int VSockVmciCreate(struct socket *sock, int protocol); -#else -static int VSockVmciCreate(struct net *net, struct socket *sock, int protocol); +static int VSockVmciCreate( +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + struct net *net, #endif + struct socket *sock, int protocol +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) + , int kern +#endif + ); + /* * Device operations. @@ -4080,11 +4093,11 @@ out: */ int -VSockVmciStreamSetsockopt(struct socket *sock, // IN/OUT - int level, // IN - int optname, // IN - char __user *optval, // IN - int optlen) // IN +VSockVmciStreamSetsockopt(struct socket *sock, // IN/OUT + int level, // IN + int optname, // IN + char __user *optval, // IN + VSockSetsockoptLenType optlen) // IN { int err; struct sock *sk; @@ -4708,16 +4721,17 @@ out: *---------------------------------------------------------------------------- */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) static int -VSockVmciCreate(struct socket *sock, // IN - int protocol) // IN -#else -static int -VSockVmciCreate(struct net *net, // IN +VSockVmciCreate( +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) + struct net *net, // IN +#endif struct socket *sock, // IN - int protocol) // IN + int protocol // IN +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) + , int kern // IN #endif + ) { if (!sock) { return -EINVAL;