aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2023-03-03 02:51:58 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2023-03-03 16:27:41 +0100
commit78bf5c824d7b04ee98246608cfbc2bb1cb830c86 (patch)
treea87964a09e55c2949b9f2c1106fda7d53399488d
parent4d2b934c15bafc180dbac1a66112594a5856337d (diff)
ensure correct phys_chan_config doc string count on VTY
Add a static assert, and comments indicating the importance of the two value_string arrays defining pchans on the VTY matching up. Change-Id: I8118bec35400f7f00ca9ae43b603059ed701fa25
-rw-r--r--src/osmo-bsc/gsm_data.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index a682a32e6..427aad564 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -189,6 +189,7 @@ const struct value_string gsm_pchant_names[] = {
{ GSM_PCHAN_CCCH_SDCCH4_CBCH, "CCCH+SDCCH4+CBCH" },
{ GSM_PCHAN_SDCCH8_SACCH8C_CBCH, "SDCCH8+CBCH" },
{ GSM_PCHAN_OSMO_DYN, "TCH/F_TCH/H_SDCCH8_PDCH" },
+ /* When adding items here, you must also add matching items to gsm_pchant_descs[]! */
{ 0, NULL }
};
@@ -208,7 +209,9 @@ const struct value_string gsm_pchan_ids[] = {
{ 0, NULL }
};
-const struct value_string gsm_pchant_descs[13] = {
+/* VTY command descriptions. These have to be in the same order as gsm_pchant_names[], so that the automatic VTY command
+ * composition in bts_trx_vty_init() works out. */
+const struct value_string gsm_pchant_descs[] = {
{ GSM_PCHAN_NONE, "Physical Channel not configured" },
{ GSM_PCHAN_CCCH, "FCCH + SCH + BCCH + CCCH (Comb. IV)" },
{ GSM_PCHAN_CCCH_SDCCH4,
@@ -225,6 +228,8 @@ const struct value_string gsm_pchant_descs[13] = {
{ 0, NULL }
};
+osmo_static_assert(ARRAY_SIZE(gsm_pchant_names) == ARRAY_SIZE(gsm_pchant_descs), _pchan_vty_docs);
+
const char *gsm_pchan_name(enum gsm_phys_chan_config c)
{
return get_value_string(gsm_pchant_names, c);