Change in osmo-bsc[master]: Move ts_fsm_init to static constructor [3/4]

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

pespin gerrit-no-reply at lists.osmocom.org
Thu Oct 7 12:25:48 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/25708 )

Change subject: Move ts_fsm_init to static constructor [3/4]
......................................................................

Move ts_fsm_init to static constructor [3/4]

This allows having it initialized automatically, as we usually do with
this type of code. As a result, tests or other apps importing libbsc
don't need to take care of calling it.

NOTE: This fix is required by follow-up patches where some stubs are removed
and hence some tests start using FSMs internally. Since tests were not
using those FSMs before, there was no need to call ts_fsm_init().

This is one further step towards fixing interdependency mess of symbols
and stubs.

Change-Id: I0e4b95b5e73fbb3844d83ba33e66786831088e1f
---
M include/osmocom/bsc/timeslot_fsm.h
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc/timeslot_fsm.c
M tests/handover/handover_test.c
4 files changed, 1 insertion(+), 5 deletions(-)

Approvals:
  osmith: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved; Verified



diff --git a/include/osmocom/bsc/timeslot_fsm.h b/include/osmocom/bsc/timeslot_fsm.h
index 1831537..5e62188 100644
--- a/include/osmocom/bsc/timeslot_fsm.h
+++ b/include/osmocom/bsc/timeslot_fsm.h
@@ -42,8 +42,6 @@
         TS_EV_PDCH_DEACT_NACK,
 };
 
-void ts_fsm_init();
-
 void ts_fsm_alloc(struct gsm_bts_trx_ts *ts);
 void ts_fsm_free(struct gsm_bts_trx_ts *ts);
 
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 8d6901d..e8a22fe 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -979,7 +979,6 @@
 	/* seed the PRNG */
 	srand(time(NULL));
 
-	ts_fsm_init();
 	lchan_fsm_init();
 	bsc_subscr_conn_fsm_init();
 	assignment_fsm_init();
diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c
index 8d256bb..76ac1af 100644
--- a/src/osmo-bsc/timeslot_fsm.c
+++ b/src/osmo-bsc/timeslot_fsm.c
@@ -52,7 +52,7 @@
 				  gsm_pchan_id(ts->pchan_on_init));
 }
 
-void ts_fsm_init()
+static __attribute__((constructor)) void ts_fsm_init(void)
 {
 	OSMO_ASSERT(osmo_fsm_register(&ts_fsm) == 0);
 }
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index bd65b2f..1dc7c1f 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -1626,7 +1626,6 @@
 	bsc_vty_init(bsc_gsmnet);
 	ho_test_vty_init();
 
-	ts_fsm_init();
 	lchan_fsm_init();
 	bsc_subscr_conn_fsm_init();
 	handover_fsm_init();

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I0e4b95b5e73fbb3844d83ba33e66786831088e1f
Gerrit-Change-Number: 25708
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211007/200b369d/attachment.htm>


More information about the gerrit-log mailing list