aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/af_decnet.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-05-28 19:43:52 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-28 19:43:52 -0400
commitbec571ec762a4cf855ad4446f833086fc154b60e (patch)
tree4ff3f63d60bd6a7735caebedf6e27c3e3a74efe4 /net/decnet/af_decnet.c
parentb6211ae7f2e56837c6a4849316396d1535606e90 (diff)
decnet: Use SKB queue and list helpers instead of doing it by-hand.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/af_decnet.c')
-rw-r--r--net/decnet/af_decnet.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
index 9647d911f916..bccb3887773e 100644
--- a/net/decnet/af_decnet.c
+++ b/net/decnet/af_decnet.c
@@ -1250,14 +1250,8 @@ static int dn_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
1250 if (skb) { 1250 if (skb) {
1251 amount = skb->len; 1251 amount = skb->len;
1252 } else { 1252 } else {
1253 skb = sk->sk_receive_queue.next; 1253 skb_queue_walk(&sk->sk_receive_queue, skb)
1254 for (;;) {
1255 if (skb ==
1256 (struct sk_buff *)&sk->sk_receive_queue)
1257 break;
1258 amount += skb->len; 1254 amount += skb->len;
1259 skb = skb->next;
1260 }
1261 } 1255 }
1262 release_sock(sk); 1256 release_sock(sk);
1263 err = put_user(amount, (int __user *)arg); 1257 err = put_user(amount, (int __user *)arg);
@@ -1644,13 +1638,13 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us
1644 1638
1645static int dn_data_ready(struct sock *sk, struct sk_buff_head *q, int flags, int target) 1639static int dn_data_ready(struct sock *sk, struct sk_buff_head *q, int flags, int target)
1646{ 1640{
1647 struct sk_buff *skb = q->next; 1641 struct sk_buff *skb;
1648 int len = 0; 1642 int len = 0;
1649 1643
1650 if (flags & MSG_OOB) 1644 if (flags & MSG_OOB)
1651 return !skb_queue_empty(q) ? 1 : 0; 1645 return !skb_queue_empty(q) ? 1 : 0;
1652 1646
1653 while(skb != (struct sk_buff *)q) { 1647 skb_queue_walk(q, skb) {
1654 struct dn_skb_cb *cb = DN_SKB_CB(skb); 1648 struct dn_skb_cb *cb = DN_SKB_CB(skb);
1655 len += skb->len; 1649 len += skb->len;
1656 1650
@@ -1666,8 +1660,6 @@ static int dn_data_ready(struct sock *sk, struct sk_buff_head *q, int flags, int
1666 /* minimum data length for read exceeded */ 1660 /* minimum data length for read exceeded */
1667 if (len >= target) 1661 if (len >= target)
1668 return 1; 1662 return 1;
1669
1670 skb = skb->next;
1671 } 1663 }
1672 1664
1673 return 0; 1665 return 0;
@@ -1683,7 +1675,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
1683 size_t target = size > 1 ? 1 : 0; 1675 size_t target = size > 1 ? 1 : 0;
1684 size_t copied = 0; 1676 size_t copied = 0;
1685 int rv = 0; 1677 int rv = 0;
1686 struct sk_buff *skb, *nskb; 1678 struct sk_buff *skb, *n;
1687 struct dn_skb_cb *cb = NULL; 1679 struct dn_skb_cb *cb = NULL;
1688 unsigned char eor = 0; 1680 unsigned char eor = 0;
1689 long timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); 1681 long timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
@@ -1758,7 +1750,7 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
1758 finish_wait(sk->sk_sleep, &wait); 1750 finish_wait(sk->sk_sleep, &wait);
1759 } 1751 }
1760 1752
1761 for(skb = queue->next; skb != (struct sk_buff *)queue; skb = nskb) { 1753 skb_queue_walk_safe(queue, skb, n) {
1762 unsigned int chunk = skb->len; 1754 unsigned int chunk = skb->len;
1763 cb = DN_SKB_CB(skb); 1755 cb = DN_SKB_CB(skb);
1764 1756
@@ -1775,7 +1767,6 @@ static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,
1775 skb_pull(skb, chunk); 1767 skb_pull(skb, chunk);
1776 1768
1777 eor = cb->nsp_flags & 0x40; 1769 eor = cb->nsp_flags & 0x40;
1778 nskb = skb->next;
1779 1770
1780 if (skb->len == 0) { 1771 if (skb->len == 0) {
1781 skb_unlink(skb, queue); 1772 skb_unlink(skb, queue);