Commit ba8aebe9 authored by Parthasarathy Bhuvaragan's avatar Parthasarathy Bhuvaragan Committed by David S. Miller

tipc: rename struct tipc_skb_cb member handle to bytes_read

In this commit, we rename handle to bytes_read indicating the
purpose of the member.
Signed-off-by: default avatarParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cb5da847
...@@ -95,7 +95,7 @@ struct plist; ...@@ -95,7 +95,7 @@ struct plist;
#define TIPC_MEDIA_INFO_OFFSET 5 #define TIPC_MEDIA_INFO_OFFSET 5
struct tipc_skb_cb { struct tipc_skb_cb {
void *handle; u32 bytes_read;
struct sk_buff *tail; struct sk_buff *tail;
bool validated; bool validated;
bool wakeup_pending; bool wakeup_pending;
......
...@@ -465,7 +465,7 @@ static int tipc_release(struct socket *sock) ...@@ -465,7 +465,7 @@ static int tipc_release(struct socket *sock)
skb = __skb_dequeue(&sk->sk_receive_queue); skb = __skb_dequeue(&sk->sk_receive_queue);
if (skb == NULL) if (skb == NULL)
break; break;
if (TIPC_SKB_CB(skb)->handle != NULL) if (TIPC_SKB_CB(skb)->bytes_read)
kfree_skb(skb); kfree_skb(skb);
else { else {
if ((sock->state == SS_CONNECTING) || if ((sock->state == SS_CONNECTING) ||
...@@ -1435,7 +1435,7 @@ static int tipc_recv_stream(struct socket *sock, struct msghdr *m, ...@@ -1435,7 +1435,7 @@ static int tipc_recv_stream(struct socket *sock, struct msghdr *m,
struct tipc_msg *msg; struct tipc_msg *msg;
long timeo; long timeo;
unsigned int sz; unsigned int sz;
int sz_to_copy, target, needed; int target;
int sz_copied = 0; int sz_copied = 0;
u32 err; u32 err;
int res = 0, hlen; int res = 0, hlen;
...@@ -1483,11 +1483,13 @@ static int tipc_recv_stream(struct socket *sock, struct msghdr *m, ...@@ -1483,11 +1483,13 @@ static int tipc_recv_stream(struct socket *sock, struct msghdr *m,
/* Capture message data (if valid) & compute return value (always) */ /* Capture message data (if valid) & compute return value (always) */
if (!err) { if (!err) {
u32 offset = (u32)(unsigned long)(TIPC_SKB_CB(buf)->handle); u32 offset = TIPC_SKB_CB(buf)->bytes_read;
u32 needed;
int sz_to_copy;
sz -= offset; sz -= offset;
needed = (buf_len - sz_copied); needed = (buf_len - sz_copied);
sz_to_copy = (sz <= needed) ? sz : needed; sz_to_copy = min(sz, needed);
res = skb_copy_datagram_msg(buf, hlen + offset, m, sz_to_copy); res = skb_copy_datagram_msg(buf, hlen + offset, m, sz_to_copy);
if (res) if (res)
...@@ -1497,8 +1499,8 @@ static int tipc_recv_stream(struct socket *sock, struct msghdr *m, ...@@ -1497,8 +1499,8 @@ static int tipc_recv_stream(struct socket *sock, struct msghdr *m,
if (sz_to_copy < sz) { if (sz_to_copy < sz) {
if (!(flags & MSG_PEEK)) if (!(flags & MSG_PEEK))
TIPC_SKB_CB(buf)->handle = TIPC_SKB_CB(buf)->bytes_read =
(void *)(unsigned long)(offset + sz_to_copy); offset + sz_to_copy;
goto exit; goto exit;
} }
} else { } else {
...@@ -1742,7 +1744,7 @@ static bool filter_rcv(struct sock *sk, struct sk_buff *skb, ...@@ -1742,7 +1744,7 @@ static bool filter_rcv(struct sock *sk, struct sk_buff *skb,
} }
/* Enqueue message */ /* Enqueue message */
TIPC_SKB_CB(skb)->handle = NULL; TIPC_SKB_CB(skb)->bytes_read = 0;
__skb_queue_tail(&sk->sk_receive_queue, skb); __skb_queue_tail(&sk->sk_receive_queue, skb);
skb_set_owner_r(skb, sk); skb_set_owner_r(skb, sk);
...@@ -2177,7 +2179,7 @@ static int tipc_shutdown(struct socket *sock, int how) ...@@ -2177,7 +2179,7 @@ static int tipc_shutdown(struct socket *sock, int how)
/* Disconnect and send a 'FIN+' or 'FIN-' message to peer */ /* Disconnect and send a 'FIN+' or 'FIN-' message to peer */
skb = __skb_dequeue(&sk->sk_receive_queue); skb = __skb_dequeue(&sk->sk_receive_queue);
if (skb) { if (skb) {
if (TIPC_SKB_CB(skb)->handle != NULL) { if (TIPC_SKB_CB(skb)->bytes_read) {
kfree_skb(skb); kfree_skb(skb);
goto restart; goto restart;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment