patch-2.1.9 linux/net/netrom/nr_timer.c

Next file: linux/net/netrom/sysctl_net_netrom.c
Previous file: linux/net/netrom/nr_subr.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.8/linux/net/netrom/nr_timer.c linux/net/netrom/nr_timer.c
@@ -1,5 +1,5 @@
 /*
- *	NET/ROM release 003
+ *	NET/ROM release 004
  *
  *	This is ALPHA test software. This code may break your machine, randomly fail to work with new 
  *	releases, misbehave and/or generally screw up. It might even work. 
@@ -17,7 +17,7 @@
  */
 
 #include <linux/config.h>
-#ifdef CONFIG_NETROM
+#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
@@ -87,7 +87,7 @@
 {
 	struct sock *sk = (struct sock *)param;
 
-	switch (sk->nr->state) {
+	switch (sk->protinfo.nr->state) {
 		case NR_STATE_0:
 			/* Magic here: If we listen() and a new link dies before it
 			   is accepted() it isn't 'dead' so doesn't get removed. */
@@ -102,11 +102,11 @@
 			/*
 			 * Check for the state of the receive buffer.
 			 */
-			if (sk->rmem_alloc < (sk->rcvbuf / 2) && (sk->nr->condition & OWN_RX_BUSY_CONDITION)) {
-				sk->nr->condition &= ~OWN_RX_BUSY_CONDITION;
+			if (sk->rmem_alloc < (sk->rcvbuf / 2) && (sk->protinfo.nr->condition & OWN_RX_BUSY_CONDITION)) {
+				sk->protinfo.nr->condition &= ~OWN_RX_BUSY_CONDITION;
 				nr_write_internal(sk, NR_INFOACK);
-				sk->nr->condition &= ~ACK_PENDING_CONDITION;
-				sk->nr->vl = sk->nr->vr;
+				sk->protinfo.nr->condition &= ~ACK_PENDING_CONDITION;
+				sk->protinfo.nr->vl         = sk->protinfo.nr->vr;
 				break;
 			}
 			/*
@@ -119,72 +119,72 @@
 			break;
 	}
 
-	if (sk->nr->t2timer > 0 && --sk->nr->t2timer == 0) {
-		if (sk->nr->state == NR_STATE_3) {
-			if (sk->nr->condition & ACK_PENDING_CONDITION) {
-				sk->nr->condition &= ~ACK_PENDING_CONDITION;
+	if (sk->protinfo.nr->t2timer > 0 && --sk->protinfo.nr->t2timer == 0) {
+		if (sk->protinfo.nr->state == NR_STATE_3) {
+			if (sk->protinfo.nr->condition & ACK_PENDING_CONDITION) {
+				sk->protinfo.nr->condition &= ~ACK_PENDING_CONDITION;
 				nr_enquiry_response(sk);
 			}
 		}
 	}
 
-	if (sk->nr->t4timer > 0 && --sk->nr->t4timer == 0) {
-		sk->nr->condition &= ~PEER_RX_BUSY_CONDITION;
+	if (sk->protinfo.nr->t4timer > 0 && --sk->protinfo.nr->t4timer == 0) {
+		sk->protinfo.nr->condition &= ~PEER_RX_BUSY_CONDITION;
 	}
 
-	if (sk->nr->t1timer == 0 || --sk->nr->t1timer > 0) {
+	if (sk->protinfo.nr->t1timer == 0 || --sk->protinfo.nr->t1timer > 0) {
 		nr_reset_timer(sk);
 		return;
 	}
 
-	switch (sk->nr->state) {
+	switch (sk->protinfo.nr->state) {
 		case NR_STATE_1: 
-			if (sk->nr->n2count == sk->nr->n2) {
+			if (sk->protinfo.nr->n2count == sk->protinfo.nr->n2) {
 				nr_clear_queues(sk);
-				sk->nr->state = NR_STATE_0;
-				sk->state     = TCP_CLOSE;
-				sk->err       = ETIMEDOUT;
+				sk->protinfo.nr->state = NR_STATE_0;
+				sk->state              = TCP_CLOSE;
+				sk->err                = ETIMEDOUT;
 				if (!sk->dead)
 					sk->state_change(sk);
-				sk->dead      = 1;
+				sk->dead               = 1;
 			} else {
-				sk->nr->n2count++;
+				sk->protinfo.nr->n2count++;
 				nr_write_internal(sk, NR_CONNREQ);
 			}
 			break;
 
 		case NR_STATE_2:
-			if (sk->nr->n2count == sk->nr->n2) {
+			if (sk->protinfo.nr->n2count == sk->protinfo.nr->n2) {
 				nr_clear_queues(sk);
-				sk->nr->state = NR_STATE_0;
-				sk->state     = TCP_CLOSE;
-				sk->err       = ETIMEDOUT;
+				sk->protinfo.nr->state = NR_STATE_0;
+				sk->state              = TCP_CLOSE;
+				sk->err                = ETIMEDOUT;
 				if (!sk->dead)
 					sk->state_change(sk);
-				sk->dead      = 1;
+				sk->dead               = 1;
 			} else {
-				sk->nr->n2count++;
+				sk->protinfo.nr->n2count++;
 				nr_write_internal(sk, NR_DISCREQ);
 			}
 			break;
 
 		case NR_STATE_3:
-			if (sk->nr->n2count == sk->nr->n2) {
+			if (sk->protinfo.nr->n2count == sk->protinfo.nr->n2) {
 				nr_clear_queues(sk);
-				sk->nr->state = NR_STATE_0;
-				sk->state     = TCP_CLOSE;
-				sk->err       = ETIMEDOUT;
+				sk->protinfo.nr->state = NR_STATE_0;
+				sk->state              = TCP_CLOSE;
+				sk->err                = ETIMEDOUT;
 				if (!sk->dead)
 					sk->state_change(sk);
-				sk->dead      = 1;
+				sk->dead               = 1;
 			} else {
-				sk->nr->n2count++;
+				sk->protinfo.nr->n2count++;
 				nr_requeue_frames(sk);
 			}
 			break;
 	}
 
-	sk->nr->t1timer = sk->nr->t1 = nr_calculate_t1(sk);
+	sk->protinfo.nr->t1timer = sk->protinfo.nr->t1 = nr_calculate_t1(sk);
 
 	nr_set_timer(sk);
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov