Change in osmo-bsc[master]: osmo_bsc_main: separate checks from bootstrap_bts

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/.

dexter gerrit-no-reply at lists.osmocom.org
Tue Nov 9 17:48:25 UTC 2021


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26185 )


Change subject: osmo_bsc_main: separate checks from bootstrap_bts
......................................................................

osmo_bsc_main: separate checks from bootstrap_bts

The function bootstrap_bts does a few checks before it does the actual
initialization. To make the code more modular, lets split the function
into two functions, check_bts and bootstrap_bts. Also be sure that we
print the BTS number when the check failes.

Change-Id: Id2b26f147d2f35e156e2da8ee58d2bbbb93de4ac
Related: SYS#5369
---
M src/osmo-bsc/osmo_bsc_main.c
1 file changed, 11 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/85/26185/1

diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index a39c109..11db260 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -436,10 +436,9 @@
 	return 0;
 }
 
-static int bootstrap_bts(struct gsm_bts *bts)
+static int check_bts(struct gsm_bts *bts)
 {
 	struct gsm_bts_trx *trx;
-	unsigned int n = 0;
 
 	if (!bts->model)
 		return -EFAULT;
@@ -484,6 +483,13 @@
 		}
 	}
 
+	return 0;
+}
+
+static void bootstrap_bts(struct gsm_bts *bts)
+{
+	unsigned int n = 0;
+
 	/* Control Channel Description is set from vty/config */
 
 	/* Determine the value of CCCH_CONF. Is TS0/C0 combined? */
@@ -510,8 +516,6 @@
 
 	/* Initialize the BTS state */
 	gsm_bts_sm_mo_reset(bts->site_mgr);
-
-	return 0;
 }
 
 static int bsc_network_configure(const char *config_file)
@@ -535,11 +539,12 @@
 	osmo_signal_register_handler(SS_L_INPUT, inp_sig_cb, NULL);
 
 	llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) {
-		rc = bootstrap_bts(bts);
+		rc = check_bts(bts);
 		if (rc < 0) {
-			LOGP(DNM, LOGL_FATAL, "Error bootstrapping BTS\n");
+			LOGP(DNM, LOGL_FATAL, "(bts=%u) cannot bootstrap BTS, invalid BTS configuration\n", bts->nr);
 			return rc;
 		}
+		bootstrap_bts(bts);
 		rc = e1_reconfig_bts(bts);
 		if (rc < 0) {
 			LOGP(DNM, LOGL_FATAL, "Error enabling E1 input driver\n");

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26185
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Id2b26f147d2f35e156e2da8ee58d2bbbb93de4ac
Gerrit-Change-Number: 26185
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211109/b838b707/attachment.htm>


More information about the gerrit-log mailing list