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.orgHello Harald Welte, Jenkins Builder,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/4717
to look at the new patch set (#2).
reset: remove name variable from reset context
The reset context contains a string buffer to allow for setting
a human readable name, that is then displayed in the logs. Since
OSMO-FSMs already have such a feature there is no need for an
extra name variable.
Use LOGPFSML and the name parameter of osmo_fsm_inst_alloc()
to display the name of the FSM
Fixes: Coverity CID#178664
Change-Id: I34511698923abec7545a6f3defd595f97b4bbeb1
---
M include/osmocom/bsc/a_reset.h
M src/libcommon-cs/a_reset.c
2 files changed, 9 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/17/4717/2
diff --git a/include/osmocom/bsc/a_reset.h b/include/osmocom/bsc/a_reset.h
index 7aaab06..c01a8b0 100644
--- a/include/osmocom/bsc/a_reset.h
+++ b/include/osmocom/bsc/a_reset.h
@@ -33,9 +33,6 @@
* will be triggered */
int conn_loss_counter;
- /* A human readable name to display in the logs */
- char name[256];
-
/* Callback function to be called when a connection
* failure is detected and a rest must occur */
void (*cb)(void *priv);
diff --git a/src/libcommon-cs/a_reset.c b/src/libcommon-cs/a_reset.c
index f08d813..5e45b09 100644
--- a/src/libcommon-cs/a_reset.c
+++ b/src/libcommon-cs/a_reset.c
@@ -62,8 +62,9 @@
{
struct a_reset_ctx *reset = (struct a_reset_ctx *)data;
OSMO_ASSERT(reset);
+ OSMO_ASSERT(reset->fsm);
- LOGP(DMSC, LOGL_NOTICE, "(%s) fsm-state (msc-reset): %s, fsm-event: %s\n", reset->name,
+ LOGPFSML(reset->fsm, LOGL_NOTICE, "fsm-state (msc-reset): %s, fsm-event: %s\n",
get_value_string(fsm_state_names, ST_CONN), get_value_string(fsm_evt_names, event));
reset->conn_loss_counter = 0;
@@ -76,13 +77,13 @@
struct a_reset_ctx *reset = (struct a_reset_ctx *)data;
OSMO_ASSERT(reset);
- LOGP(DMSC, LOGL_NOTICE, "(%s) fsm-state (msc-reset): %s, fsm-event: %s\n", reset->name,
+ LOGPFSML(reset->fsm, LOGL_NOTICE, "fsm-state (msc-reset): %s, fsm-event: %s\n",
get_value_string(fsm_state_names, ST_CONN), get_value_string(fsm_evt_names, event));
switch (event) {
case EV_N_DISCONNECT:
if (reset->conn_loss_counter >= BAD_CONNECTION_THRESOLD) {
- LOGP(DMSC, LOGL_NOTICE, "(%s) SIGTRAN connection down, reconnecting...\n", reset->name);
+ LOGPFSML(reset->fsm, LOGL_NOTICE, "SIGTRAN connection down, reconnecting...\n");
osmo_fsm_inst_state_chg(fi, ST_DISC, RESET_RESEND_INTERVAL, RESET_RESEND_TIMER_NO);
} else
reset->conn_loss_counter++;
@@ -97,8 +98,9 @@
static int fsm_reset_ack_timeout_cb(struct osmo_fsm_inst *fi)
{
struct a_reset_ctx *reset = (struct a_reset_ctx *)fi->priv;
+ OSMO_ASSERT(reset->fsm);
- LOGP(DMSC, LOGL_NOTICE, "(%s) reset-ack timeout (T%i) in state %s, resending...\n", reset->name, fi->T,
+ LOGPFSML(reset->fsm, LOGL_NOTICE, "reset-ack timeout (T%i) in state %s, resending...\n", fi->T,
get_value_string(fsm_state_names, fi->state));
reset->cb(reset->priv);
@@ -147,12 +149,11 @@
OSMO_ASSERT(reset);
reset->priv = priv;
reset->cb = cb;
- strncpy(reset->name, name, sizeof(reset->name));
reset->conn_loss_counter = 0;
- reset->fsm = osmo_fsm_inst_alloc(&fsm, NULL, NULL, LOGL_DEBUG, NULL);
+ reset->fsm = osmo_fsm_inst_alloc(&fsm, NULL, NULL, LOGL_DEBUG, name);
OSMO_ASSERT(reset->fsm);
reset->fsm->priv = reset;
- LOGP(DMSC, LOGL_NOTICE, "(%s) reset handler fsm created.\n", reset->name);
+ LOGPFSML(reset->fsm, LOGL_NOTICE, "reset handler fsm created.\n");
/* kick off reset-ack sending mechanism */
osmo_fsm_inst_state_chg(reset->fsm, ST_DISC, RESET_RESEND_INTERVAL, RESET_RESEND_TIMER_NO);
@@ -172,7 +173,7 @@
memset(reset, 0, sizeof(*reset));
talloc_free(reset);
- LOGP(DMSC, LOGL_NOTICE, "(%s) reset handler fsm destroyed.\n", reset->name);
+ LOGPFSML(reset->fsm, LOGL_NOTICE, "reset handler fsm destroyed.\n");
}
/* Confirm that we sucessfully received a reset acknowlege message */
--
To view, visit https://gerrit.osmocom.org/4717
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I34511698923abec7545a6f3defd595f97b4bbeb1
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder