]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
VSOCK: fix compile warnings on recent kernels
authorVMware, Inc <>
Mon, 22 Mar 2010 22:19:01 +0000 (15:19 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 22 Mar 2010 22:19:01 +0000 (15:19 -0700)
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 <mvanzin@vmware.com>
open-vm-tools/modules/linux/vsock/linux/af_vsock.c

index 32000128ee5666ed9c308fde1c4ddfd1562d9f06..c0743e8be3e8f43b987947370f4e901e5a2730b3 100644 (file)
@@ -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;