neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/31645 )


Change subject: ensure correct phys_chan_config doc string count on VTY
......................................................................

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
---
M src/osmo-bsc/gsm_data.c
1 file changed, 18 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/45/31645/1

diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index a682a32..427aad5 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -189,6 +189,7 @@
        { 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 @@
        { 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 @@
        { 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);

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I8118bec35400f7f00ca9ae43b603059ed701fa25
Gerrit-Change-Number: 31645
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofm...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to