svn commit: r297208 - head/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Wed Mar 23 13:28:06 UTC 2016


Author: tuexen
Date: Wed Mar 23 13:28:04 2016
New Revision: 297208
URL: https://svnweb.freebsd.org/changeset/base/297208

Log:
  Add const to several constants. Thanks to Nicholas Nethercote for
  providing the patch via
  https://bugzilla.mozilla.org/show_bug.cgi?id=1255655
  
  MFC after:	1 week

Modified:
  head/sys/netinet/sctp_cc_functions.c
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_ss_functions.c
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctp_cc_functions.c
==============================================================================
--- head/sys/netinet/sctp_cc_functions.c	Wed Mar 23 12:13:53 2016	(r297207)
+++ head/sys/netinet/sctp_cc_functions.c	Wed Mar 23 13:28:04 2016	(r297208)
@@ -1526,13 +1526,13 @@ sctp_rtt_rtcc_calculated(struct sctp_tcb
 
 struct sctp_hs_raise_drop {
 	int32_t cwnd;
-	int32_t increase;
-	int32_t drop_percent;
+	int8_t increase;
+	int8_t drop_percent;
 };
 
 #define SCTP_HS_TABLE_SIZE 73
 
-struct sctp_hs_raise_drop sctp_cwnd_adjust[SCTP_HS_TABLE_SIZE] = {
+static const struct sctp_hs_raise_drop sctp_cwnd_adjust[SCTP_HS_TABLE_SIZE] = {
 	{38, 1, 50},		/* 0   */
 	{118, 2, 44},		/* 1   */
 	{221, 3, 41},		/* 2   */
@@ -1632,7 +1632,7 @@ sctp_hs_cwnd_increase(struct sctp_tcb *s
 			}
 		}
 		net->last_hs_used = indx;
-		incr = ((sctp_cwnd_adjust[indx].increase) << 10);
+		incr = (((int32_t) sctp_cwnd_adjust[indx].increase) << 10);
 		net->cwnd += incr;
 	}
 	sctp_enforce_cwnd_limit(&stcb->asoc, net);
@@ -1658,7 +1658,7 @@ sctp_hs_cwnd_decrease(struct sctp_tcb *s
 	} else {
 		/* drop by the proper amount */
 		net->ssthresh = net->cwnd - (int)((net->cwnd / 100) *
-		    sctp_cwnd_adjust[net->last_hs_used].drop_percent);
+		    (int32_t) sctp_cwnd_adjust[net->last_hs_used].drop_percent);
 		net->cwnd = net->ssthresh;
 		/* now where are we */
 		indx = net->last_hs_used;
@@ -2323,7 +2323,7 @@ sctp_htcp_cwnd_update_after_ecn_echo(str
 	}
 }
 
-struct sctp_cc_functions sctp_cc_functions[] = {
+const struct sctp_cc_functions sctp_cc_functions[] = {
 	{
 		.sctp_set_initial_cc_param = sctp_set_initial_cc_param,
 		.sctp_cwnd_update_after_sack = sctp_cwnd_update_after_sack,

Modified: head/sys/netinet/sctp_indata.c
==============================================================================
--- head/sys/netinet/sctp_indata.c	Wed Mar 23 12:13:53 2016	(r297207)
+++ head/sys/netinet/sctp_indata.c	Wed Mar 23 13:28:04 2016	(r297208)
@@ -1948,7 +1948,7 @@ finish_express_del:
 	return (1);
 }
 
-int8_t sctp_map_lookup_tab[256] = {
+static const int8_t sctp_map_lookup_tab[256] = {
 	0, 1, 0, 2, 0, 1, 0, 3,
 	0, 1, 0, 2, 0, 1, 0, 4,
 	0, 1, 0, 2, 0, 1, 0, 3,

Modified: head/sys/netinet/sctp_output.c
==============================================================================
--- head/sys/netinet/sctp_output.c	Wed Mar 23 12:13:53 2016	(r297207)
+++ head/sys/netinet/sctp_output.c	Wed Mar 23 13:28:04 2016	(r297208)
@@ -67,7 +67,7 @@ struct sack_track {
 	struct sctp_gap_ack_block gaps[SCTP_MAX_GAPS_INARRAY];
 };
 
-struct sack_track sack_array[256] = {
+const struct sack_track sack_array[256] = {
 	{0, 0, 0, 0,		/* 0x00 */
 		{{0, 0},
 		{0, 0},
@@ -10414,7 +10414,7 @@ sctp_send_sack(struct sctp_tcb *stcb, in
 	struct sctp_sack_chunk *sack;
 	struct sctp_nr_sack_chunk *nr_sack;
 	struct sctp_gap_ack_block *gap_descriptor;
-	struct sack_track *selector;
+	const struct sack_track *selector;
 	int mergeable = 0;
 	int offset;
 	caddr_t limit;

Modified: head/sys/netinet/sctp_ss_functions.c
==============================================================================
--- head/sys/netinet/sctp_ss_functions.c	Wed Mar 23 12:13:53 2016	(r297207)
+++ head/sys/netinet/sctp_ss_functions.c	Wed Mar 23 13:28:04 2016	(r297208)
@@ -822,7 +822,7 @@ default_again:
 	return (strq);
 }
 
-struct sctp_ss_functions sctp_ss_functions[] = {
+const struct sctp_ss_functions sctp_ss_functions[] = {
 /* SCTP_SS_DEFAULT */
 	{
 		.sctp_ss_init = sctp_ss_default_init,

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c	Wed Mar 23 12:13:53 2016	(r297207)
+++ head/sys/netinet/sctp_usrreq.c	Wed Mar 23 13:28:04 2016	(r297208)
@@ -54,8 +54,8 @@ __FBSDID("$FreeBSD$");
 
 
 
-extern struct sctp_cc_functions sctp_cc_functions[];
-extern struct sctp_ss_functions sctp_ss_functions[];
+extern const struct sctp_cc_functions sctp_cc_functions[];
+extern const struct sctp_ss_functions sctp_ss_functions[];
 
 void
 sctp_init(void)
@@ -5862,7 +5862,7 @@ sctp_setopt(struct socket *so, int optna
 					SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
 					error = EINVAL;
 				}
-				sctp_chunk_output(inp, stcb,  SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED);
+				sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED);
 		out_of_it:
 				SCTP_TCB_UNLOCK(stcb);
 			} else {

Modified: head/sys/netinet/sctputil.c
==============================================================================
--- head/sys/netinet/sctputil.c	Wed Mar 23 12:13:53 2016	(r297207)
+++ head/sys/netinet/sctputil.c	Wed Mar 23 13:28:04 2016	(r297208)
@@ -58,8 +58,8 @@ __FBSDID("$FreeBSD$");
 #define KTR_SCTP KTR_SUBSYS
 #endif
 
-extern struct sctp_cc_functions sctp_cc_functions[];
-extern struct sctp_ss_functions sctp_ss_functions[];
+extern const struct sctp_cc_functions sctp_cc_functions[];
+extern const struct sctp_ss_functions sctp_ss_functions[];
 
 void
 sctp_sblog(struct sockbuf *sb, struct sctp_tcb *stcb, int from, int incr)


More information about the svn-src-head mailing list