Skip to contentSkip to conversation

llc: Make function pointer arrays const

PATCH Applied Joe Perches 2 participants 6 messages Dec 10, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 llc: Make function pointer arrays const

It's better when function pointer arrays aren't modifiable.

---
 include/net/llc_c_st.h |   2 +-
 net/llc/llc_c_st.c     | 470 ++++++++++++++++++++++++-------------------------
 net/llc/llc_conn.c     |   2 +-
 3 files changed, 237 insertions(+), 237 deletions(-)
include/net/llc_c_st.h +1 -1
index 0e79cfb..60e2ebb 100644
@@ -36,7 +36,7 @@ struct llc_conn_state_trans {
 	llc_conn_ev_t	   ev;
 	u8		   next_state;
 	llc_conn_ev_qfyr_t *ev_qualifiers;
-	llc_conn_action_t  *ev_actions;
+	const llc_conn_action_t  *ev_actions;
 };
 
 struct llc_conn_state {
net/llc/llc_c_st.c +235 -235

1,880 lines not on this page · raw message

net/llc/llc_conn.c +1 -1
index 42dc2e4..75baa2b 100644
@@ -454,7 +454,7 @@ static int llc_exec_conn_trans_actions(struct sock *sk,
 				       struct sk_buff *skb)
 {
 	int rc = 0;
-	llc_conn_action_t *next_action;
+	const llc_conn_action_t *next_action;
 
 	for (next_action = trans->ev_actions;
 	     next_action && *next_action; next_action++) {
#1 lore raw

PATCH 1/1 llc: Make llc_conn_ev_qfyr_t function pointer arrays const

It's better when function pointer arrays aren't modifiable.

Net change from original:

$ size net/llc/built-in.o.*
   text	   data	    bss	    dec	    hex	filename
  61065	  12886	   1344	  75295	  1261f	net/llc/built-in.o.new
  47113	  27030	   1344	  75487	  126df	net/llc/built-in.o.old

---

The first patch should have specified which function pointer array type was being updated. Oh well.

 include/net/llc_c_st.h |   2 +-
 net/llc/llc_c_st.c     | 238 ++++++++++++++++++++++++-------------------------
 net/llc/llc_conn.c     |   2 +-
 3 files changed, 121 insertions(+), 121 deletions(-)
include/net/llc_c_st.h +1 -1
index 60e2ebb..48f3f89 100644
@@ -35,7 +35,7 @@
 struct llc_conn_state_trans {
 	llc_conn_ev_t	   ev;
 	u8		   next_state;
-	llc_conn_ev_qfyr_t *ev_qualifiers;
+	const llc_conn_ev_qfyr_t *ev_qualifiers;
 	const llc_conn_action_t  *ev_actions;
 };
 
net/llc/llc_c_st.c +119 -119

952 lines not on this page · raw message

net/llc/llc_conn.c +1 -1
index 75baa2b..81a61fc 100644
@@ -406,7 +406,7 @@ static struct llc_conn_state_trans *llc_qualify_conn_ev(struct sock *sk,
 							struct sk_buff *skb)
 {
 	struct llc_conn_state_trans **next_trans;
-	llc_conn_ev_qfyr_t *next_qualifier;
+	const llc_conn_ev_qfyr_t *next_qualifier;
 	struct llc_conn_state_ev *ev = llc_conn_ev(skb);
 	struct llc_sock *llc = llc_sk(sk);
 	struct llc_conn_state *curr_state =
#2 lore raw

PATCH 1/1 llc: Make llc_sap_action_t function pointer arrays const

It's better when function pointer arrays aren't modifiable.

Net change:

$ size net/llc/built-in.o.*
   text	   data	    bss	    dec	    hex	filename
  61193	  12758	   1344	  75295	  1261f	net/llc/built-in.o.new
  47113	  27030	   1344	  75487	  126df	net/llc/built-in.o.old

---

No more of these in llc. Let me know if you need a clean resubmission of all 3 of this llc series.

 include/net/llc_s_st.h |  2 +-
 net/llc/llc_s_st.c     | 20 ++++++++++----------
 net/llc/llc_sap.c      |  2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)
include/net/llc_s_st.h +1 -1
index 567c681..c4359e2 100644
@@ -19,7 +19,7 @@
 struct llc_sap_state_trans {
 	llc_sap_ev_t	  ev;
 	u8		  next_state;
-	llc_sap_action_t *ev_actions;
+	const llc_sap_action_t *ev_actions;
 };
 
 struct llc_sap_state {
net/llc/llc_s_st.c +10 -10
index 135f7d8..308c616 100644
@@ -29,7 +29,7 @@ static struct llc_sap_state_trans llc_sap_state_trans_end;
 /* state LLC_SAP_STATE_INACTIVE transition for
  * LLC_SAP_EV_ACTIVATION_REQ event
  */
-static llc_sap_action_t llc_sap_inactive_state_actions_1[] = {
+static const llc_sap_action_t llc_sap_inactive_state_actions_1[] = {
 	[0] = llc_sap_action_report_status,
 	[1] = NULL,
 };
@@ -47,7 +47,7 @@ static struct llc_sap_state_trans *llc_sap_inactive_state_transitions[] = {
 };
 
 /* state LLC_SAP_STATE_ACTIVE transition for LLC_SAP_EV_RX_UI event */
-static llc_sap_action_t llc_sap_active_state_actions_1[] = {
+static const llc_sap_action_t llc_sap_active_state_actions_1[] = {
 	[0] = llc_sap_action_unitdata_ind,
 	[1] = NULL,
 };
@@ -59,7 +59,7 @@ static struct llc_sap_state_trans llc_sap_active_state_trans_1 = {
 };
 
 /* state LLC_SAP_STATE_ACTIVE transition for LLC_SAP_EV_UNITDATA_REQ event */
-static llc_sap_action_t llc_sap_active_state_actions_2[] = {
+static const llc_sap_action_t llc_sap_active_state_actions_2[] = {
 	[0] = llc_sap_action_send_ui,
 	[1] = NULL,
 };
@@ -71,7 +71,7 @@ static struct llc_sap_state_trans llc_sap_active_state_trans_2 = {
 };
 
 /* state LLC_SAP_STATE_ACTIVE transition for LLC_SAP_EV_XID_REQ event */
-static llc_sap_action_t llc_sap_active_state_actions_3[] = {
+static const llc_sap_action_t llc_sap_active_state_actions_3[] = {
 	[0] = llc_sap_action_send_xid_c,
 	[1] = NULL,
 };
@@ -83,7 +83,7 @@ static struct llc_sap_state_trans llc_sap_active_state_trans_3 = {
 };
 
 /* state LLC_SAP_STATE_ACTIVE transition for LLC_SAP_EV_RX_XID_C event */
-static llc_sap_action_t llc_sap_active_state_actions_4[] = {
+static const llc_sap_action_t llc_sap_active_state_actions_4[] = {
 	[0] = llc_sap_action_send_xid_r,
 	[1] = NULL,
 };
@@ -95,7 +95,7 @@ static struct llc_sap_state_trans llc_sap_active_state_trans_4 = {
 };
 
 /* state LLC_SAP_STATE_ACTIVE transition for LLC_SAP_EV_RX_XID_R event */
-static llc_sap_action_t llc_sap_active_state_actions_5[] = {
+static const llc_sap_action_t llc_sap_active_state_actions_5[] = {
 	[0] = llc_sap_action_xid_ind,
 	[1] = NULL,
 };
@@ -107,7 +107,7 @@ static struct llc_sap_state_trans llc_sap_active_state_trans_5 = {
 };
 
 /* state LLC_SAP_STATE_ACTIVE transition for LLC_SAP_EV_TEST_REQ event */
-static llc_sap_action_t llc_sap_active_state_actions_6[] = {
+static const llc_sap_action_t llc_sap_active_state_actions_6[] = {
 	[0] = llc_sap_action_send_test_c,
 	[1] = NULL,
 };
@@ -119,7 +119,7 @@ static struct llc_sap_state_trans llc_sap_active_state_trans_6 = {
 };
 
 /* state LLC_SAP_STATE_ACTIVE transition for LLC_SAP_EV_RX_TEST_C event */
-static llc_sap_action_t llc_sap_active_state_actions_7[] = {
+static const llc_sap_action_t llc_sap_active_state_actions_7[] = {
 	[0] = llc_sap_action_send_test_r,
 	[1] = NULL,
 };
@@ -131,7 +131,7 @@ static struct llc_sap_state_trans llc_sap_active_state_trans_7 = {
 };
 
 /* state LLC_SAP_STATE_ACTIVE transition for LLC_SAP_EV_RX_TEST_R event */
-static llc_sap_action_t llc_sap_active_state_actions_8[] = {
+static const llc_sap_action_t llc_sap_active_state_actions_8[] = {
 	[0] = llc_sap_action_test_ind,
 	[1] = NULL,
 };
@@ -145,7 +145,7 @@ static struct llc_sap_state_trans llc_sap_active_state_trans_8 = {
 /* state LLC_SAP_STATE_ACTIVE transition for
  * LLC_SAP_EV_DEACTIVATION_REQ event
  */
-static llc_sap_action_t llc_sap_active_state_actions_9[] = {
+static const llc_sap_action_t llc_sap_active_state_actions_9[] = {
 	[0] = llc_sap_action_report_status,
 	[1] = NULL,
 };
net/llc/llc_sap.c +1 -1
index 06033f6..d0e1e80 100644
@@ -146,7 +146,7 @@ static int llc_exec_sap_trans_actions(struct llc_sap *sap,
 				      struct sk_buff *skb)
 {
 	int rc = 0;
-	llc_sap_action_t *next_action = trans->ev_actions;
+	const llc_sap_action_t *next_action = trans->ev_actions;
 
 	for (; next_action && *next_action; next_action++)
 		if ((*next_action)(sap, skb))
maintainer Applied
#3 lore raw

Re: [PATCH 3] llc: Make llc_sap_action_t function pointer arrays const

From: Joe Perches <[email protected]>
Date: Wed, 10 Dec 2014 09:55:50 -0800

Quoted 10 lines

It's better when function pointer arrays aren't modifiable.

Net change:

$ size net/llc/built-in.o.*
   text	   data	    bss	    dec	    hex	filename
  61193	  12758	   1344	  75295	  1261f	net/llc/built-in.o.new
  47113	  27030	   1344	  75487	  126df	net/llc/built-in.o.old

Applied.

maintainer Applied
#4 lore raw

Re: [PATCH 2] llc: Make llc_conn_ev_qfyr_t function pointer arrays const

In reply to Joe Perches

From: Joe Perches <[email protected]>
Date: Wed, 10 Dec 2014 09:43:57 -0800

Quoted 10 lines

It's better when function pointer arrays aren't modifiable.

Net change from original:

$ size net/llc/built-in.o.*
   text	   data	    bss	    dec	    hex	filename
  61065	  12886	   1344	  75295	  1261f	net/llc/built-in.o.new
  47113	  27030	   1344	  75487	  126df	net/llc/built-in.o.old

Applied.