Change in osmo-bts[master]: [VAMOS] gsm_data: rework and rename gsm_lchan_name_compute()

laforge gerrit-no-reply at lists.osmocom.org
Fri Jun 4 20:04:17 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/24439 )

Change subject: [VAMOS] gsm_data: rework and rename gsm_lchan_name_compute()
......................................................................

[VAMOS] gsm_data: rework and rename gsm_lchan_name_compute()

Change-Id: Id5cc40db04a654d94f5f75d4aad45439d66528cc
Related: SYS#4895, OS#4941
---
M include/osmo-bts/gsm_data.h
M src/common/bts_trx.c
M src/common/gsm_data.c
3 files changed, 11 insertions(+), 10 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/include/osmo-bts/gsm_data.h b/include/osmo-bts/gsm_data.h
index cd63f6f..93eb2f0 100644
--- a/include/osmo-bts/gsm_data.h
+++ b/include/osmo-bts/gsm_data.h
@@ -512,7 +512,7 @@
 const char *gsm_lchant_name(enum gsm_chan_t c);
 char *gsm_ts_name(const struct gsm_bts_trx_ts *ts);
 char *gsm_ts_and_pchan_name(const struct gsm_bts_trx_ts *ts);
-char *gsm_lchan_name_compute(const struct gsm_lchan *lchan);
+void gsm_lchan_name_update(struct gsm_lchan *lchan);
 const char *gsm_lchans_name(enum gsm_lchan_state s);
 
 static inline char *gsm_lchan_name(const struct gsm_lchan *lchan)
diff --git a/src/common/bts_trx.c b/src/common/bts_trx.c
index ee03b9a..3d295e5 100644
--- a/src/common/bts_trx.c
+++ b/src/common/bts_trx.c
@@ -96,15 +96,13 @@
 
 		for (l = 0; l < TS_MAX_LCHAN; l++) {
 			struct gsm_lchan *lchan;
-			char *name;
 			lchan = &ts->lchan[l];
 
 			lchan->ts = ts;
 			lchan->nr = l;
 			lchan->type = GSM_LCHAN_NONE;
+			gsm_lchan_name_update(lchan);
 
-			name = gsm_lchan_name_compute(lchan);
-			lchan->name = talloc_strdup(trx, name);
 			INIT_LLIST_HEAD(&lchan->sapi_cmds);
 			INIT_LLIST_HEAD(&lchan->dl_tch_queue);
 		}
diff --git a/src/common/gsm_data.c b/src/common/gsm_data.c
index 6b57851..6328783 100644
--- a/src/common/gsm_data.c
+++ b/src/common/gsm_data.c
@@ -165,14 +165,17 @@
 	return ts2str;
 }
 
-char *gsm_lchan_name_compute(const struct gsm_lchan *lchan)
+void gsm_lchan_name_update(struct gsm_lchan *lchan)
 {
-	struct gsm_bts_trx_ts *ts = lchan->ts;
+	const struct gsm_bts_trx_ts *ts = lchan->ts;
+	const struct gsm_bts_trx *trx = ts->trx;
+	char *name;
 
-	snprintf(ts2str, sizeof(ts2str), "(bts=%d,trx=%d,ts=%d,ss=%d)",
-		 ts->trx->bts->nr, ts->trx->nr, ts->nr, lchan->nr);
-
-	return ts2str;
+	name = talloc_asprintf(trx, "(bts=%u,trx=%u,ts=%u,ss=%u)",
+			       trx->bts->nr, trx->nr, ts->nr, lchan->nr);
+	if (lchan->name != NULL)
+		talloc_free(lchan->name);
+	lchan->name = name;
 }
 
 /* See Table 10.5.25 of GSM04.08 */

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id5cc40db04a654d94f5f75d4aad45439d66528cc
Gerrit-Change-Number: 24439
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr 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/20210604/9c334910/attachment.htm>


More information about the gerrit-log mailing list