]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
tipc: save sock structure pointer instead of void pointer to tipc_port
authorYing Xue <ying.xue@windriver.com>
Mon, 17 Jun 2013 14:54:46 +0000 (10:54 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Jun 2013 22:53:01 +0000 (15:53 -0700)
Directly save sock structure pointer instead of void pointer to avoid
unnecessary cast conversions.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/port.c
net/tipc/port.h
net/tipc/socket.c

index 84b2a574f16155db709f7fc5ab750fd171ce23c6..0bb185a3ed4a64aee30e1429d37f073a21e07277 100644 (file)
@@ -206,7 +206,7 @@ void tipc_port_recv_mcast(struct sk_buff *buf, struct tipc_port_list *dp)
  *
  * Returns pointer to (locked) TIPC port, or NULL if unable to create it
  */
-struct tipc_port *tipc_createport(void *usr_handle,
+struct tipc_port *tipc_createport(struct sock *sk,
                        u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
                        void (*wakeup)(struct tipc_port *),
                        const u32 importance)
@@ -227,7 +227,7 @@ struct tipc_port *tipc_createport(void *usr_handle,
                return NULL;
        }
 
-       p_ptr->usr_handle = usr_handle;
+       p_ptr->sk = sk;
        p_ptr->max_pkt = MAX_PKT_DEFAULT;
        p_ptr->ref = ref;
        INIT_LIST_HEAD(&p_ptr->wait_list);
index 45838826f2f8e7751604ea047f6778ddcf541870..241f529db942313ae8462e34bd2429835888347e 100644 (file)
@@ -48,7 +48,7 @@
 
 /**
  * struct tipc_port - TIPC port structure
- * @usr_handle: pointer to additional user-defined information about port
+ * @sk: pointer to socket handle
  * @lock: pointer to spinlock for controlling access to port
  * @connected: non-zero if port is currently connected to a peer port
  * @conn_type: TIPC type used when connection was established
@@ -74,7 +74,7 @@
  * @subscription: "node down" subscription used to terminate failed connections
  */
 struct tipc_port {
-       void *usr_handle;
+       struct sock *sk;
        spinlock_t *lock;
        int connected;
        u32 conn_type;
@@ -106,7 +106,7 @@ struct tipc_port_list;
 /*
  * TIPC port manipulation routines
  */
-struct tipc_port *tipc_createport(void *usr_handle,
+struct tipc_port *tipc_createport(struct sock *sk,
                u32 (*dispatcher)(struct tipc_port *, struct sk_buff *),
                void (*wakeup)(struct tipc_port *), const u32 importance);
 
index 67f4e1fbf5a17f8e051e4262d7814b0ac47ff568..14ed54e961b6b91e8cab5d08ac85cb6c9bd0fcd1 100644 (file)
@@ -1406,7 +1406,7 @@ static int backlog_rcv(struct sock *sk, struct sk_buff *buf)
  */
 static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
 {
-       struct sock *sk = (struct sock *)tport->usr_handle;
+       struct sock *sk = tport->sk;
        u32 res;
 
        /*
@@ -1437,7 +1437,7 @@ static u32 dispatch(struct tipc_port *tport, struct sk_buff *buf)
  */
 static void wakeupdispatch(struct tipc_port *tport)
 {
-       struct sock *sk = (struct sock *)tport->usr_handle;
+       struct sock *sk = tport->sk;
 
        sk->sk_write_space(sk);
 }