net/llc/: misc possible cleanups
Subsystems (3)
PATCH 1/1 net/llc/: misc possible cleanups
The patch below contains the following possible cleanups:
- make some needlessly global code static
- remove the following unused global functions:
- lc_c_ac.c: llc_conn_ac_report_status
- lc_c_ac.c: llc_conn_ac_send_dm_rsp_f_set_f_flag
- lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1
- lc_c_ac.c: llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr
- lc_c_ac.c: llc_conn_ac_send_ack_cmd_p_set_1
- lc_c_ac.c: llc_conn_ac_send_ua_rsp_f_set_f_flag
- lc_c_ac.c: llc_conn_ac_set_f_flag_p
- llc_c_ev.c: llc_conn_ev_conn_resp
- llc_c_ev.c: llc_conn_ev_rst_resp
- llc_c_ev.c: llc_conn_ev_rx_xxx_cmd_pbit_set_0
- llc_c_ev.c: llc_conn_ev_rx_xxx_yyy
- llc_c_ev.c: llc_conn_ev_any_tmr_exp
- llc_c_ev.c: llc_conn_ev_qlfy_init_p_f_cycle
- llc_c_ev.c: llc_conn_ev_qlfy_set_status_impossible
- llc_c_ev.c: llc_conn_ev_qlfy_set_status_received
- llc_if.c: llc_build_and_send_reset_pkt
- llc_pdu.c: llc_pdu_decode_cr_bit
- remove the following unneeded EXPORT_SYMBOL:
- llc_core.c: llc_sap_list_lock
Please comment on which of these changes are correct and which conflict with pending patches.
diffstat output:
include/net/llc_c_ac.h | 19 ------ include/net/llc_c_ev.h | 12 --- include/net/llc_conn.h | 3 include/net/llc_pdu.h | 1 include/net/llc_sap.h | 1 net/llc/llc_c_ac.c | 127 ++++------------------------------------- net/llc/llc_c_ev.c | 88 ---------------------------- net/llc/llc_conn.c | 7 +- net/llc/llc_core.c | 7 -- net/llc/llc_if.c | 24 ------- net/llc/llc_pdu.c | 13 ---- net/llc/llc_proc.c | 4 - net/llc/llc_sap.c | 5 - net/llc/llc_station.c | 2 14 files changed, 27 insertions(+), 286 deletions(-)
include/net/llc_c_ac.h renamed from include/net/llc_c_ac.h.old +0 -19
@@ -96,7 +96,6 @@extern int llc_conn_ac_disc_ind (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_rst_ind (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_rst_confirm (struct sock * sk,struct sk_buff *skb); -extern int llc_conn_ac_report_status (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_clear_remote_busy_if_f_eq_1 (struct sock * sk,struct sk_buff *skb); extern int llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2(struct sock* sk,
@@ -107,8 +106,6 @@ struct sk_buff *skb);extern int llc_conn_ac_send_dm_rsp_f_set_1 (struct sock * sk,struct sk_buff *skb); -extern int llc_conn_ac_send_dm_rsp_f_set_f_flag (struct sock * sk, -struct sk_buff *skb);extern int llc_conn_ac_send_frmr_rsp_f_set_x (struct sock * sk,struct sk_buff *skb); extern int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock* sk,
@@ -116,11 +113,6 @@extern int llc_conn_ac_resend_frmr_rsp_f_set_p (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_send_i_cmd_p_set_1 (struct sock * sk,struct sk_buff *skb); -extern int llc_conn_ac_send_i_cmd_p_set_0 (struct sock * sk,struct sk_buff *skb); -extern int llc_conn_ac_resend_i_cmd_p_set_1 (struct sock * sk, -struct sk_buff *skb); -extern int llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr (struct sock * sk, -struct sk_buff *skb);extern int llc_conn_ac_send_i_xxx_x_set_0 (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_resend_i_xxx_x_set_0 (struct sock * sk,struct sk_buff *skb);
@@ -145,8 +137,6 @@ struct sk_buff *skb);extern int llc_conn_ac_send_rr_cmd_p_set_1 (struct sock * sk,struct sk_buff *skb); -extern int llc_conn_ac_send_ack_cmd_p_set_1 (struct sock * sk, -struct sk_buff *skb);extern int llc_conn_ac_send_rr_rsp_f_set_1 (struct sock * sk,struct sk_buff *skb); extern int llc_conn_ac_send_ack_rsp_f_set_1(struct sock* sk,
@@ -157,8 +147,6 @@ struct sk_buff *skb);extern int llc_conn_ac_send_sabme_cmd_p_set_x (struct sock * sk,struct sk_buff *skb); -extern int llc_conn_ac_send_ua_rsp_f_set_f_flag (struct sock * sk, -struct sk_buff *skb);extern int llc_conn_ac_send_ua_rsp_f_set_p (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_set_s_flag_0 (struct sock * sk,struct sk_buff *skb);
@@ -183,7 +171,6 @@extern int llc_conn_ac_set_data_flag_1_if_data_flag_eq_0 (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_set_p_flag_0 (struct sock * sk,struct sk_buff *skb); -extern int llc_conn_ac_set_p_flag_1 (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_set_remote_busy_0 (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_set_retry_cnt_0 (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_set_cause_flag_0 (struct sock * sk,struct sk_buff *skb);
@@ -195,20 +182,14 @@extern int llc_conn_ac_set_vs_nr (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_rst_vs (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_upd_vs (struct sock * sk,struct sk_buff *skb); -extern int llc_conn_ac_set_f_flag_p (struct sock * sk,struct sk_buff *skb);extern int llc_conn_disc (struct sock * sk,struct sk_buff *skb);extern int llc_conn_reset (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_disc_confirm (struct sock * sk,struct sk_buff *skb);extern u8 llc_circular_between (u8 a,u8 b,u8 c);extern int llc_conn_ac_send_ack_if_needed (struct sock * sk,struct sk_buff *skb); -extern int llc_conn_ac_inc_npta_value (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_adjust_npta_by_rr (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_adjust_npta_by_rnr (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_rst_sendack_flag (struct sock * sk,struct sk_buff *skb); -extern int llc_conn_ac_send_rr_rsp_f_set_ackpf (struct sock * sk, -struct sk_buff *skb); -extern int llc_conn_ac_send_i_rsp_f_set_ackpf (struct sock * sk, -struct sk_buff *skb);extern int llc_conn_ac_send_i_rsp_as_ack (struct sock * sk,struct sk_buff *skb);extern int llc_conn_ac_send_i_as_ack (struct sock * sk,struct sk_buff *skb);
net/llc/llc_c_ac.c renamed from net/llc/llc_c_ac.c.old +14 -113
199 lines not on this page · raw message
include/net/llc_c_ev.h renamed from include/net/llc_c_ev.h.old +0 -12
@@ -129,11 +129,9 @@typedef int (*llc_conn_ev_qfyr_t )(struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_conn_req (struct sock *sk,struct sk_buff *skb); -extern int llc_conn_ev_conn_resp (struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_data_req (struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_disc_req (struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_rst_req (struct sock *sk,struct sk_buff *skb); -extern int llc_conn_ev_rst_resp (struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_local_busy_detected (struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_local_busy_cleared (struct sock *sk,struct sk_buff *skb);
@@ -162,7 +160,6 @@ struct sk_buff *skb);extern int llc_conn_ev_rx_xxx_rsp_fbit_set_x (struct sock *sk,struct sk_buff *skb); -extern int llc_conn_ev_rx_xxx_yyy (struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr (struct sock *sk,struct sk_buff *skb); extern int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk,
@@ -171,13 +168,10 @@extern int llc_conn_ev_ack_tmr_exp (struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_rej_tmr_exp (struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_busy_tmr_exp (struct sock *sk,struct sk_buff *skb); -extern int llc_conn_ev_any_tmr_exp (struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_sendack_tmr_exp (struct sock *sk,struct sk_buff *skb);/* NOT_USED functions and their variations */ extern int llc_conn_ev_rx_xxx_cmd_pbit_set_1 (struct sock *sk,struct sk_buff *skb); -extern int llc_conn_ev_rx_xxx_cmd_pbit_set_0 (struct sock *sk, -struct sk_buff *skb);extern int llc_conn_ev_rx_xxx_rsp_fbit_set_1 (struct sock *sk,struct sk_buff *skb); extern int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
@@ -252,20 +246,14 @@ struct sk_buff *skb);extern int llc_conn_ev_qlfy_cause_flag_eq_0 (struct sock *sk,struct sk_buff *skb); -extern int llc_conn_ev_qlfy_init_p_f_cycle (struct sock *sk, -struct sk_buff *skb);extern int llc_conn_ev_qlfy_set_status_conn (struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_qlfy_set_status_disc (struct sock *sk,struct sk_buff *skb);extern int llc_conn_ev_qlfy_set_status_failed (struct sock *sk,struct sk_buff *skb); -extern int llc_conn_ev_qlfy_set_status_impossible (struct sock *sk, -struct sk_buff *skb);extern int llc_conn_ev_qlfy_set_status_remote_busy (struct sock *sk,struct sk_buff *skb); -extern int llc_conn_ev_qlfy_set_status_received (struct sock *sk, -struct sk_buff *skb);extern int llc_conn_ev_qlfy_set_status_refuse (struct sock *sk,struct sk_buff *skb); extern int llc_conn_ev_qlfy_set_status_conflict(struct sock *sk,
net/llc/llc_c_ev.c renamed from net/llc/llc_c_ev.c.old +0 -88
136 lines not on this page · raw message
include/net/llc_conn.h renamed from include/net/llc_conn.h.old +0 -3
@@ -91,7 +91,6 @@extern void llc_sk_free (struct sock *sk);extern void llc_sk_reset (struct sock *sk); -extern int llc_sk_init (struct sock *sk);/* Access to a connection */ extern int llc_conn_state_process (struct sock *sk,struct sk_buff *skb);
@@ -106,8 +105,6 @@extern struct sock *llc_lookup_established (struct llc_sap *sap,struct llc_addr *daddr,struct llc_addr *laddr); -extern struct sock *llc_lookup_listener (struct llc_sap *sap, -struct llc_addr *laddr);extern void llc_sap_add_socket (struct llc_sap *sap,struct sock *sk);extern void llc_sap_remove_socket (struct llc_sap *sap,struct sock *sk);
net/llc/llc_conn.c renamed from net/llc/llc_conn.c.old +4 -3
@@ -503,7 +503,8 @@* local mac, and local sap. Returns pointer for parent socket found, * %NULL otherwise. */ -struct sock *llc_lookup_listener (struct llc_sap *sap,struct llc_addr *laddr) +static struct sock *llc_lookup_listener (struct llc_sap *sap, +struct llc_addr *laddr) {struct sock *rc;struct hlist_node *node;
@@ -546,7 +547,7 @@* Finds offset of next category of transitions in transition table. * Returns the start index of next category. */ -u16 find_next_offset (struct llc_conn_state *state,u16 offset) +static u16 find_next_offset (struct llc_conn_state *state,u16 offset) {u16 cnt =0 ;struct llc_conn_state_trans **next_trans;
@@ -785,7 +786,7 @@* * Initializes a socket with default llc values. */ -int llc_sk_init (struct sock * sk) +static int llc_sk_init (struct sock * sk) {struct llc_opt *llc =kmalloc (sizeof (*llc),GFP_ATOMIC );int rc = -ENOMEM ;
net/llc/llc_core.c renamed from net/llc/llc_core.c.old +3 -4
@@ -31,7 +31,7 @@* * Allocates and initializes sap. */ -struct llc_sap *llc_sap_alloc (void ) +static struct llc_sap *llc_sap_alloc (void ) {struct llc_sap *sap =kmalloc (sizeof (*sap),GFP_ATOMIC );
@@ -50,7 +50,7 @@* * Adds a sap to the LLC's station sap list. */ -void llc_add_sap (struct llc_sap *sap) +static void llc_add_sap (struct llc_sap *sap) {write_lock_bh (&llc_sap_list_lock);list_add_tail (&sap->node, &llc_sap_list);
@@ -63,7 +63,7 @@* * Removes a sap to the LLC's station sap list. */ -void llc_del_sap (struct llc_sap *sap) +static void llc_del_sap (struct llc_sap *sap) {write_lock_bh (&llc_sap_list_lock);list_del (&sap->node);
@@ -169,7 +169,6 @@EXPORT_SYMBOL (llc_station_mac_sa);EXPORT_SYMBOL (llc_sap_list); -EXPORT_SYMBOL (llc_sap_list_lock);EXPORT_SYMBOL (llc_sap_find);EXPORT_SYMBOL (llc_sap_open);EXPORT_SYMBOL (llc_sap_close);
net/llc/llc_if.c renamed from net/llc/llc_if.c.old +0 -24
@@ -155,27 +155,3 @@return rc; } -/** -* llc_build_and_send_reset_pkt - Resets an established LLC connection -* @prim: pointer to structure that contains service parameters. -* -* Called when upper layer wants to reset an established LLC connection -* with a remote machine. This function packages a proper event and sends -* it to connection component state machine. Returns 0 for success, 1 -* otherwise. -*/ -int llc_build_and_send_reset_pkt (struct sock *sk) -{ -int rc =1 ; -struct sk_buff *skb =alloc_skb (0 ,GFP_ATOMIC ); - -if (skb) { -struct llc_conn_state_ev *ev =llc_conn_ev (skb); - - ev->type =LLC_CONN_EV_TYPE_PRIM ; - ev->prim =LLC_RESET_PRIM ; - ev->prim_type =LLC_PRIM_TYPE_REQ ; - rc =llc_conn_state_process (sk, skb); - } -return rc; -}
include/net/llc_pdu.h renamed from include/net/llc_pdu.h.old +0 -1
@@ -419,7 +419,6 @@extern void llc_pdu_set_cmd_rsp (struct sk_buff *skb,u8 type);extern void llc_pdu_set_pf_bit (struct sk_buff *skb,u8 bit_value);extern void llc_pdu_decode_pf_bit (struct sk_buff *skb,u8 *pf_bit); -extern void llc_pdu_decode_cr_bit (struct sk_buff *skb,u8 *cr_bit);extern void llc_pdu_init_as_disc_cmd (struct sk_buff *skb,u8 p_bit);extern void llc_pdu_init_as_i_cmd (struct sk_buff *skb,u8 p_bit,u8 ns,u8 nr);extern void llc_pdu_init_as_rej_cmd (struct sk_buff *skb,u8 p_bit,u8 nr);
net/llc/llc_pdu.c renamed from net/llc/llc_pdu.c.old +0 -13
@@ -80,19 +80,6 @@ }/** -* llc_pdu_decode_cr_bit - extracts command response bit from LLC header -* @skb: input skb that c/r bit must be extracted from it. -* @cr_bit: command/response bit (0 or 1). -* -* This function extracts command/response bit from LLC header. this bit -* is right bit of source SAP. -*/ -void llc_pdu_decode_cr_bit (struct sk_buff *skb,u8 *cr_bit) -{ - *cr_bit =llc_pdu_un_hdr (skb)->ssap &LLC_PDU_CMD_RSP_MASK ; -} - -/** * llc_pdu_init_as_disc_cmd - Builds DISC PDU * @skb: Address of the skb to build * @p_bit: The P bit to set in the PDU
net/llc/llc_proc.c renamed from net/llc/llc_proc.c.old +2 -2
@@ -185,14 +185,14 @@return 0 ; } -struct seq_operations llc_seq_socket_ops = { +static struct seq_operations llc_seq_socket_ops = { .start = llc_seq_start, .next = llc_seq_next, .stop = llc_seq_stop, .show = llc_seq_socket_show, }; -struct seq_operations llc_seq_core_ops = { +static struct seq_operations llc_seq_core_ops = { .start = llc_seq_start, .next = llc_seq_next, .stop = llc_seq_stop,
include/net/llc_sap.h renamed from include/net/llc_sap.h.old +0 -1
@@ -14,7 +14,6 @@struct llc_sap ;struct sk_buff ; -extern void llc_sap_state_process (struct llc_sap *sap,struct sk_buff *skb);extern void llc_sap_rtn_pdu (struct llc_sap *sap,struct sk_buff *skb);extern void llc_save_primitive (struct sk_buff * skb,unsigned char prim);extern struct sk_buff *llc_alloc_frame (void );
net/llc/llc_sap.c renamed from net/llc/llc_sap.c.old +3 -2
@@ -173,7 +173,7 @@* if needed(on receiving an UI frame). sk can be null for the * datalink_proto case. */ -void llc_sap_state_process (struct llc_sap *sap,struct sk_buff *skb) +static void llc_sap_state_process (struct llc_sap *sap,struct sk_buff *skb) {struct llc_sap_state_ev *ev =llc_sap_ev (skb);
@@ -275,7 +275,8 @@* Search socket list of the SAP and finds connection using the local * mac, and local sap. Returns pointer for socket found, %NULL otherwise. */ -struct sock *llc_lookup_dgram (struct llc_sap *sap,struct llc_addr *laddr) +static struct sock *llc_lookup_dgram (struct llc_sap *sap, +struct llc_addr *laddr) {struct sock *rc;struct hlist_node *node;
net/llc/llc_station.c renamed from net/llc/llc_station.c.old +1 -1
@@ -642,7 +642,7 @@* Queues an event (on the station event queue) for handling by the * station state machine and attempts to process any queued-up events. */ -void llc_station_state_process (struct sk_buff *skb) +static void llc_station_state_process (struct sk_buff *skb) {spin_lock_bh (&llc_main_station.ev_q.lock);skb_queue_tail (&llc_main_station.ev_q.list, skb);
David S. Miller
maintainerQuoted 14 lines · On Wed, 15 Dec 2004 02:12:11 +0100 Adrian Bunk <[email protected]> wrote:
The patch below contains the following possible cleanups:
- make some needlessly global code static
- remove the following unused global functions:
-lc_c_ac.c:llc_conn_ac_report_status
-lc_c_ac.c:llc_conn_ac_send_dm_rsp_f_set_f_flag
-lc_c_ac.c:llc_conn_ac_resend_i_cmd_p_set_1
-lc_c_ac.c:llc_conn_ac_resend_i_cmd_p_set_1_or_send_rr
-lc_c_ac.c:llc_conn_ac_send_ack_cmd_p_set_1
-lc_c_ac.c:llc_conn_ac_send_ua_rsp_f_set_f_flag
-lc_c_ac.c:llc_conn_ac_set_f_flag_p
-llc_c_ev.c:llc_conn_ev_conn_resp
-llc_c_ev.c:llc_conn_ev_rst_resp
-llc_c_ev.c:llc_conn_ev_rx_xxx_cmd_pbit_set_0
-llc_c_ev.c:llc_conn_ev_rx_xxx_yyy
Quoted 8 lines
-
llc_c_ev.c:llc_conn_ev_any_tmr_exp
-llc_c_ev.c:llc_conn_ev_qlfy_init_p_f_cycle
-llc_c_ev.c:llc_conn_ev_qlfy_set_status_impossible
-llc_c_ev.c:llc_conn_ev_qlfy_set_status_received
-llc_if.c:llc_build_and_send_reset_pkt
-llc_pdu.c:llc_pdu_decode_cr_bit
- remove the following unneededEXPORT_SYMBOL:
-llc_core.c:llc_sap_list_lock
Also looks good, applied.
Thanks Adrian.