Upto now AX.25 was using two separate structures for it's sockets. One, ax25_cb described the entire actual AX.25 connection. The other was the standard struct sock.
This patch combines both into struct ax25_sock which is more in line with current practice. An AX.25 speciality was that a ax25_cb could exist without a struct sock referencing it. Keep that alive for now by keeping the old struct sock *sk member of ax25_cb in struct ax25_sock. This now just has become a struct-internal pointer. Aside of wanrouter AX.25 has also been the last member of struct sock.sk_protinfo. With net/wanrouter being considered hopeless code and an application-level solution being prefered these days this means we now can delete sk_protinfo. Signed-off-by: Ralf Baechle <[EMAIL PROTECTED]> include/net/ax25.h | 144 +++++++++++++++++--------------------- include/net/netrom.h | 6 - include/net/rose.h | 6 - net/ax25/af_ax25.c | 173 ++++++++++++++++++++-------------------------- net/ax25/ax25_ds_in.c | 8 +- net/ax25/ax25_ds_subr.c | 14 +-- net/ax25/ax25_ds_timer.c | 10 +- net/ax25/ax25_iface.c | 16 ++-- net/ax25/ax25_in.c | 15 ++- net/ax25/ax25_ip.c | 4 - net/ax25/ax25_out.c | 19 ++--- net/ax25/ax25_route.c | 2 net/ax25/ax25_std_in.c | 10 +- net/ax25/ax25_std_subr.c | 10 +- net/ax25/ax25_std_timer.c | 10 +- net/ax25/ax25_subr.c | 18 ++-- net/ax25/ax25_timer.c | 32 ++++---- net/netrom/nr_route.c | 14 +-- net/rose/rose_route.c | 4 - 19 files changed, 243 insertions(+), 272 deletions(-) Index: linux-net/include/net/ax25.h =================================================================== --- linux-net.orig/include/net/ax25.h 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/include/net/ax25.h 2006-07-14 01:25:20.000000000 +0100 @@ -10,6 +10,7 @@ #include <linux/spinlock.h> #include <linux/timer.h> #include <linux/list.h> +#include <net/sock.h> #include <asm/atomic.h> #define AX25_T1CLAMPLO 1 @@ -221,8 +222,9 @@ typedef struct ax25_dev { #endif } ax25_dev; -typedef struct ax25_cb { - struct hlist_node ax25_node; +struct ax25_sock { + /* Struct sock has to be the first member of ax25_sock */ + struct sock sock; ax25_address source_addr, dest_addr; ax25_digi *digipeat; ax25_dev *ax25_dev; @@ -241,24 +243,12 @@ typedef struct ax25_cb { unsigned char window; struct timer_list timer, dtimer; struct sock *sk; /* Backlink to socket */ - atomic_t refcount; -} ax25_cb; - -#define ax25_sk(__sk) ((ax25_cb *)(__sk)->sk_protinfo) - -#define ax25_for_each(__ax25, node, list) \ - hlist_for_each_entry(__ax25, node, list, ax25_node) +}; -#define ax25_cb_hold(__ax25) \ - atomic_inc(&((__ax25)->refcount)) +#define ax25_sk(sk) ((struct ax25_sock *)(sk)) -static __inline__ void ax25_cb_put(ax25_cb *ax25) -{ - if (atomic_dec_and_test(&ax25->refcount)) { - kfree(ax25->digipeat); - kfree(ax25); - } -} +#define ax25_for_each(ax25, node, list) \ + hlist_for_each_entry(ax25, node, list, sock.sk_node) static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) { @@ -271,14 +261,14 @@ static inline __be16 ax25_type_trans(str /* af_ax25.c */ extern struct hlist_head ax25_list; extern spinlock_t ax25_list_lock; -extern void ax25_cb_add(ax25_cb *); +extern void ax25_cb_add(struct ax25_sock *); struct sock *ax25_find_listener(ax25_address *, int, struct net_device *, int); struct sock *ax25_get_socket(ax25_address *, ax25_address *, int); -extern ax25_cb *ax25_find_cb(ax25_address *, ax25_address *, ax25_digi *, struct net_device *); +extern struct ax25_sock *ax25_find_cb(ax25_address *, ax25_address *, ax25_digi *, struct net_device *); extern void ax25_send_to_raw(ax25_address *, struct sk_buff *, int); -extern void ax25_destroy_socket(ax25_cb *); -extern ax25_cb *ax25_create_cb(void); -extern void ax25_fillin_cb(ax25_cb *, ax25_dev *); +extern void ax25_destroy_socket(struct ax25_sock *); +extern struct ax25_sock *ax25_alloc_sock(struct socket *sock); +extern void ax25_fillin_cb(struct ax25_sock *, ax25_dev *); extern struct sock *ax25_make_new(struct sock *, struct ax25_dev *); /* ax25_addr.c */ @@ -309,39 +299,39 @@ extern struct net_device *ax25_fwd_dev(s extern void ax25_dev_free(void); /* ax25_ds_in.c */ -extern int ax25_ds_frame_in(ax25_cb *, struct sk_buff *, int); +extern int ax25_ds_frame_in(struct ax25_sock *, struct sk_buff *, int); /* ax25_ds_subr.c */ -extern void ax25_ds_nr_error_recovery(ax25_cb *); -extern void ax25_ds_enquiry_response(ax25_cb *); -extern void ax25_ds_establish_data_link(ax25_cb *); +extern void ax25_ds_nr_error_recovery(struct ax25_sock *); +extern void ax25_ds_enquiry_response(struct ax25_sock *); +extern void ax25_ds_establish_data_link(struct ax25_sock *); extern void ax25_dev_dama_off(ax25_dev *); -extern void ax25_dama_on(ax25_cb *); -extern void ax25_dama_off(ax25_cb *); +extern void ax25_dama_on(struct ax25_sock *); +extern void ax25_dama_off(struct ax25_sock *); /* ax25_ds_timer.c */ extern void ax25_ds_set_timer(ax25_dev *); extern void ax25_ds_del_timer(ax25_dev *); -extern void ax25_ds_timer(ax25_cb *); -extern void ax25_ds_t1_timeout(ax25_cb *); -extern void ax25_ds_heartbeat_expiry(ax25_cb *); -extern void ax25_ds_t3timer_expiry(ax25_cb *); -extern void ax25_ds_idletimer_expiry(ax25_cb *); +extern void ax25_ds_timer(struct ax25_sock *); +extern void ax25_ds_t1_timeout(struct ax25_sock *); +extern void ax25_ds_heartbeat_expiry(struct ax25_sock *); +extern void ax25_ds_t3timer_expiry(struct ax25_sock *); +extern void ax25_ds_idletimer_expiry(struct ax25_sock *); /* ax25_iface.c */ -extern int ax25_protocol_register(unsigned int, int (*)(struct sk_buff *, ax25_cb *)); +extern int ax25_protocol_register(unsigned int, int (*)(struct sk_buff *, struct ax25_sock *)); extern void ax25_protocol_release(unsigned int); -extern int ax25_linkfail_register(void (*)(ax25_cb *, int)); -extern void ax25_linkfail_release(void (*)(ax25_cb *, int)); +extern int ax25_linkfail_register(void (*)(struct ax25_sock *, int)); +extern void ax25_linkfail_release(void (*)(struct ax25_sock *, int)); extern int ax25_listen_register(ax25_address *, struct net_device *); extern void ax25_listen_release(ax25_address *, struct net_device *); -extern int (*ax25_protocol_function(unsigned int))(struct sk_buff *, ax25_cb *); +extern int (*ax25_protocol_function(unsigned int))(struct sk_buff *, struct ax25_sock *); extern int ax25_listen_mine(ax25_address *, struct net_device *); -extern void ax25_link_failed(ax25_cb *, int); +extern void ax25_link_failed(struct ax25_sock *, int); extern int ax25_protocol_is_registered(unsigned int); /* ax25_in.c */ -extern int ax25_rx_iframe(ax25_cb *, struct sk_buff *); +extern int ax25_rx_iframe(struct ax25_sock *, struct sk_buff *); extern int ax25_kiss_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); /* ax25_ip.c */ @@ -349,63 +339,63 @@ extern int ax25_hard_header(struct sk_b extern int ax25_rebuild_header(struct sk_buff *); /* ax25_out.c */ -extern ax25_cb *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *, ax25_digi *, struct net_device *); -extern void ax25_output(ax25_cb *, int, struct sk_buff *); -extern void ax25_kick(ax25_cb *); -extern void ax25_transmit_buffer(ax25_cb *, struct sk_buff *, int); +extern struct ax25_sock *ax25_send_frame(struct sk_buff *, int, ax25_address *, ax25_address *, ax25_digi *, struct net_device *); +extern void ax25_output(struct ax25_sock *, int, struct sk_buff *); +extern void ax25_kick(struct ax25_sock *); +extern void ax25_transmit_buffer(struct ax25_sock *, struct sk_buff *, int); extern void ax25_queue_xmit(struct sk_buff *skb, struct net_device *dev); -extern int ax25_check_iframes_acked(ax25_cb *, unsigned short); +extern int ax25_check_iframes_acked(struct ax25_sock *, unsigned short); /* ax25_route.c */ extern void ax25_rt_device_down(struct net_device *); extern int ax25_rt_ioctl(unsigned int, void __user *); extern struct file_operations ax25_route_fops; extern ax25_route *ax25_get_route(ax25_address *addr, struct net_device *dev); -extern int ax25_rt_autobind(ax25_cb *, ax25_address *); +extern int ax25_rt_autobind(struct ax25_sock *, ax25_address *); extern struct sk_buff *ax25_rt_build_path(struct sk_buff *, ax25_address *, ax25_address *, ax25_digi *); extern void ax25_rt_free(void); /* ax25_std_in.c */ -extern int ax25_std_frame_in(ax25_cb *, struct sk_buff *, int); +extern int ax25_std_frame_in(struct ax25_sock *, struct sk_buff *, int); /* ax25_std_subr.c */ -extern void ax25_std_nr_error_recovery(ax25_cb *); -extern void ax25_std_establish_data_link(ax25_cb *); -extern void ax25_std_transmit_enquiry(ax25_cb *); -extern void ax25_std_enquiry_response(ax25_cb *); -extern void ax25_std_timeout_response(ax25_cb *); +extern void ax25_std_nr_error_recovery(struct ax25_sock *); +extern void ax25_std_establish_data_link(struct ax25_sock *); +extern void ax25_std_transmit_enquiry(struct ax25_sock *); +extern void ax25_std_enquiry_response(struct ax25_sock *); +extern void ax25_std_timeout_response(struct ax25_sock *); /* ax25_std_timer.c */ -extern void ax25_std_heartbeat_expiry(ax25_cb *); -extern void ax25_std_t1timer_expiry(ax25_cb *); -extern void ax25_std_t2timer_expiry(ax25_cb *); -extern void ax25_std_t3timer_expiry(ax25_cb *); -extern void ax25_std_idletimer_expiry(ax25_cb *); +extern void ax25_std_heartbeat_expiry(struct ax25_sock *); +extern void ax25_std_t1timer_expiry(struct ax25_sock *); +extern void ax25_std_t2timer_expiry(struct ax25_sock *); +extern void ax25_std_t3timer_expiry(struct ax25_sock *); +extern void ax25_std_idletimer_expiry(struct ax25_sock *); /* ax25_subr.c */ -extern void ax25_clear_queues(ax25_cb *); -extern void ax25_frames_acked(ax25_cb *, unsigned short); -extern void ax25_requeue_frames(ax25_cb *); -extern int ax25_validate_nr(ax25_cb *, unsigned short); -extern int ax25_decode(ax25_cb *, struct sk_buff *, int *, int *, int *); -extern void ax25_send_control(ax25_cb *, int, int, int); +extern void ax25_clear_queues(struct ax25_sock *); +extern void ax25_frames_acked(struct ax25_sock *, unsigned short); +extern void ax25_requeue_frames(struct ax25_sock *); +extern int ax25_validate_nr(struct ax25_sock *, unsigned short); +extern int ax25_decode(struct ax25_sock *, struct sk_buff *, int *, int *, int *); +extern void ax25_send_control(struct ax25_sock *, int, int, int); extern void ax25_return_dm(struct net_device *, ax25_address *, ax25_address *, ax25_digi *); -extern void ax25_calculate_t1(ax25_cb *); -extern void ax25_calculate_rtt(ax25_cb *); -extern void ax25_disconnect(ax25_cb *, int); +extern void ax25_calculate_t1(struct ax25_sock *); +extern void ax25_calculate_rtt(struct ax25_sock *); +extern void ax25_disconnect(struct ax25_sock *, int); /* ax25_timer.c */ -extern void ax25_start_heartbeat(ax25_cb *); -extern void ax25_start_t1timer(ax25_cb *); -extern void ax25_start_t2timer(ax25_cb *); -extern void ax25_start_t3timer(ax25_cb *); -extern void ax25_start_idletimer(ax25_cb *); -extern void ax25_stop_heartbeat(ax25_cb *); -extern void ax25_stop_t1timer(ax25_cb *); -extern void ax25_stop_t2timer(ax25_cb *); -extern void ax25_stop_t3timer(ax25_cb *); -extern void ax25_stop_idletimer(ax25_cb *); -extern int ax25_t1timer_running(ax25_cb *); +extern void ax25_start_heartbeat(struct ax25_sock *); +extern void ax25_start_t1timer(struct ax25_sock *); +extern void ax25_start_t2timer(struct ax25_sock *); +extern void ax25_start_t3timer(struct ax25_sock *); +extern void ax25_start_idletimer(struct ax25_sock *); +extern void ax25_stop_heartbeat(struct ax25_sock *); +extern void ax25_stop_t1timer(struct ax25_sock *); +extern void ax25_stop_t2timer(struct ax25_sock *); +extern void ax25_stop_t3timer(struct ax25_sock *); +extern void ax25_stop_idletimer(struct ax25_sock *); +extern int ax25_t1timer_running(struct ax25_sock *); extern unsigned long ax25_display_timer(struct timer_list *); /* ax25_uid.c */ Index: linux-net/include/net/netrom.h =================================================================== --- linux-net.orig/include/net/netrom.h 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/include/net/netrom.h 2006-07-14 01:25:20.000000000 +0100 @@ -89,7 +89,7 @@ struct nr_neigh { struct hlist_node neigh_node; ax25_address callsign; ax25_digi *digipeat; - ax25_cb *ax25; + struct ax25_sock *ax25; struct net_device *dev; unsigned char quality; unsigned char locked; @@ -213,8 +213,8 @@ extern void nr_rt_device_down(struct net extern struct net_device *nr_dev_first(void); extern struct net_device *nr_dev_get(ax25_address *); extern int nr_rt_ioctl(unsigned int, void __user *); -extern void nr_link_failed(ax25_cb *, int); -extern int nr_route_frame(struct sk_buff *, ax25_cb *); +extern void nr_link_failed(struct ax25_sock *, int); +extern int nr_route_frame(struct sk_buff *, struct ax25_sock *); extern struct file_operations nr_nodes_fops; extern struct file_operations nr_neigh_fops; extern void nr_rt_free(void); Index: linux-net/include/net/rose.h =================================================================== --- linux-net.orig/include/net/rose.h 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/include/net/rose.h 2006-07-14 01:25:20.000000000 +0100 @@ -85,7 +85,7 @@ struct rose_neigh { struct rose_neigh *next; ax25_address callsign; ax25_digi *digipeat; - ax25_cb *ax25; + struct ax25_sock *ax25; struct net_device *dev; unsigned short count; unsigned short use; @@ -203,8 +203,8 @@ extern struct net_device *rose_dev_get(r extern struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *); extern struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *, unsigned char *); extern int rose_rt_ioctl(unsigned int, void __user *); -extern void rose_link_failed(ax25_cb *, int); -extern int rose_route_frame(struct sk_buff *, ax25_cb *); +extern void rose_link_failed(struct ax25_sock *, int); +extern int rose_route_frame(struct sk_buff *, struct ax25_sock *); extern void rose_rt_free(void); /* rose_subr.c */ Index: linux-net/net/ax25/af_ax25.c =================================================================== --- linux-net.orig/net/ax25/af_ax25.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/af_ax25.c 2006-07-14 01:27:33.000000000 +0100 @@ -54,24 +54,21 @@ HLIST_HEAD(ax25_list); DEFINE_SPINLOCK(ax25_list_lock); +static struct proto ax25_proto; static const struct proto_ops ax25_proto_ops; -static void ax25_free_sock(struct sock *sk) +static void ax25_sk_destruct(struct sock *sk) { - ax25_cb_put(ax25_sk(sk)); + struct ax25_sock *ax25 = (struct ax25_sock *) sk; + + kfree(ax25->digipeat); } -/* - * Socket removal during an interrupt is now safe. - */ -static void ax25_cb_del(ax25_cb *ax25) +static void ax25_cb_del(struct ax25_sock *ax25) { - if (!hlist_unhashed(&ax25->ax25_node)) { - spin_lock_bh(&ax25_list_lock); - hlist_del_init(&ax25->ax25_node); - spin_unlock_bh(&ax25_list_lock); - ax25_cb_put(ax25); - } + spin_lock_bh(&ax25_list_lock); + sk_del_node_init(&ax25->sock); + spin_unlock_bh(&ax25_list_lock); } /* @@ -80,18 +77,22 @@ static void ax25_cb_del(ax25_cb *ax25) static void ax25_kill_by_device(struct net_device *dev) { ax25_dev *ax25_dev; - ax25_cb *s; + struct ax25_sock *ax25; struct hlist_node *node; if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) return; spin_lock_bh(&ax25_list_lock); - ax25_for_each(s, node, &ax25_list) { - if (s->ax25_dev == ax25_dev) { - s->ax25_dev = NULL; - ax25_disconnect(s, ENETUNREACH); + ax25_for_each(ax25, node, &ax25_list) { + if (ax25->sk) + bh_lock_sock(ax25->sk); + if (ax25->ax25_dev == ax25_dev) { + ax25->ax25_dev = NULL; + ax25_disconnect(ax25, ENETUNREACH); } + if (ax25->sk) + bh_unlock_sock(ax25->sk); } spin_unlock_bh(&ax25_list_lock); } @@ -127,11 +128,10 @@ static int ax25_device_event(struct noti /* * Add a socket to the bound sockets list. */ -void ax25_cb_add(ax25_cb *ax25) +void ax25_cb_add(struct ax25_sock *ax25) { spin_lock_bh(&ax25_list_lock); - ax25_cb_hold(ax25); - hlist_add_head(&ax25->ax25_node, &ax25_list); + sk_add_node(&ax25->sock, &ax25_list); spin_unlock_bh(&ax25_list_lock); } @@ -142,7 +142,7 @@ void ax25_cb_add(ax25_cb *ax25) struct sock *ax25_find_listener(ax25_address *addr, int digi, struct net_device *dev, int type) { - ax25_cb *s; + struct ax25_sock *s; struct hlist_node *node; spin_lock(&ax25_list_lock); @@ -171,7 +171,7 @@ struct sock *ax25_get_socket(ax25_addres int type) { struct sock *sk = NULL; - ax25_cb *s; + struct ax25_sock *s; struct hlist_node *node; spin_lock(&ax25_list_lock); @@ -194,10 +194,10 @@ struct sock *ax25_get_socket(ax25_addres * Find an AX.25 control block given both ends. It will only pick up * floating AX.25 control blocks or non Raw socket bound control blocks. */ -ax25_cb *ax25_find_cb(ax25_address *src_addr, ax25_address *dest_addr, +struct ax25_sock *ax25_find_cb(ax25_address *src_addr, ax25_address *dest_addr, ax25_digi *digi, struct net_device *dev) { - ax25_cb *s; + struct ax25_sock *s; struct hlist_node *node; spin_lock_bh(&ax25_list_lock); @@ -216,7 +216,7 @@ ax25_cb *ax25_find_cb(ax25_address *src_ if (s->digipeat != NULL && s->digipeat->ndigi != 0) continue; } - ax25_cb_hold(s); + sock_hold(&s->sock); spin_unlock_bh(&ax25_list_lock); return s; @@ -231,7 +231,7 @@ EXPORT_SYMBOL(ax25_find_cb); void ax25_send_to_raw(ax25_address *addr, struct sk_buff *skb, int proto) { - ax25_cb *s; + struct ax25_sock *s; struct sk_buff *copy; struct hlist_node *node; @@ -254,14 +254,14 @@ void ax25_send_to_raw(ax25_address *addr /* * Deferred destroy. */ -void ax25_destroy_socket(ax25_cb *); +void ax25_destroy_socket(struct ax25_sock *); /* * Handler for deferred kills. */ static void ax25_destroy_timer(unsigned long data) { - ax25_cb *ax25=(ax25_cb *)data; + struct ax25_sock *ax25 = (struct ax25_sock *)data; struct sock *sk; sk=ax25->sk; @@ -279,7 +279,7 @@ static void ax25_destroy_timer(unsigned * work. Once it is removed from the queue no interrupt or bottom half * will touch it and we are (fairly 8-) ) safe. */ -void ax25_destroy_socket(ax25_cb *ax25) +void ax25_destroy_socket(struct ax25_sock *ax25) { struct sk_buff *skb; @@ -297,7 +297,7 @@ void ax25_destroy_socket(ax25_cb *ax25) while ((skb = skb_dequeue(&ax25->sk->sk_receive_queue)) != NULL) { if (skb->sk != ax25->sk) { /* A pending connection */ - ax25_cb *sax25 = ax25_sk(skb->sk); + struct ax25_sock *sax25 = ax25_sk(skb->sk); /* Queue the unaccepted socket for death */ sock_orphan(skb->sk); @@ -326,7 +326,7 @@ void ax25_destroy_socket(ax25_cb *ax25) sock_put(sk); } } else { - ax25_cb_put(ax25); + sock_put(&ax25->sock); } } @@ -340,7 +340,7 @@ static int ax25_ctl_ioctl(const unsigned struct ax25_ctl_struct ax25_ctl; ax25_digi digi; ax25_dev *ax25_dev; - ax25_cb *ax25; + struct ax25_sock *ax25; unsigned int k; if (copy_from_user(&ax25_ctl, arg, sizeof(ax25_ctl))) @@ -425,7 +425,7 @@ static int ax25_ctl_ioctl(const unsigned return 0; } -static void ax25_fillin_cb_from_dev(ax25_cb *ax25, ax25_dev *ax25_dev) +static void ax25_fillin_cb_from_dev(struct ax25_sock *ax25, ax25_dev *ax25_dev) { ax25->rtt = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]) / 2; ax25->t1 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]); @@ -449,7 +449,7 @@ static void ax25_fillin_cb_from_dev(ax25 * Fill in a created AX.25 created control block with the default * values for a particular device. */ -void ax25_fillin_cb(ax25_cb *ax25, ax25_dev *ax25_dev) +void ax25_fillin_cb(struct ax25_sock *ax25, ax25_dev *ax25_dev) { ax25->ax25_dev = ax25_dev; @@ -482,14 +482,15 @@ void ax25_fillin_cb(ax25_cb *ax25, ax25_ /* * Create an empty AX.25 control block. */ -ax25_cb *ax25_create_cb(void) +struct ax25_sock *ax25_alloc_sock(struct socket *sock) { - ax25_cb *ax25; + struct ax25_sock *ax25; - if ((ax25 = kzalloc(sizeof(*ax25), GFP_ATOMIC)) == NULL) + ax25 = (struct ax25_sock *) sk_alloc(PF_AX25, GFP_ATOMIC, &ax25_proto, 1); + if (!ax25) return NULL; - atomic_set(&ax25->refcount, 1); + sock_init_data(sock, &ax25->sock); skb_queue_head_init(&ax25->write_queue); skb_queue_head_init(&ax25->frag_queue); @@ -518,7 +519,7 @@ static int ax25_setsockopt(struct socket char __user *optval, int optlen) { struct sock *sk = sock->sk; - ax25_cb *ax25; + struct ax25_sock *ax25; struct net_device *dev; char devname[IFNAMSIZ]; int opt, res = 0; @@ -658,7 +659,7 @@ static int ax25_getsockopt(struct socket char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; - ax25_cb *ax25; + struct ax25_sock *ax25; struct ax25_dev *ax25_dev; char devname[IFNAMSIZ]; void *valptr; @@ -770,20 +771,15 @@ out: return res; } -/* - * XXX: when creating ax25_sock we should update the .obj_size setting - * below. - */ static struct proto ax25_proto = { .name = "AX25", .owner = THIS_MODULE, - .obj_size = sizeof(struct sock), + .obj_size = sizeof(struct ax25_sock), }; static int ax25_create(struct socket *sock, int protocol) { - struct sock *sk; - ax25_cb *ax25; + struct ax25_sock *ax25; switch (sock->type) { case SOCK_DGRAM: @@ -830,62 +826,47 @@ static int ax25_create(struct socket *so return -ESOCKTNOSUPPORT; } - if ((sk = sk_alloc(PF_AX25, GFP_ATOMIC, &ax25_proto, 1)) == NULL) - return -ENOMEM; - - ax25 = sk->sk_protinfo = ax25_create_cb(); - if (!ax25) { - sk_free(sk); + ax25 = ax25_alloc_sock(sock); + if (!ax25) return -ENOMEM; - } - - sock_init_data(sock, sk); - sk->sk_destruct = ax25_free_sock; + ax25->sock.sk_destruct = ax25_sk_destruct; sock->ops = &ax25_proto_ops; - sk->sk_protocol = protocol; + ax25->sock.sk_protocol = protocol; - ax25->sk = sk; + ax25->sk = &ax25->sock; return 0; } struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) { - struct sock *sk; - ax25_cb *ax25, *oax25; + struct ax25_sock *ax25, *oax25; - if ((sk = sk_alloc(PF_AX25, GFP_ATOMIC, osk->sk_prot, 1)) == NULL) + ax25 = ax25_alloc_sock(NULL); + if (!ax25) return NULL; - if ((ax25 = ax25_create_cb()) == NULL) { - sk_free(sk); - return NULL; - } - switch (osk->sk_type) { case SOCK_DGRAM: break; case SOCK_SEQPACKET: break; default: - sk_free(sk); - ax25_cb_put(ax25); + sk_free(&ax25->sock); return NULL; } - sock_init_data(NULL, sk); - - sk->sk_destruct = ax25_free_sock; - sk->sk_type = osk->sk_type; - sk->sk_socket = osk->sk_socket; - sk->sk_priority = osk->sk_priority; - sk->sk_protocol = osk->sk_protocol; - sk->sk_rcvbuf = osk->sk_rcvbuf; - sk->sk_sndbuf = osk->sk_sndbuf; - sk->sk_state = TCP_ESTABLISHED; - sk->sk_sleep = osk->sk_sleep; - sock_copy_flags(sk, osk); + ax25->sock.sk_destruct = ax25_sk_destruct; + ax25->sock.sk_type = osk->sk_type; + ax25->sock.sk_socket = osk->sk_socket; + ax25->sock.sk_priority = osk->sk_priority; + ax25->sock.sk_protocol = osk->sk_protocol; + ax25->sock.sk_rcvbuf = osk->sk_rcvbuf; + ax25->sock.sk_sndbuf = osk->sk_sndbuf; + ax25->sock.sk_state = TCP_ESTABLISHED; + ax25->sock.sk_sleep = osk->sk_sleep; + sock_copy_flags(&ax25->sock, osk); oax25 = ax25_sk(osk); @@ -907,24 +888,22 @@ struct sock *ax25_make_new(struct sock * if (oax25->digipeat != NULL) { if ((ax25->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { - sk_free(sk); - ax25_cb_put(ax25); + sk_free(&ax25->sock); return NULL; } memcpy(ax25->digipeat, oax25->digipeat, sizeof(ax25_digi)); } - sk->sk_protinfo = ax25; - ax25->sk = sk; + ax25->sk = &ax25->sock; - return sk; + return &ax25->sock; } static int ax25_release(struct socket *sock) { struct sock *sk = sock->sk; - ax25_cb *ax25; + struct ax25_sock *ax25; if (sk == NULL) return 0; @@ -1014,7 +993,7 @@ static int ax25_bind(struct socket *sock ax25_dev *ax25_dev = NULL; ax25_uid_assoc *user; ax25_address call; - ax25_cb *ax25; + struct ax25_sock *ax25; int err = 0; if (addr_len != sizeof(struct sockaddr_ax25) && @@ -1092,7 +1071,7 @@ static int ax25_connect(struct socket *s int addr_len, int flags) { struct sock *sk = sock->sk; - ax25_cb *ax25 = ax25_sk(sk), *ax25t; + struct ax25_sock *ax25 = ax25_sk(sk), *ax25t; struct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)uaddr; ax25_digi *digi = NULL; int ct = 0, err = 0; @@ -1212,7 +1191,7 @@ static int ax25_connect(struct socket *s ax25->ax25_dev->dev))) { kfree(digi); err = -EADDRINUSE; /* Already such a connection */ - ax25_cb_put(ax25t); + sock_put(&ax25t->sock); goto out; } @@ -1375,7 +1354,7 @@ static int ax25_getname(struct socket *s struct full_sockaddr_ax25 *fsa = (struct full_sockaddr_ax25 *)uaddr; struct sock *sk = sock->sk; unsigned char ndigi, i; - ax25_cb *ax25; + struct ax25_sock *ax25; int err = 0; lock_sock(sk); @@ -1426,7 +1405,7 @@ static int ax25_sendmsg(struct kiocb *io struct sk_buff *skb; ax25_digi dtmp, *dp; unsigned char *asmptr; - ax25_cb *ax25; + struct ax25_sock *ax25; size_t size; int lv, err, addr_len = msg->msg_namelen; @@ -1762,7 +1741,7 @@ static int ax25_ioctl(struct socket *soc case SIOCAX25GETINFO: case SIOCAX25GETINFOOLD: { - ax25_cb *ax25 = ax25_sk(sk); + struct ax25_sock *ax25 = ax25_sk(sk); struct ax25_info_struct ax25_info; ax25_info.t1 = ax25->t1 / HZ; @@ -1849,7 +1828,7 @@ static int ax25_ioctl(struct socket *soc static void *ax25_info_start(struct seq_file *seq, loff_t *pos) { - struct ax25_cb *ax25; + struct ax25_sock *ax25; struct hlist_node *node; int i = 0; @@ -1866,8 +1845,8 @@ static void *ax25_info_next(struct seq_f { ++*pos; - return hlist_entry( ((struct ax25_cb *)v)->ax25_node.next, - struct ax25_cb, ax25_node); + return hlist_entry(((struct ax25_sock *)v)->sock.sk_node.next, + struct ax25_sock, sock.sk_node); } static void ax25_info_stop(struct seq_file *seq, void *v) @@ -1877,7 +1856,7 @@ static void ax25_info_stop(struct seq_fi static int ax25_info_show(struct seq_file *seq, void *v) { - ax25_cb *ax25 = v; + struct ax25_sock *ax25 = v; char buf[11]; int k; Index: linux-net/net/ax25/ax25_ds_in.c =================================================================== --- linux-net.orig/net/ax25/ax25_ds_in.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_ds_in.c 2006-07-14 01:25:20.000000000 +0100 @@ -34,7 +34,7 @@ * The handling of the timer(s) is in file ax25_ds_timer.c. * Handling of state 0 and connection release is in ax25.c. */ -static int ax25_ds_state1_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int pf, int type) +static int ax25_ds_state1_machine(struct ax25_sock *ax25, struct sk_buff *skb, int frametype, int pf, int type) { switch (frametype) { case AX25_SABM: @@ -102,7 +102,7 @@ static int ax25_ds_state1_machine(ax25_c * The handling of the timer(s) is in file ax25_ds_timer.c * Handling of state 0 and connection release is in ax25.c. */ -static int ax25_ds_state2_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int pf, int type) +static int ax25_ds_state2_machine(struct ax25_sock *ax25, struct sk_buff *skb, int frametype, int pf, int type) { switch (frametype) { case AX25_SABM: @@ -147,7 +147,7 @@ static int ax25_ds_state2_machine(ax25_c * The handling of the timer(s) is in file ax25_timer.c * Handling of state 0 and connection release is in ax25.c. */ -static int ax25_ds_state3_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int ns, int nr, int pf, int type) +static int ax25_ds_state3_machine(struct ax25_sock *ax25, struct sk_buff *skb, int frametype, int ns, int nr, int pf, int type) { int queued = 0; @@ -281,7 +281,7 @@ static int ax25_ds_state3_machine(ax25_c /* * Higher level upcall for a LAPB frame */ -int ax25_ds_frame_in(ax25_cb *ax25, struct sk_buff *skb, int type) +int ax25_ds_frame_in(struct ax25_sock *ax25, struct sk_buff *skb, int type) { int queued = 0, frametype, ns, nr, pf; Index: linux-net/net/ax25/ax25_ds_subr.c =================================================================== --- linux-net.orig/net/ax25/ax25_ds_subr.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_ds_subr.c 2006-07-14 01:25:20.000000000 +0100 @@ -29,7 +29,7 @@ #include <linux/mm.h> #include <linux/interrupt.h> -void ax25_ds_nr_error_recovery(ax25_cb *ax25) +void ax25_ds_nr_error_recovery(struct ax25_sock *ax25) { ax25_ds_establish_data_link(ax25); } @@ -37,9 +37,9 @@ void ax25_ds_nr_error_recovery(ax25_cb * /* * dl1bke 960114: transmit I frames on DAMA poll */ -void ax25_ds_enquiry_response(ax25_cb *ax25) +void ax25_ds_enquiry_response(struct ax25_sock *ax25) { - ax25_cb *ax25o; + struct ax25_sock *ax25o; struct hlist_node *node; /* Please note that neither DK4EG´s nor DG2FEF´s @@ -109,7 +109,7 @@ void ax25_ds_enquiry_response(ax25_cb *a spin_unlock(&ax25_list_lock); } -void ax25_ds_establish_data_link(ax25_cb *ax25) +void ax25_ds_establish_data_link(struct ax25_sock *ax25) { ax25->condition &= AX25_COND_DAMA_MODE; ax25->n2count = 0; @@ -158,7 +158,7 @@ static void ax25_kiss_cmd(ax25_dev *ax25 */ static int ax25_check_dama_slave(ax25_dev *ax25_dev) { - ax25_cb *ax25; + struct ax25_sock *ax25; int res = 0; struct hlist_node *node; @@ -197,13 +197,13 @@ void ax25_dev_dama_off(ax25_dev *ax25_de } } -void ax25_dama_on(ax25_cb *ax25) +void ax25_dama_on(struct ax25_sock *ax25) { ax25_dev_dama_on(ax25->ax25_dev); ax25->condition |= AX25_COND_DAMA_MODE; } -void ax25_dama_off(ax25_cb *ax25) +void ax25_dama_off(struct ax25_sock *ax25) { ax25->condition &= ~AX25_COND_DAMA_MODE; ax25_dev_dama_off(ax25->ax25_dev); Index: linux-net/net/ax25/ax25_ds_timer.c =================================================================== --- linux-net.orig/net/ax25/ax25_ds_timer.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_ds_timer.c 2006-07-14 01:25:20.000000000 +0100 @@ -74,7 +74,7 @@ void ax25_ds_set_timer(ax25_dev *ax25_de static void ax25_ds_timeout(unsigned long arg) { ax25_dev *ax25_dev = (struct ax25_dev *) arg; - ax25_cb *ax25; + struct ax25_sock *ax25; struct hlist_node *node; if (ax25_dev == NULL || !ax25_dev->dama.slave) @@ -98,7 +98,7 @@ static void ax25_ds_timeout(unsigned lon ax25_dev_dama_off(ax25_dev); } -void ax25_ds_heartbeat_expiry(ax25_cb *ax25) +void ax25_ds_heartbeat_expiry(struct ax25_sock *ax25) { struct sock *sk=ax25->sk; @@ -150,7 +150,7 @@ void ax25_ds_heartbeat_expiry(ax25_cb *a * gets reloaded with every frame for this * connection. */ -void ax25_ds_t3timer_expiry(ax25_cb *ax25) +void ax25_ds_t3timer_expiry(struct ax25_sock *ax25) { ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND); ax25_dama_off(ax25); @@ -161,7 +161,7 @@ void ax25_ds_t3timer_expiry(ax25_cb *ax2 * unlike T3 this timer gets reloaded only on * I frames. */ -void ax25_ds_idletimer_expiry(ax25_cb *ax25) +void ax25_ds_idletimer_expiry(struct ax25_sock *ax25) { ax25_clear_queues(ax25); @@ -193,7 +193,7 @@ void ax25_ds_idletimer_expiry(ax25_cb *a * Thus we'll have to do parts of our T1 handling in * ax25_enquiry_response(). */ -void ax25_ds_t1_timeout(ax25_cb *ax25) +void ax25_ds_t1_timeout(struct ax25_sock *ax25) { switch (ax25->state) { case AX25_STATE_1: Index: linux-net/net/ax25/ax25_iface.c =================================================================== --- linux-net.orig/net/ax25/ax25_iface.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_iface.c 2006-07-14 01:25:20.000000000 +0100 @@ -32,13 +32,13 @@ static struct protocol_struct { struct protocol_struct *next; unsigned int pid; - int (*func)(struct sk_buff *, ax25_cb *); + int (*func)(struct sk_buff *, struct ax25_sock *); } *protocol_list = NULL; static DEFINE_RWLOCK(protocol_list_lock); static struct linkfail_struct { struct linkfail_struct *next; - void (*func)(ax25_cb *, int); + void (*func)(struct ax25_sock *, int); } *linkfail_list = NULL; static DEFINE_SPINLOCK(linkfail_lock); @@ -50,7 +50,7 @@ static struct listen_struct { static DEFINE_SPINLOCK(listen_lock); int ax25_protocol_register(unsigned int pid, - int (*func)(struct sk_buff *, ax25_cb *)) + int (*func)(struct sk_buff *, struct ax25_sock *)) { struct protocol_struct *protocol; @@ -110,7 +110,7 @@ void ax25_protocol_release(unsigned int EXPORT_SYMBOL(ax25_protocol_release); -int ax25_linkfail_register(void (*func)(ax25_cb *, int)) +int ax25_linkfail_register(void (*func)(struct ax25_sock *, int)) { struct linkfail_struct *linkfail; @@ -129,7 +129,7 @@ int ax25_linkfail_register(void (*func)( EXPORT_SYMBOL(ax25_linkfail_register); -void ax25_linkfail_release(void (*func)(ax25_cb *, int)) +void ax25_linkfail_release(void (*func)(struct ax25_sock *, int)) { struct linkfail_struct *s, *linkfail; @@ -220,9 +220,9 @@ void ax25_listen_release(ax25_address *c EXPORT_SYMBOL(ax25_listen_release); -int (*ax25_protocol_function(unsigned int pid))(struct sk_buff *, ax25_cb *) +int (*ax25_protocol_function(unsigned int pid))(struct sk_buff *, struct ax25_sock *) { - int (*res)(struct sk_buff *, ax25_cb *) = NULL; + int (*res)(struct sk_buff *, struct ax25_sock *) = NULL; struct protocol_struct *protocol; read_lock(&protocol_list_lock); @@ -251,7 +251,7 @@ int ax25_listen_mine(ax25_address *calls return 0; } -void ax25_link_failed(ax25_cb *ax25, int reason) +void ax25_link_failed(struct ax25_sock *ax25, int reason) { struct linkfail_struct *linkfail; Index: linux-net/net/ax25/ax25_in.c =================================================================== --- linux-net.orig/net/ax25/ax25_in.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_in.c 2006-07-14 01:25:20.000000000 +0100 @@ -36,7 +36,7 @@ * Given a fragment, queue it on the fragment queue and if the fragment * is complete, send it back to ax25_rx_iframe. */ -static int ax25_rx_fragment(ax25_cb *ax25, struct sk_buff *skb) +static int ax25_rx_fragment(struct ax25_sock *ax25, struct sk_buff *skb) { struct sk_buff *skbn, *skbo; @@ -99,9 +99,9 @@ static int ax25_rx_fragment(ax25_cb *ax2 * This is where all valid I frames are sent to, to be dispatched to * whichever protocol requires them. */ -int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb) +int ax25_rx_iframe(struct ax25_sock *ax25, struct sk_buff *skb) { - int (*func)(struct sk_buff *, ax25_cb *); + int (*func)(struct sk_buff *, struct ax25_sock *); unsigned char pid; int queued = 0; @@ -157,7 +157,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct /* * Higher level upcall for a LAPB frame */ -static int ax25_process_rx_frame(ax25_cb *ax25, struct sk_buff *skb, int type, int dama) +static int ax25_process_rx_frame(struct ax25_sock *ax25, struct sk_buff *skb, int type, int dama) { int queued = 0; @@ -190,7 +190,7 @@ static int ax25_rcv(struct sk_buff *skb, int type = 0, mine = 0, dama; struct sock *make, *sk; ax25_digi dp, reverse_dp; - ax25_cb *ax25; + struct ax25_sock *ax25; ax25_dev *ax25_dev; /* @@ -321,7 +321,7 @@ static int ax25_rcv(struct sk_buff *skb, if (ax25_process_rx_frame(ax25, skb, type, dama) == 0) kfree_skb(skb); - ax25_cb_put(ax25); + sock_put(&ax25->sock); return 0; } @@ -376,7 +376,8 @@ static int ax25_rcv(struct sk_buff *skb, return 0; } - if ((ax25 = ax25_create_cb()) == NULL) { + ax25 = ax25_alloc_sock(NULL); + if (!ax25) { ax25_return_dm(dev, &src, &dest, &dp); kfree_skb(skb); return 0; Index: linux-net/net/ax25/ax25_ip.c =================================================================== --- linux-net.orig/net/ax25/ax25_ip.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_ip.c 2006-07-14 01:25:20.000000000 +0100 @@ -108,7 +108,7 @@ int ax25_rebuild_header(struct sk_buff * ax25_address *src, *dst; ax25_digi *digipeat = NULL; ax25_dev *ax25_dev; - ax25_cb *ax25; + struct ax25_sock *ax25; char ip_mode = ' '; dst = (ax25_address *)(bp + 1); @@ -180,7 +180,7 @@ int ax25_rebuild_header(struct sk_buff * &src_c, &dst_c, digipeat, dev); if (ax25) { - ax25_cb_put(ax25); + sock_put(&ax25->sock); } goto put; } Index: linux-net/net/ax25/ax25_out.c =================================================================== --- linux-net.orig/net/ax25/ax25_out.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_out.c 2006-07-14 01:25:20.000000000 +0100 @@ -34,10 +34,10 @@ static DEFINE_SPINLOCK(ax25_frag_lock); -ax25_cb *ax25_send_frame(struct sk_buff *skb, int paclen, ax25_address *src, ax25_address *dest, ax25_digi *digi, struct net_device *dev) +struct ax25_sock *ax25_send_frame(struct sk_buff *skb, int paclen, ax25_address *src, ax25_address *dest, ax25_digi *digi, struct net_device *dev) { ax25_dev *ax25_dev; - ax25_cb *ax25; + struct ax25_sock *ax25; /* * Take the default packet length for the device if zero is @@ -61,7 +61,8 @@ ax25_cb *ax25_send_frame(struct sk_buff if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) return NULL; - if ((ax25 = ax25_create_cb()) == NULL) + ax25 = ax25_alloc_sock(NULL); + if (!ax25) return NULL; ax25_fillin_cb(ax25, ax25_dev); @@ -71,7 +72,7 @@ ax25_cb *ax25_send_frame(struct sk_buff if (digi != NULL) { if ((ax25->digipeat = kmalloc(sizeof(ax25_digi), GFP_ATOMIC)) == NULL) { - ax25_cb_put(ax25); + sock_put(&ax25->sock); return NULL; } memcpy(ax25->digipeat, digi, sizeof(ax25_digi)); @@ -112,7 +113,7 @@ EXPORT_SYMBOL(ax25_send_frame); * zero then we are not allowed to do fragmentation, even if the frame * is too large. */ -void ax25_output(ax25_cb *ax25, int paclen, struct sk_buff *skb) +void ax25_output(struct ax25_sock *ax25, int paclen, struct sk_buff *skb) { struct sk_buff *skbn; unsigned char *p; @@ -199,7 +200,7 @@ void ax25_output(ax25_cb *ax25, int pacl * This procedure is passed a buffer descriptor for an iframe. It builds * the rest of the control part of the frame and then writes it out. */ -static void ax25_send_iframe(ax25_cb *ax25, struct sk_buff *skb, int poll_bit) +static void ax25_send_iframe(struct ax25_sock *ax25, struct sk_buff *skb, int poll_bit) { unsigned char *frame; @@ -229,7 +230,7 @@ static void ax25_send_iframe(ax25_cb *ax ax25_transmit_buffer(ax25, skb, AX25_COMMAND); } -void ax25_kick(ax25_cb *ax25) +void ax25_kick(struct ax25_sock *ax25) { struct sk_buff *skb, *skbn; int last = 1; @@ -311,7 +312,7 @@ void ax25_kick(ax25_cb *ax25) } } -void ax25_transmit_buffer(ax25_cb *ax25, struct sk_buff *skb, int type) +void ax25_transmit_buffer(struct ax25_sock *ax25, struct sk_buff *skb, int type) { struct sk_buff *skbn; unsigned char *ptr; @@ -361,7 +362,7 @@ void ax25_queue_xmit(struct sk_buff *skb dev_queue_xmit(skb); } -int ax25_check_iframes_acked(ax25_cb *ax25, unsigned short nr) +int ax25_check_iframes_acked(struct ax25_sock *ax25, unsigned short nr) { if (ax25->vs == nr) { ax25_frames_acked(ax25, nr); Index: linux-net/net/ax25/ax25_route.c =================================================================== --- linux-net.orig/net/ax25/ax25_route.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_route.c 2006-07-14 01:25:20.000000000 +0100 @@ -405,7 +405,7 @@ static inline void ax25_adjust_path(ax25 /* * Find which interface to use. */ -int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr) +int ax25_rt_autobind(struct ax25_sock *ax25, ax25_address *addr) { ax25_uid_assoc *user; ax25_route *ax25_rt; Index: linux-net/net/ax25/ax25_std_in.c =================================================================== --- linux-net.orig/net/ax25/ax25_std_in.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_std_in.c 2006-07-14 01:25:20.000000000 +0100 @@ -41,7 +41,7 @@ * The handling of the timer(s) is in file ax25_std_timer.c. * Handling of state 0 and connection release is in ax25.c. */ -static int ax25_std_state1_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int pf, int type) +static int ax25_std_state1_machine(struct ax25_sock *ax25, struct sk_buff *skb, int frametype, int pf, int type) { switch (frametype) { case AX25_SABM: @@ -105,7 +105,7 @@ static int ax25_std_state1_machine(ax25_ * The handling of the timer(s) is in file ax25_std_timer.c * Handling of state 0 and connection release is in ax25.c. */ -static int ax25_std_state2_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int pf, int type) +static int ax25_std_state2_machine(struct ax25_sock *ax25, struct sk_buff *skb, int frametype, int pf, int type) { switch (frametype) { case AX25_SABM: @@ -143,7 +143,7 @@ static int ax25_std_state2_machine(ax25_ * The handling of the timer(s) is in file ax25_std_timer.c * Handling of state 0 and connection release is in ax25.c. */ -static int ax25_std_state3_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int ns, int nr, int pf, int type) +static int ax25_std_state3_machine(struct ax25_sock *ax25, struct sk_buff *skb, int frametype, int ns, int nr, int pf, int type) { int queued = 0; @@ -268,7 +268,7 @@ static int ax25_std_state3_machine(ax25_ * The handling of the timer(s) is in file ax25_std_timer.c * Handling of state 0 and connection release is in ax25.c. */ -static int ax25_std_state4_machine(ax25_cb *ax25, struct sk_buff *skb, int frametype, int ns, int nr, int pf, int type) +static int ax25_std_state4_machine(struct ax25_sock *ax25, struct sk_buff *skb, int frametype, int ns, int nr, int pf, int type) { int queued = 0; @@ -421,7 +421,7 @@ static int ax25_std_state4_machine(ax25_ /* * Higher level upcall for a LAPB frame */ -int ax25_std_frame_in(ax25_cb *ax25, struct sk_buff *skb, int type) +int ax25_std_frame_in(struct ax25_sock *ax25, struct sk_buff *skb, int type) { int queued = 0, frametype, ns, nr, pf; Index: linux-net/net/ax25/ax25_std_subr.c =================================================================== --- linux-net.orig/net/ax25/ax25_std_subr.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_std_subr.c 2006-07-14 01:25:20.000000000 +0100 @@ -32,12 +32,12 @@ * Networking Conference paper, as is the whole state machine. */ -void ax25_std_nr_error_recovery(ax25_cb *ax25) +void ax25_std_nr_error_recovery(struct ax25_sock *ax25) { ax25_std_establish_data_link(ax25); } -void ax25_std_establish_data_link(ax25_cb *ax25) +void ax25_std_establish_data_link(struct ax25_sock *ax25) { ax25->condition = 0x00; ax25->n2count = 0; @@ -54,7 +54,7 @@ void ax25_std_establish_data_link(ax25_c ax25_start_t1timer(ax25); } -void ax25_std_transmit_enquiry(ax25_cb *ax25) +void ax25_std_transmit_enquiry(struct ax25_sock *ax25) { if (ax25->condition & AX25_COND_OWN_RX_BUSY) ax25_send_control(ax25, AX25_RNR, AX25_POLLON, AX25_COMMAND); @@ -67,7 +67,7 @@ void ax25_std_transmit_enquiry(ax25_cb * ax25_start_t1timer(ax25); } -void ax25_std_enquiry_response(ax25_cb *ax25) +void ax25_std_enquiry_response(struct ax25_sock *ax25) { if (ax25->condition & AX25_COND_OWN_RX_BUSY) ax25_send_control(ax25, AX25_RNR, AX25_POLLON, AX25_RESPONSE); @@ -77,7 +77,7 @@ void ax25_std_enquiry_response(ax25_cb * ax25->condition &= ~AX25_COND_ACK_PENDING; } -void ax25_std_timeout_response(ax25_cb *ax25) +void ax25_std_timeout_response(struct ax25_sock *ax25) { if (ax25->condition & AX25_COND_OWN_RX_BUSY) ax25_send_control(ax25, AX25_RNR, AX25_POLLOFF, AX25_RESPONSE); Index: linux-net/net/ax25/ax25_std_timer.c =================================================================== --- linux-net.orig/net/ax25/ax25_std_timer.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_std_timer.c 2006-07-14 01:25:20.000000000 +0100 @@ -31,7 +31,7 @@ #include <linux/mm.h> #include <linux/interrupt.h> -void ax25_std_heartbeat_expiry(ax25_cb *ax25) +void ax25_std_heartbeat_expiry(struct ax25_sock *ax25) { struct sock *sk=ax25->sk; @@ -79,7 +79,7 @@ void ax25_std_heartbeat_expiry(ax25_cb * ax25_start_heartbeat(ax25); } -void ax25_std_t2timer_expiry(ax25_cb *ax25) +void ax25_std_t2timer_expiry(struct ax25_sock *ax25) { if (ax25->condition & AX25_COND_ACK_PENDING) { ax25->condition &= ~AX25_COND_ACK_PENDING; @@ -87,14 +87,14 @@ void ax25_std_t2timer_expiry(ax25_cb *ax } } -void ax25_std_t3timer_expiry(ax25_cb *ax25) +void ax25_std_t3timer_expiry(struct ax25_sock *ax25) { ax25->n2count = 0; ax25_std_transmit_enquiry(ax25); ax25->state = AX25_STATE_4; } -void ax25_std_idletimer_expiry(ax25_cb *ax25) +void ax25_std_idletimer_expiry(struct ax25_sock *ax25) { ax25_clear_queues(ax25); @@ -120,7 +120,7 @@ void ax25_std_idletimer_expiry(ax25_cb * } } -void ax25_std_t1timer_expiry(ax25_cb *ax25) +void ax25_std_t1timer_expiry(struct ax25_sock *ax25) { switch (ax25->state) { case AX25_STATE_1: Index: linux-net/net/ax25/ax25_subr.c =================================================================== --- linux-net.orig/net/ax25/ax25_subr.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_subr.c 2006-07-14 01:25:20.000000000 +0100 @@ -34,7 +34,7 @@ /* * This routine purges all the queues of frames. */ -void ax25_clear_queues(ax25_cb *ax25) +void ax25_clear_queues(struct ax25_sock *ax25) { skb_queue_purge(&ax25->write_queue); skb_queue_purge(&ax25->ack_queue); @@ -47,7 +47,7 @@ void ax25_clear_queues(ax25_cb *ax25) * acknowledged. This replaces the boxes labelled "V(a) <- N(r)" on the * SDL diagram. */ -void ax25_frames_acked(ax25_cb *ax25, unsigned short nr) +void ax25_frames_acked(struct ax25_sock *ax25, unsigned short nr) { struct sk_buff *skb; @@ -63,7 +63,7 @@ void ax25_frames_acked(ax25_cb *ax25, un } } -void ax25_requeue_frames(ax25_cb *ax25) +void ax25_requeue_frames(struct ax25_sock *ax25) { struct sk_buff *skb, *skb_prev = NULL; @@ -85,7 +85,7 @@ void ax25_requeue_frames(ax25_cb *ax25) * Validate that the value of nr is between va and vs. Return true or * false for testing. */ -int ax25_validate_nr(ax25_cb *ax25, unsigned short nr) +int ax25_validate_nr(struct ax25_sock *ax25, unsigned short nr) { unsigned short vc = ax25->va; @@ -103,7 +103,7 @@ int ax25_validate_nr(ax25_cb *ax25, unsi * This routine is the centralised routine for parsing the control * information for the different frame formats. */ -int ax25_decode(ax25_cb *ax25, struct sk_buff *skb, int *ns, int *nr, int *pf) +int ax25_decode(struct ax25_sock *ax25, struct sk_buff *skb, int *ns, int *nr, int *pf) { unsigned char *frame; int frametype = AX25_ILLEGAL; @@ -153,7 +153,7 @@ int ax25_decode(ax25_cb *ax25, struct sk * command or response for the remote machine ( eg. RR, UA etc. ). * Only supervisory or unnumbered frames are processed. */ -void ax25_send_control(ax25_cb *ax25, int frametype, int poll_bit, int type) +void ax25_send_control(struct ax25_sock *ax25, int frametype, int poll_bit, int type) { struct sk_buff *skb; unsigned char *dptr; @@ -226,7 +226,7 @@ void ax25_return_dm(struct net_device *d /* * Exponential backoff for AX.25 */ -void ax25_calculate_t1(ax25_cb *ax25) +void ax25_calculate_t1(struct ax25_sock *ax25) { int n, t = 2; @@ -251,7 +251,7 @@ void ax25_calculate_t1(ax25_cb *ax25) /* * Calculate the Round Trip Time */ -void ax25_calculate_rtt(ax25_cb *ax25) +void ax25_calculate_rtt(struct ax25_sock *ax25) { if (ax25->backoff == 0) return; @@ -266,7 +266,7 @@ void ax25_calculate_rtt(ax25_cb *ax25) ax25->rtt = AX25_T1CLAMPHI; } -void ax25_disconnect(ax25_cb *ax25, int reason) +void ax25_disconnect(struct ax25_sock *ax25, int reason) { ax25_clear_queues(ax25); Index: linux-net/net/ax25/ax25_timer.c =================================================================== --- linux-net.orig/net/ax25/ax25_timer.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/ax25/ax25_timer.c 2006-07-14 01:25:20.000000000 +0100 @@ -40,7 +40,7 @@ static void ax25_t2timer_expiry(unsigned static void ax25_t3timer_expiry(unsigned long); static void ax25_idletimer_expiry(unsigned long); -void ax25_start_heartbeat(ax25_cb *ax25) +void ax25_start_heartbeat(struct ax25_sock *ax25) { del_timer(&ax25->timer); @@ -51,7 +51,7 @@ void ax25_start_heartbeat(ax25_cb *ax25) add_timer(&ax25->timer); } -void ax25_start_t1timer(ax25_cb *ax25) +void ax25_start_t1timer(struct ax25_sock *ax25) { del_timer(&ax25->t1timer); @@ -62,7 +62,7 @@ void ax25_start_t1timer(ax25_cb *ax25) add_timer(&ax25->t1timer); } -void ax25_start_t2timer(ax25_cb *ax25) +void ax25_start_t2timer(struct ax25_sock *ax25) { del_timer(&ax25->t2timer); @@ -73,7 +73,7 @@ void ax25_start_t2timer(ax25_cb *ax25) add_timer(&ax25->t2timer); } -void ax25_start_t3timer(ax25_cb *ax25) +void ax25_start_t3timer(struct ax25_sock *ax25) { del_timer(&ax25->t3timer); @@ -86,7 +86,7 @@ void ax25_start_t3timer(ax25_cb *ax25) } } -void ax25_start_idletimer(ax25_cb *ax25) +void ax25_start_idletimer(struct ax25_sock *ax25) { del_timer(&ax25->idletimer); @@ -99,32 +99,32 @@ void ax25_start_idletimer(ax25_cb *ax25) } } -void ax25_stop_heartbeat(ax25_cb *ax25) +void ax25_stop_heartbeat(struct ax25_sock *ax25) { del_timer(&ax25->timer); } -void ax25_stop_t1timer(ax25_cb *ax25) +void ax25_stop_t1timer(struct ax25_sock *ax25) { del_timer(&ax25->t1timer); } -void ax25_stop_t2timer(ax25_cb *ax25) +void ax25_stop_t2timer(struct ax25_sock *ax25) { del_timer(&ax25->t2timer); } -void ax25_stop_t3timer(ax25_cb *ax25) +void ax25_stop_t3timer(struct ax25_sock *ax25) { del_timer(&ax25->t3timer); } -void ax25_stop_idletimer(ax25_cb *ax25) +void ax25_stop_idletimer(struct ax25_sock *ax25) { del_timer(&ax25->idletimer); } -int ax25_t1timer_running(ax25_cb *ax25) +int ax25_t1timer_running(struct ax25_sock *ax25) { return timer_pending(&ax25->t1timer); } @@ -142,7 +142,7 @@ EXPORT_SYMBOL(ax25_display_timer); static void ax25_heartbeat_expiry(unsigned long param) { int proto = AX25_PROTO_STD_SIMPLEX; - ax25_cb *ax25 = (ax25_cb *)param; + struct ax25_sock *ax25 = (struct ax25_sock *)param; if (ax25->ax25_dev) proto = ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]; @@ -166,7 +166,7 @@ static void ax25_heartbeat_expiry(unsign static void ax25_t1timer_expiry(unsigned long param) { - ax25_cb *ax25 = (ax25_cb *)param; + struct ax25_sock *ax25 = (struct ax25_sock *)param; switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { case AX25_PROTO_STD_SIMPLEX: @@ -185,7 +185,7 @@ static void ax25_t1timer_expiry(unsigned static void ax25_t2timer_expiry(unsigned long param) { - ax25_cb *ax25 = (ax25_cb *)param; + struct ax25_sock *ax25 = (struct ax25_sock *)param; switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { case AX25_PROTO_STD_SIMPLEX: @@ -204,7 +204,7 @@ static void ax25_t2timer_expiry(unsigned static void ax25_t3timer_expiry(unsigned long param) { - ax25_cb *ax25 = (ax25_cb *)param; + struct ax25_sock *ax25 = (struct ax25_sock *)param; switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { case AX25_PROTO_STD_SIMPLEX: @@ -225,7 +225,7 @@ static void ax25_t3timer_expiry(unsigned static void ax25_idletimer_expiry(unsigned long param) { - ax25_cb *ax25 = (ax25_cb *)param; + struct ax25_sock *ax25 = (struct ax25_sock *)param; switch (ax25->ax25_dev->values[AX25_VALUES_PROTOCOL]) { case AX25_PROTO_STD_SIMPLEX: Index: linux-net/net/netrom/nr_route.c =================================================================== --- linux-net.orig/net/netrom/nr_route.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/netrom/nr_route.c 2006-07-14 01:25:20.000000000 +0100 @@ -718,7 +718,7 @@ int nr_rt_ioctl(unsigned int cmd, void _ * A level 2 link has timed out, therefore it appears to be a poor link, * then don't use that neighbour until it is reset. */ -void nr_link_failed(ax25_cb *ax25, int reason) +void nr_link_failed(struct ax25_sock *ax25, int reason) { struct nr_neigh *s, *nr_neigh = NULL; struct hlist_node *node; @@ -738,7 +738,7 @@ void nr_link_failed(ax25_cb *ax25, int r return; nr_neigh->ax25 = NULL; - ax25_cb_put(ax25); + sock_put(&ax25->sock); if (++nr_neigh->failed < sysctl_netrom_link_fails_count) { nr_neigh_put(nr_neigh); @@ -757,17 +757,17 @@ void nr_link_failed(ax25_cb *ax25, int r } /* - * Route a frame to an appropriate AX.25 connection. A NULL ax25_cb + * Route a frame to an appropriate AX.25 connection. A NULL struct ax25_sock * indicates an internally generated frame. */ -int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25) +int nr_route_frame(struct sk_buff *skb, struct ax25_sock *ax25) { ax25_address *nr_src, *nr_dest; struct nr_neigh *nr_neigh; struct nr_node *nr_node; struct net_device *dev; unsigned char *dptr; - ax25_cb *ax25s; + struct ax25_sock *ax25s; int ret; struct sk_buff *skbn; @@ -833,8 +833,8 @@ int nr_route_frame(struct sk_buff *skb, ax25s = ax25_send_frame(skb, 256, (ax25_address *)dev->dev_addr, &nr_neigh->callsign, nr_neigh->digipeat, nr_neigh->dev); if (nr_neigh->ax25 && ax25s) { - /* We were already holding this ax25_cb */ - ax25_cb_put(ax25s); + /* We were already holding this struct ax25_sock */ + sock_put(&ax25s->sock); } nr_neigh->ax25 = ax25s; Index: linux-net/net/rose/rose_route.c =================================================================== --- linux-net.orig/net/rose/rose_route.c 2006-07-14 01:22:39.000000000 +0100 +++ linux-net/net/rose/rose_route.c 2006-07-14 01:25:20.000000000 +0100 @@ -790,7 +790,7 @@ static void rose_del_route_by_neigh(stru * then don't use that neighbour until it is reset. Blow away all through * routes and connections using this route. */ -void rose_link_failed(ax25_cb *ax25, int reason) +void rose_link_failed(struct ax25_sock *ax25, int reason) { struct rose_neigh *rose_neigh; @@ -830,7 +830,7 @@ void rose_link_device_down(struct net_de /* * Route a frame to an appropriate AX.25 connection. */ -int rose_route_frame(struct sk_buff *skb, ax25_cb *ax25) +int rose_route_frame(struct sk_buff *skb, struct ax25_sock *ax25) { struct rose_neigh *rose_neigh, *new_neigh; struct rose_route *rose_route; - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html