Change in osmo-bts[master]: OML: Use 'const struct abis_oml_mo *' whenever users only read

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Feb 9 08:26:04 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/12870


Change subject: OML: Use 'const struct abis_oml_mo *' whenever users only read
......................................................................

OML: Use 'const struct abis_oml_mo *' whenever users only read

Try to constrain the code a bit further by making all read-only
accesses use 'const *'.

Change-Id: I5a61e6d1b4e5e083bb24017166186dc87d035cd0
---
M include/osmo-bts/oml.h
M src/common/oml.c
2 files changed, 22 insertions(+), 22 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/70/12870/1

diff --git a/include/osmo-bts/oml.h b/include/osmo-bts/oml.h
index 139464e..4dca2f8 100644
--- a/include/osmo-bts/oml.h
+++ b/include/osmo-bts/oml.h
@@ -14,11 +14,11 @@
 
 struct msgb *oml_msgb_alloc(void);
 int oml_send_msg(struct msgb *msg, int is_mauf);
-int oml_mo_send_msg(struct gsm_abis_mo *mo, struct msgb *msg, uint8_t msg_type);
-int oml_mo_opstart_ack(struct gsm_abis_mo *mo);
-int oml_mo_opstart_nack(struct gsm_abis_mo *mo, uint8_t nack_cause);
-int oml_mo_statechg_ack(struct gsm_abis_mo *mo);
-int oml_mo_statechg_nack(struct gsm_abis_mo *mo, uint8_t nack_cause);
+int oml_mo_send_msg(const struct gsm_abis_mo *mo, struct msgb *msg, uint8_t msg_type);
+int oml_mo_opstart_ack(const struct gsm_abis_mo *mo);
+int oml_mo_opstart_nack(const struct gsm_abis_mo *mo, uint8_t nack_cause);
+int oml_mo_statechg_ack(const struct gsm_abis_mo *mo);
+int oml_mo_statechg_nack(const struct gsm_abis_mo *mo, uint8_t nack_cause);
 
 /* Change the state and send STATE CHG REP */
 int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state);
@@ -31,13 +31,13 @@
 		       int success);
 
 /* Transmit STATE CHG REP even if there was no state change */
-int oml_tx_state_changed(struct gsm_abis_mo *mo);
+int oml_tx_state_changed(const struct gsm_abis_mo *mo);
 
-int oml_mo_tx_sw_act_rep(struct gsm_abis_mo *mo);
+int oml_mo_tx_sw_act_rep(const struct gsm_abis_mo *mo);
 
 int oml_fom_ack_nack(struct msgb *old_msg, uint8_t cause);
 
-int oml_mo_fom_ack_nack(struct gsm_abis_mo *mo, uint8_t orig_msg_type,
+int oml_mo_fom_ack_nack(const struct gsm_abis_mo *mo, uint8_t orig_msg_type,
 			uint8_t cause);
 
 /* Configure LAPDm T200 timers for this lchan according to OML */
diff --git a/src/common/oml.c b/src/common/oml.c
index a3227f5..4dfaaf4 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -67,7 +67,7 @@
 }
 
 /* 3GPP TS 12.21 § 8.8.2 */
