[NET]: Fix sparse warnings
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / unix / af_unix.c
index c478fc8db7768428580d23381856fa53fa31add2..41feca3bef86346f3890f8c428c795ff7316abf5 100644 (file)
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
 #include <net/sock.h>
-#include <linux/tcp.h>
+#include <net/tcp_states.h>
 #include <net/af_unix.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
@@ -302,7 +302,7 @@ static void unix_write_space(struct sock *sk)
  * may receive messages only from that peer. */
 static void unix_dgram_disconnected(struct sock *sk, struct sock *other)
 {
-       if (skb_queue_len(&sk->sk_receive_queue)) {
+       if (!skb_queue_empty(&sk->sk_receive_queue)) {
                skb_queue_purge(&sk->sk_receive_queue);
                wake_up_interruptible_all(&unix_sk(sk)->peer_wait);
 
@@ -770,33 +770,12 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
                err = path_lookup(sunaddr->sun_path, LOOKUP_PARENT, &nd);
                if (err)
                        goto out_mknod_parent;
-               /*
-                * Yucky last component or no last component at all?
-                * (foo/., foo/.., /////)
-                */
-               err = -EEXIST;
-               if (nd.last_type != LAST_NORM)
-                       goto out_mknod;
-               /*
-                * Lock the directory.
-                */
-               down(&nd.dentry->d_inode->i_sem);
-               /*
-                * Do the final lookup.
-                */
-               dentry = lookup_hash(&nd.last, nd.dentry);
+
+               dentry = lookup_create(&nd, 0);
                err = PTR_ERR(dentry);
                if (IS_ERR(dentry))
                        goto out_mknod_unlock;
-               err = -ENOENT;
-               /*
-                * Special case - lookup gave negative, but... we had foo/bar/
-                * From the vfs_mknod() POV we just have a negative dentry -
-                * all is fine. Let's be bastards - you had / on the end, you've
-                * been asking for (non-existent) directory. -ENOENT for you.
-                */
-               if (nd.last.name[nd.last.len] && !dentry->d_inode)
-                       goto out_mknod_dput;
+
                /*
                 * All right, let's create it.
                 */
@@ -845,7 +824,6 @@ out_mknod_dput:
        dput(dentry);
 out_mknod_unlock:
        up(&nd.dentry->d_inode->i_sem);
-out_mknod:
        path_release(&nd);
 out_mknod_parent:
        if (err==-EEXIST)
@@ -1641,7 +1619,7 @@ static long unix_stream_data_wait(struct sock * sk, long timeo)
        for (;;) {
                prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
 
-               if (skb_queue_len(&sk->sk_receive_queue) ||
+               if (!skb_queue_empty(&sk->sk_receive_queue) ||
                    sk->sk_err ||
                    (sk->sk_shutdown & RCV_SHUTDOWN) ||
                    signal_pending(current) ||
@@ -2048,14 +2026,6 @@ static struct net_proto_family unix_family_ops = {
        .owner  = THIS_MODULE,
 };
 
-#ifdef CONFIG_SYSCTL
-extern void unix_sysctl_register(void);
-extern void unix_sysctl_unregister(void);
-#else
-static inline void unix_sysctl_register(void) {}
-static inline void unix_sysctl_unregister(void) {}
-#endif
-
 static int __init af_unix_init(void)
 {
        int rc = -1;