Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 9338
b: refs/heads/master
c: 54fb7f2
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Sep 22, 2005
1 parent b5bf9c6 commit a4880c2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 39 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b35bd11019ed1084a36632f1c1d936244d9cfb5b
refs/heads/master: 54fb7f25f19a4539d3ec012e410439913650dc06
65 changes: 27 additions & 38 deletions trunk/net/llc/af_llc.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ static u16 llc_ui_sap_link_no_max[256];
static struct sockaddr_llc llc_ui_addrnull;
static struct proto_ops llc_ui_ops;

static int llc_ui_wait_for_conn(struct sock *sk, int timeout);
static int llc_ui_wait_for_disc(struct sock *sk, int timeout);
static int llc_ui_wait_for_data(struct sock *sk, int timeout);
static int llc_ui_wait_for_busy_core(struct sock *sk, int timeout);
static int llc_ui_wait_for_conn(struct sock *sk, long timeout);
static int llc_ui_wait_for_disc(struct sock *sk, long timeout);
static int llc_ui_wait_for_data(struct sock *sk, long timeout);
static int llc_ui_wait_for_busy_core(struct sock *sk, long timeout);

#if 0
#define dprintk(args...) printk(KERN_DEBUG args)
Expand Down Expand Up @@ -117,7 +117,7 @@ static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock)
int rc = 0;

if (llc_data_accept_state(llc->state) || llc->p_flag) {
int timeout = sock_sndtimeo(sk, noblock);
long timeout = sock_sndtimeo(sk, noblock);

rc = llc_ui_wait_for_busy_core(sk, timeout);
}
Expand Down Expand Up @@ -428,7 +428,7 @@ static int llc_ui_connect(struct socket *sock, struct sockaddr *uaddr,
}

if (sk->sk_state == TCP_SYN_SENT) {
const int timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);
const long timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);

if (!timeo || !llc_ui_wait_for_conn(sk, timeo))
goto out;
Expand Down Expand Up @@ -488,61 +488,53 @@ static int llc_ui_listen(struct socket *sock, int backlog)
return rc;
}

static int llc_ui_wait_for_disc(struct sock *sk, int timeout)
static int llc_ui_wait_for_disc(struct sock *sk, long timeout)
{
DEFINE_WAIT(wait);
int rc = 0;

prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
while (sk->sk_state != TCP_CLOSE) {
release_sock(sk);
timeout = schedule_timeout(timeout);
lock_sock(sk);
while (1) {
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
if (sk_wait_event(sk, &timeout, sk->sk_state == TCP_CLOSE))
break;
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
rc = -EAGAIN;
if (!timeout)
break;
rc = 0;
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
}
finish_wait(sk->sk_sleep, &wait);
return rc;
}

static int llc_ui_wait_for_conn(struct sock *sk, int timeout)
static int llc_ui_wait_for_conn(struct sock *sk, long timeout)
{
DEFINE_WAIT(wait);

prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);

while (sk->sk_state == TCP_SYN_SENT) {
release_sock(sk);
timeout = schedule_timeout(timeout);
lock_sock(sk);
while (1) {
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
if (sk_wait_event(sk, &timeout, sk->sk_state != TCP_SYN_SENT))
break;
if (signal_pending(current) || !timeout)
break;
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
}
finish_wait(sk->sk_sleep, &wait);
return timeout;
}

static int llc_ui_wait_for_data(struct sock *sk, int timeout)
static int llc_ui_wait_for_data(struct sock *sk, long timeout)
{
DEFINE_WAIT(wait);
int rc = 0;

for (;;) {
while (1) {
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
if (sk->sk_shutdown & RCV_SHUTDOWN)
break;
if (!skb_queue_empty(&sk->sk_receive_queue))
if (sk_wait_event(sk, &timeout,
(sk->sk_shutdown & RCV_SHUTDOWN) ||
(!skb_queue_empty(&sk->sk_receive_queue))))
break;
release_sock(sk);
timeout = schedule_timeout(timeout);
lock_sock(sk);
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
Expand All @@ -555,23 +547,20 @@ static int llc_ui_wait_for_data(struct sock *sk, int timeout)
return rc;
}

static int llc_ui_wait_for_busy_core(struct sock *sk, int timeout)
static int llc_ui_wait_for_busy_core(struct sock *sk, long timeout)
{
DEFINE_WAIT(wait);
struct llc_sock *llc = llc_sk(sk);
int rc;

for (;;) {
while (1) {
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
rc = -ENOTCONN;
if (sk->sk_shutdown & RCV_SHUTDOWN)
break;
rc = 0;
if (!llc_data_accept_state(llc->state) && !llc->p_flag)
if (sk_wait_event(sk, &timeout,
(sk->sk_shutdown & RCV_SHUTDOWN) ||
(!llc_data_accept_state(llc->state) &&
!llc->p_flag)))
break;
release_sock(sk);
timeout = schedule_timeout(timeout);
lock_sock(sk);
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
Expand Down

0 comments on commit a4880c2

Please sign in to comment.