Get rid of sk_protinfo use in netrom
Subsystems (2)
PATCH 1/1 Get rid of sk_protinfo use in netrom
Below patch puts struct sock into nr_cb to get rid of the need for the use of sk_protinfo in nr_sk(). While we're touching the data structure convert it from a typedef into a struct.
net/netrom/nr_timer.c +9 -9
@@ -38,7 +38,7 @@void nr_init_timers (struct sock *sk) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);init_timer (&nr->t1timer); nr->t1timer.data = (unsigned long )sk;
@@ -63,28 +63,28 @@void nr_start_t1timer (struct sock *sk) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);mod_timer (&nr->t1timer, jiffies + nr->t1); }void nr_start_t2timer (struct sock *sk) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);mod_timer (&nr->t2timer, jiffies + nr->t2); }void nr_start_t4timer (struct sock *sk) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);mod_timer (&nr->t4timer, jiffies + nr->t4); }void nr_start_idletimer (struct sock *sk) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);if (nr->idle >0 )mod_timer (&nr->idletimer, jiffies + nr->idle);
@@ -128,7 +128,7 @@static void nr_heartbeat_expiry (unsigned long param) {struct sock *sk = (struct sock *)param; -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);bh_lock_sock (sk);switch (nr->state) {
@@ -167,7 +167,7 @@static void nr_t2timer_expiry (unsigned long param) {struct sock *sk = (struct sock *)param; -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);bh_lock_sock (sk);if (nr->condition &NR_COND_ACK_PENDING ) {
@@ -189,7 +189,7 @@static void nr_idletimer_expiry (unsigned long param) {struct sock *sk = (struct sock *)param; -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);bh_lock_sock (sk);
@@ -217,7 +217,7 @@static void nr_t1timer_expiry (unsigned long param) {struct sock *sk = (struct sock *)param; -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);bh_lock_sock (sk);switch (nr->state) {
include/net/netrom.h +4 -4
@@ -55,7 +55,8 @@#define NR_MAX_WINDOW_SIZE 127/* Maximum Window Allowable - 127 */ #define NR_MAX_PACKET_SIZE 236/* Maximum Packet Length - 236 */ -typedef struct { +struct nr_sock { +struct sock sock;ax25_address user_addr, source_addr, dest_addr;struct net_device *device;unsigned char my_index, my_id;
@@ -72,10 +73,9 @@struct sk_buff_head ack_queue;struct sk_buff_head reseq_queue;struct sk_buff_head frag_queue; -struct sock *sk;/* Backlink to socket */ -} nr_cb; +}; -#define nr_sk (__sk) ((nr_cb *)(__sk)->sk_protinfo) +#define nr_sk (sk) ((struct nr_sock *)(sk))struct nr_neigh {struct hlist_node neigh_node;
net/netrom/af_netrom.c +14 -31
129 lines not on this page · raw message
net/netrom/nr_in.c +4 -4
@@ -34,7 +34,7 @@static int nr_queue_rx_frame (struct sock *sk,struct sk_buff *skb,int more) {struct sk_buff *skbo, *skbn = skb; -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);skb_pull (skb,NR_NETWORK_LEN +NR_TRANSPORT_LEN );
@@ -76,7 +76,7 @@ {switch (frametype) {case NR_CONNACK : { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);nr_stop_t1timer (sk);nr_start_idletimer (sk);
@@ -138,7 +138,7 @@*/ static int nr_state3_machine (struct sock *sk,struct sk_buff *skb,int frametype) { -nr_cb *nrom =nr_sk (sk); +struct nr_sock *nrom =nr_sk (sk);struct sk_buff_head temp_queue;struct sk_buff *skbn;unsigned short save_vr;
@@ -264,7 +264,7 @@/* Higher level upcall for a LAPB frame - called with sk locked */ int nr_process_rx_frame (struct sock *sk,struct sk_buff *skb) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);int queued =0 , frametype;if (nr->state ==NR_STATE_0 )
net/netrom/nr_subr.c +5 -5
@@ -34,7 +34,7 @@*/ void nr_clear_queues (struct sock *sk) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);skb_queue_purge (&sk->sk_write_queue);skb_queue_purge (&nr->ack_queue);
@@ -49,7 +49,7 @@*/ void nr_frames_acked (struct sock *sk,unsigned short nr) { -nr_cb *nrom =nr_sk (sk); +struct nr_sock *nrom =nr_sk (sk);struct sk_buff *skb;/*
@@ -88,7 +88,7 @@*/ int nr_validate_nr (struct sock *sk,unsigned short nr) { -nr_cb *nrom =nr_sk (sk); +struct nr_sock *nrom =nr_sk (sk);unsigned short vc = nrom->va;while (vc != nrom->vs) {
@@ -104,7 +104,7 @@*/ int nr_in_rx_window (struct sock *sk,unsigned short ns) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);unsigned short vc = nr->vr;unsigned short vt = (nr->vl + nr->window) %NR_MODULUS ;
@@ -122,7 +122,7 @@*/ void nr_write_internal (struct sock *sk,int frametype) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);struct sk_buff *skb;unsigned char *dptr;int len, timeout;
net/netrom/nr_out.c +7 -7
@@ -82,7 +82,7 @@*/ static void nr_send_iframe (struct sock *sk,struct sk_buff *skb) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);if (skb ==NULL )return ;
@@ -101,7 +101,7 @@void nr_send_nak_frame (struct sock *sk) {struct sk_buff *skb, *skbn; -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);if ((skb =skb_peek (&nr->ack_queue)) ==NULL )return ;
@@ -125,7 +125,7 @@void nr_kick (struct sock *sk) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);struct sk_buff *skb, *skbn;unsigned short start, end;
@@ -188,7 +188,7 @@void nr_transmit_buffer (struct sock *sk,struct sk_buff *skb) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);unsigned char *dptr;/*
@@ -223,7 +223,7 @@void nr_establish_data_link (struct sock *sk) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk); nr->condition =0x00 ; nr->n2count =0 ;
@@ -241,7 +241,7 @@*/ void nr_enquiry_response (struct sock *sk) { -nr_cb *nr =nr_sk (sk); +struct nr_sock *nr =nr_sk (sk);int frametype =NR_INFOACK ;if (nr->condition &NR_COND_OWN_RX_BUSY ) {
@@ -259,7 +259,7 @@void nr_check_iframes_acked (struct sock *sk,unsigned short nr) { -nr_cb *nrom =nr_sk (sk); +struct nr_sock *nrom =nr_sk (sk);if (nrom->vs == nr) {nr_frames_acked (sk, nr);
Quoted 3 lines · On Mon, 21 Mar 2005 09:49:05 +0000 Ralf Baechle DL5RB <[email protected]>…
Below patch puts struct sock into
nr_cbto get rid of the need for the use ofsk_protinfoinnr_sk(). While we're touching the data structure convert it from a typedef into a struct.
Applied, thanks Ralf.