aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2023-03-02 01:46:41 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2023-03-02 17:56:48 +0100
commitb599836c7ae5a0350c9dc4ea63de635eb4e75f41 (patch)
tree879b19fa0c4a79b86b80a439c23694fa42361f09
parente073463ec4d9c91b9aba72771ae552748bdfc1d7 (diff)
implicitly register osmo_fsm definitions
I'm going to add a regression test that probes lchan_fsm. I noticed that I have to call lchan_fsm_init() for osmo_fsm_register(). Let's make this implicit as we usually do now, to not have to register FSMs in tests. Change-Id: I58760e743c78a370aedc9720f265c0f8da5c2045
-rw-r--r--include/osmocom/bsc/assignment_fsm.h2
-rw-r--r--include/osmocom/bsc/bsc_subscr_conn_fsm.h2
-rw-r--r--include/osmocom/bsc/handover_fsm.h2
-rw-r--r--include/osmocom/bsc/lchan_fsm.h2
-rw-r--r--src/osmo-bsc/assignment_fsm.c2
-rw-r--r--src/osmo-bsc/bsc_subscr_conn_fsm.c2
-rw-r--r--src/osmo-bsc/handover_fsm.c2
-rw-r--r--src/osmo-bsc/lchan_fsm.c5
-rw-r--r--src/osmo-bsc/lchan_rtp_fsm.c2
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c4
-rw-r--r--tests/handover/handover_test.c5
11 files changed, 5 insertions, 25 deletions
diff --git a/include/osmocom/bsc/assignment_fsm.h b/include/osmocom/bsc/assignment_fsm.h
index 3dffaf212..17f8c4f5a 100644
--- a/include/osmocom/bsc/assignment_fsm.h
+++ b/include/osmocom/bsc/assignment_fsm.h
@@ -40,8 +40,6 @@ enum assignment_fsm_event {
ASSIGNMENT_EV_CONN_RELEASING,
};
-void assignment_fsm_init(void);
-
int reassignment_request_to_lchan(enum assign_for assign_for, struct gsm_lchan *lchan, struct gsm_lchan *to_lchan,
int tsc_set, int tsc);
int reassignment_request_to_chan_type(enum assign_for assign_for, struct gsm_lchan *lchan,
diff --git a/include/osmocom/bsc/bsc_subscr_conn_fsm.h b/include/osmocom/bsc/bsc_subscr_conn_fsm.h
index b358da656..766d56a49 100644
--- a/include/osmocom/bsc/bsc_subscr_conn_fsm.h
+++ b/include/osmocom/bsc/bsc_subscr_conn_fsm.h
@@ -57,8 +57,6 @@ struct osmo_mgcpc_ep_ci;
struct assignment_request;
struct gsm_lchan;
-void bsc_subscr_conn_fsm_init(void);
-
/* Allocate a subscriber connection and its associated FSM */
struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *net);
void gscon_update_id(struct gsm_subscriber_connection *conn);
diff --git a/include/osmocom/bsc/handover_fsm.h b/include/osmocom/bsc/handover_fsm.h
index faec73fcc..03a8436ad 100644
--- a/include/osmocom/bsc/handover_fsm.h
+++ b/include/osmocom/bsc/handover_fsm.h
@@ -55,8 +55,6 @@ struct handover_rr_detect_data {
const uint8_t *access_delay;
};
-void handover_fsm_init(void);
-
int handover_request(struct handover_out_req *req);
void handover_start(struct handover_out_req *req);
void handover_start_inter_bsc_in(struct gsm_subscriber_connection *conn,
diff --git a/include/osmocom/bsc/lchan_fsm.h b/include/osmocom/bsc/lchan_fsm.h
index cc231dcf4..b179a7fbb 100644
--- a/include/osmocom/bsc/lchan_fsm.h
+++ b/include/osmocom/bsc/lchan_fsm.h
@@ -56,8 +56,6 @@ enum lchan_fsm_event {
LCHAN_EV_REQUEST_MODE_MODIFY,
};
-void lchan_fsm_init(void);
-
void lchan_fsm_alloc(struct gsm_lchan *lchan);
void lchan_release(struct gsm_lchan *lchan, bool do_rr_release,
bool err, enum gsm48_rr_cause cause_rr,
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index d382f103e..4af4d56ad 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -364,7 +364,7 @@ static bool lchan_type_compat_with_mode(enum gsm_chan_t type, const struct chann
}
}
-void assignment_fsm_init(void)
+static __attribute__((constructor)) void assignment_fsm_init(void)
{
OSMO_ASSERT(osmo_fsm_register(&assignment_fsm) == 0);
}
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 9c0fdcf4f..ebfbe82a2 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -1208,7 +1208,7 @@ static struct osmo_fsm gscon_fsm = {
.event_names = gscon_fsm_event_names,
};
-void bsc_subscr_conn_fsm_init(void)
+static __attribute__((constructor)) void bsc_subscr_conn_fsm_init(void)
{
OSMO_ASSERT(osmo_fsm_register(&gscon_fsm) == 0);
OSMO_ASSERT(osmo_fsm_register(&lcls_fsm) == 0);
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index 251ea5b5a..e8581c587 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -293,7 +293,7 @@ static void handover_reset(struct gsm_subscriber_connection *conn)
};
}
-void handover_fsm_init(void)
+static __attribute__((constructor)) void handover_fsm_init(void)
{
OSMO_ASSERT(osmo_fsm_register(&ho_fsm) == 0);
}
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index ab3fbddf7..717f9be6b 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -461,12 +461,9 @@ void lchan_fsm_update_id(struct gsm_lchan *lchan)
osmo_fsm_inst_update_id_f(lchan->fi_rtp, lchan->fi->id);
}
-extern void lchan_rtp_fsm_init();
-
-void lchan_fsm_init(void)
+static __attribute__((constructor)) void lchan_fsm_init(void)
{
OSMO_ASSERT(osmo_fsm_register(&lchan_fsm) == 0);
- lchan_rtp_fsm_init();
}
static void lchan_reset(struct gsm_lchan *lchan);
diff --git a/src/osmo-bsc/lchan_rtp_fsm.c b/src/osmo-bsc/lchan_rtp_fsm.c
index 8b61f1e29..4cfec5421 100644
--- a/src/osmo-bsc/lchan_rtp_fsm.c
+++ b/src/osmo-bsc/lchan_rtp_fsm.c
@@ -70,7 +70,7 @@ struct osmo_tdef_state_timeout lchan_rtp_fsm_timeouts[32] = {
} while (0)
/* Called from lchan_fsm_init(), does not need to be visible in lchan_rtp_fsm.h */
-void lchan_rtp_fsm_init(void)
+static __attribute__((constructor)) void lchan_rtp_fsm_init(void)
{
OSMO_ASSERT(osmo_fsm_register(&lchan_rtp_fsm) == 0);
}
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 5ad13ca34..69f272135 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -924,10 +924,6 @@ int main(int argc, char **argv)
/* seed the PRNG */
srand(time(NULL));
- lchan_fsm_init();
- bsc_subscr_conn_fsm_init();
- assignment_fsm_init();
- handover_fsm_init();
lb_init();
acc_ramp_global_init();
paging_global_init();
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 2c54526eb..bf91f024f 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -1687,11 +1687,6 @@ int main(int argc, char **argv)
bsc_vty_init(bsc_gsmnet);
ho_test_vty_init();
- lchan_fsm_init();
- bsc_subscr_conn_fsm_init();
- handover_fsm_init();
- assignment_fsm_init();
-
ho_set_algorithm(bsc_gsmnet->ho, 2);
ho_set_ho_active(bsc_gsmnet->ho, true);
ho_set_hodec2_as_active(bsc_gsmnet->ho, true);