-static int oml_tx_failure_event_rep(struct gsm_abis_mo *mo, uint16_t cause_value,
+static int oml_tx_failure_event_rep(const struct gsm_abis_mo *mo, uint16_t cause_value,
 				    const char *fmt, ...)
 {
 	struct msgb *nmsg;
@@ -129,7 +129,7 @@
 	return abis_oml_sendmsg(msg);
 }
 
-int oml_mo_send_msg(struct gsm_abis_mo *mo, struct msgb *msg, uint8_t msg_type)
+int oml_mo_send_msg(const struct gsm_abis_mo *mo, struct msgb *msg, uint8_t msg_type)
 {
 	struct abis_om_fom_hdr *foh;
 
@@ -307,7 +307,7 @@
 }
 
 /* 8.8.1 sending State Changed Event Report */
-int oml_tx_state_changed(struct gsm_abis_mo *mo)
+int oml_tx_state_changed(const struct gsm_abis_mo *mo)
 {
 	struct msgb *nmsg;
 
@@ -366,7 +366,7 @@
 
 /* Send an ACK or NACK response from 'mo' to BSC, deriving message
  * type from 'orig_msg_type'. ACK is sent if cause == 0; NACK otherwise */
-int oml_mo_fom_ack_nack(struct gsm_abis_mo *mo, uint8_t orig_msg_type,
+int oml_mo_fom_ack_nack(const struct gsm_abis_mo *mo, uint8_t orig_msg_type,
 			uint8_t cause)
 {
 	struct msgb *msg;
@@ -386,7 +386,7 @@
 	return oml_mo_send_msg(mo, msg, new_msg_type);
 }
 
-int oml_mo_statechg_ack(struct gsm_abis_mo *mo)
+int oml_mo_statechg_ack(const struct gsm_abis_mo *mo)
 {
 	struct msgb *msg;
 	int rc = 0;
@@ -405,17 +405,17 @@
 	return oml_tx_state_changed(mo);
 }
 
-int oml_mo_statechg_nack(struct gsm_abis_mo *mo, uint8_t nack_cause)
+int oml_mo_statechg_nack(const struct gsm_abis_mo *mo, uint8_t nack_cause)
 {
 	return oml_mo_fom_ack_nack(mo, NM_MT_CHG_ADM_STATE, nack_cause);
 }
 
-int oml_mo_opstart_ack(struct gsm_abis_mo *mo)
+int oml_mo_opstart_ack(const struct gsm_abis_mo *mo)
 {
 	return oml_mo_fom_ack_nack(mo, NM_MT_OPSTART, 0);
 }
 
-int oml_mo_opstart_nack(struct gsm_abis_mo *mo, uint8_t nack_cause)
+int oml_mo_opstart_nack(const struct gsm_abis_mo *mo, uint8_t nack_cause)
 {
 	return oml_mo_fom_ack_nack(mo, NM_MT_OPSTART, nack_cause);
 }
@@ -463,7 +463,7 @@
  */
 
 /* 8.3.7 sending SW Activated Report */
-int oml_mo_tx_sw_act_rep(struct gsm_abis_mo *mo)
+int oml_mo_tx_sw_act_rep(const struct gsm_abis_mo *mo)
 {
 	struct msgb *nmsg;
 
@@ -1067,7 +1067,7 @@
 static inline bool report_bts_number_incorrect(struct gsm_bts *bts, const struct abis_om_fom_hdr *foh, bool is_formatted)
 {
 	struct gsm_bts_trx *trx;
-	struct gsm_abis_mo *mo = &bts->mo;
+	const struct gsm_abis_mo *mo = &bts->mo;
 	const char *form = is_formatted ?
 		"Unexpected BTS %d in formatted O&M %s (exp. 0 or 0xFF)" :
 		"Unexpected BTS %d in manufacturer O&M %s (exp. 0 or 0xFF)";
@@ -1089,7 +1089,7 @@
 {
 	struct abis_om_fom_hdr *foh = msgb_l3(msg);
 	struct gsm_bts_trx *trx;
-	struct gsm_abis_mo *mo = &bts->mo;
+	const struct gsm_abis_mo *mo = &bts->mo;
 	int ret;
 
 	if (msgb_l2len(msg) < sizeof(*foh)) {
@@ -1268,7 +1268,7 @@
 	return 0;
 }
 
-static int oml_ipa_mo_set_attr(struct gsm_bts *bts, struct gsm_abis_mo *mo,
+static int oml_ipa_mo_set_attr(struct gsm_bts *bts, const struct gsm_abis_mo *mo,
 				void *obj, struct tlv_parsed *tp)
 {
 	int rc;
@@ -1293,7 +1293,7 @@
 static int oml_ipa_set_attr(struct gsm_bts *bts, struct msgb *msg)
 {
 	struct abis_om_fom_hdr *foh = msgb_l3(msg);
-	struct gsm_abis_mo *mo;
+	const struct gsm_abis_mo *mo;
 	struct tlv_parsed tp;
 	void *obj;
 	int rc;
@@ -1364,7 +1364,7 @@
 static int down_mom(struct gsm_bts *bts, struct msgb *msg)
 {
 	struct abis_om_hdr *oh = msgb_l2(msg);
-	struct gsm_abis_mo *mo = &bts->mo;
+	const struct gsm_abis_mo *mo = &bts->mo;
 	struct abis_om_fom_hdr *foh;
 	struct gsm_bts_trx *trx;
 	uint8_t idstrlen = oh->data[0];

-- 
To view, visit https://gerrit.osmocom.org/12870
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a61e6d1b4e5e083bb24017166186dc87d035cd0
Gerrit-Change-Number: 12870
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190209/d1695f4e/attachment.htm>


More information about the gerrit-log mailing list