Merge tag 'tty-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
[cascardo/linux.git] / drivers / staging / lustre / lustre / libcfs / linux / linux-tcpip.c
index ac3a444..a93b621 100644 (file)
@@ -35,7 +35,7 @@
  */
 #define DEBUG_SUBSYSTEM S_LNET
 
-#include <linux/libcfs/libcfs.h>
+#include "../../../include/linux/libcfs/libcfs.h"
 
 #include <linux/if.h>
 #include <linux/in.h>
 int
 libcfs_sock_ioctl(int cmd, unsigned long arg)
 {
+       mm_segment_t    oldmm = get_fs();
        struct socket  *sock;
-       int          rc;
+       int             rc;
+       struct file    *sock_filp;
 
        rc = sock_create (PF_INET, SOCK_STREAM, 0, &sock);
        if (rc != 0) {
                CERROR ("Can't create socket: %d\n", rc);
                return rc;
        }
-       rc = kernel_sock_ioctl(sock, cmd, arg);
-       sock_release(sock);
+
+       sock_filp = sock_alloc_file(sock, 0, NULL);
+       if (IS_ERR(sock_filp)) {
+               sock_release(sock);
+               rc = PTR_ERR(sock_filp);
+               goto out;
+       }
+
+       set_fs(KERNEL_DS);
+       if (sock_filp->f_op->unlocked_ioctl)
+               rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg);
+       set_fs(oldmm);
+
+       fput(sock_filp);
+out:
        return rc;
 }
 
@@ -183,8 +198,6 @@ libcfs_ipif_enumerate (char ***namesp)
                rc = -ENOMEM;
                goto out1;
        }
-       /* NULL out all names[i] */
-       memset (names, 0, nfound * sizeof(*names));
 
        for (i = 0; i < nfound; i++) {
 
@@ -532,7 +545,7 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock)
        newsock->ops = sock->ops;
 
        set_current_state(TASK_INTERRUPTIBLE);
-       add_wait_queue(cfs_sk_sleep(sock->sk), &wait);
+       add_wait_queue(sk_sleep(sock->sk), &wait);
 
        rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
        if (rc == -EAGAIN) {
@@ -541,7 +554,7 @@ libcfs_sock_accept (struct socket **newsockp, struct socket *sock)
                rc = sock->ops->accept(sock, newsock, O_NONBLOCK);
        }
 
-       remove_wait_queue(cfs_sk_sleep(sock->sk), &wait);
+       remove_wait_queue(sk_sleep(sock->sk), &wait);
        set_current_state(TASK_RUNNING);
 
        if (rc != 0)
@@ -560,7 +573,7 @@ EXPORT_SYMBOL(libcfs_sock_accept);
 void
 libcfs_sock_abort_accept (struct socket *sock)
 {
-       wake_up_all(cfs_sk_sleep(sock->sk));
+       wake_up_all(sk_sleep(sock->sk));
 }
 
 EXPORT_SYMBOL(libcfs_sock_abort_accept);