common.c (62910554656cdcd6b6f84a5154c4155aae4ca231) | common.c (aa395145165cb06a0d0885221bbe0ce4a564391d) |
---|---|
1/* net/atm/common.c - ATM sockets (common part for PVC and SVC) */ 2 3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ 4 5#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__ 6 7#include <linux/module.h> 8#include <linux/kmod.h> --- 78 unchanged lines hidden (view full) --- 87 printk(KERN_DEBUG "%s: wmem leakage (%d bytes) detected.\n", 88 __func__, atomic_read(&sk->sk_wmem_alloc)); 89} 90 91static void vcc_def_wakeup(struct sock *sk) 92{ 93 read_lock(&sk->sk_callback_lock); 94 if (sk_has_sleeper(sk)) | 1/* net/atm/common.c - ATM sockets (common part for PVC and SVC) */ 2 3/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */ 4 5#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__ 6 7#include <linux/module.h> 8#include <linux/kmod.h> --- 78 unchanged lines hidden (view full) --- 87 printk(KERN_DEBUG "%s: wmem leakage (%d bytes) detected.\n", 88 __func__, atomic_read(&sk->sk_wmem_alloc)); 89} 90 91static void vcc_def_wakeup(struct sock *sk) 92{ 93 read_lock(&sk->sk_callback_lock); 94 if (sk_has_sleeper(sk)) |
95 wake_up(sk->sk_sleep); | 95 wake_up(sk_sleep(sk)); |
96 read_unlock(&sk->sk_callback_lock); 97} 98 99static inline int vcc_writable(struct sock *sk) 100{ 101 struct atm_vcc *vcc = atm_sk(sk); 102 103 return (vcc->qos.txtp.max_sdu + 104 atomic_read(&sk->sk_wmem_alloc)) <= sk->sk_sndbuf; 105} 106 107static void vcc_write_space(struct sock *sk) 108{ 109 read_lock(&sk->sk_callback_lock); 110 111 if (vcc_writable(sk)) { 112 if (sk_has_sleeper(sk)) | 96 read_unlock(&sk->sk_callback_lock); 97} 98 99static inline int vcc_writable(struct sock *sk) 100{ 101 struct atm_vcc *vcc = atm_sk(sk); 102 103 return (vcc->qos.txtp.max_sdu + 104 atomic_read(&sk->sk_wmem_alloc)) <= sk->sk_sndbuf; 105} 106 107static void vcc_write_space(struct sock *sk) 108{ 109 read_lock(&sk->sk_callback_lock); 110 111 if (vcc_writable(sk)) { 112 if (sk_has_sleeper(sk)) |
113 wake_up_interruptible(sk->sk_sleep); | 113 wake_up_interruptible(sk_sleep(sk)); |
114 115 sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); 116 } 117 118 read_unlock(&sk->sk_callback_lock); 119} 120 121static struct proto vcc_proto = { --- 422 unchanged lines hidden (view full) --- 544 goto out; 545 } 546 if (size < 0 || size > vcc->qos.txtp.max_sdu) { 547 error = -EMSGSIZE; 548 goto out; 549 } 550 551 eff = (size+3) & ~3; /* align to word boundary */ | 114 115 sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); 116 } 117 118 read_unlock(&sk->sk_callback_lock); 119} 120 121static struct proto vcc_proto = { --- 422 unchanged lines hidden (view full) --- 544 goto out; 545 } 546 if (size < 0 || size > vcc->qos.txtp.max_sdu) { 547 error = -EMSGSIZE; 548 goto out; 549 } 550 551 eff = (size+3) & ~3; /* align to word boundary */ |
552 prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 552 prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
553 error = 0; 554 while (!(skb = alloc_tx(vcc, eff))) { 555 if (m->msg_flags & MSG_DONTWAIT) { 556 error = -EAGAIN; 557 break; 558 } 559 schedule(); 560 if (signal_pending(current)) { 561 error = -ERESTARTSYS; 562 break; 563 } 564 if (test_bit(ATM_VF_RELEASED, &vcc->flags) || 565 test_bit(ATM_VF_CLOSE, &vcc->flags) || 566 !test_bit(ATM_VF_READY, &vcc->flags)) { 567 error = -EPIPE; 568 send_sig(SIGPIPE, current, 0); 569 break; 570 } | 553 error = 0; 554 while (!(skb = alloc_tx(vcc, eff))) { 555 if (m->msg_flags & MSG_DONTWAIT) { 556 error = -EAGAIN; 557 break; 558 } 559 schedule(); 560 if (signal_pending(current)) { 561 error = -ERESTARTSYS; 562 break; 563 } 564 if (test_bit(ATM_VF_RELEASED, &vcc->flags) || 565 test_bit(ATM_VF_CLOSE, &vcc->flags) || 566 !test_bit(ATM_VF_READY, &vcc->flags)) { 567 error = -EPIPE; 568 send_sig(SIGPIPE, current, 0); 569 break; 570 } |
571 prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); | 571 prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); |
572 } | 572 } |
573 finish_wait(sk->sk_sleep, &wait); | 573 finish_wait(sk_sleep(sk), &wait); |
574 if (error) 575 goto out; 576 skb->dev = NULL; /* for paths shared with net_device interfaces */ 577 ATM_SKB(skb)->atm_options = vcc->atm_options; 578 if (copy_from_user(skb_put(skb, size), buff, size)) { 579 kfree_skb(skb); 580 error = -EFAULT; 581 goto out; --- 8 unchanged lines hidden (view full) --- 590} 591 592unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait) 593{ 594 struct sock *sk = sock->sk; 595 struct atm_vcc *vcc; 596 unsigned int mask; 597 | 574 if (error) 575 goto out; 576 skb->dev = NULL; /* for paths shared with net_device interfaces */ 577 ATM_SKB(skb)->atm_options = vcc->atm_options; 578 if (copy_from_user(skb_put(skb, size), buff, size)) { 579 kfree_skb(skb); 580 error = -EFAULT; 581 goto out; --- 8 unchanged lines hidden (view full) --- 590} 591 592unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait) 593{ 594 struct sock *sk = sock->sk; 595 struct atm_vcc *vcc; 596 unsigned int mask; 597 |
598 sock_poll_wait(file, sk->sk_sleep, wait); | 598 sock_poll_wait(file, sk_sleep(sk), wait); |
599 mask = 0; 600 601 vcc = ATM_SD(sock); 602 603 /* exceptional events */ 604 if (sk->sk_err) 605 mask = POLLERR; 606 --- 227 unchanged lines hidden --- | 599 mask = 0; 600 601 vcc = ATM_SD(sock); 602 603 /* exceptional events */ 604 if (sk->sk_err) 605 mask = POLLERR; 606 --- 227 unchanged lines hidden --- |