Change in osmo-bts[master]: main: register VTY commands before handle_options()

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Mon Nov 2 12:33:15 UTC 2020


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

Change subject: main: register VTY commands before handle_options()
......................................................................

main: register VTY commands before handle_options()

Otherwise only those commands that are registered by libosmocore
appear in the generated XML VTY reference - change the order.

Instead of a pointer to 'struct gsm_bts', pass the application's
talloc context, as it's only used for dynamic command allocation.

Change-Id: Ic356a950da85de02c82e9882a5fbadaaa6929680
Related: SYS#4937, OS#3036
---
M include/osmo-bts/vty.h
M src/common/main.c
M src/common/vty.c
3 files changed, 13 insertions(+), 13 deletions(-)

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



diff --git a/include/osmo-bts/vty.h b/include/osmo-bts/vty.h
index b6e3f0d..c9840d1 100644
--- a/include/osmo-bts/vty.h
+++ b/include/osmo-bts/vty.h
@@ -22,7 +22,7 @@
 int bts_vty_go_parent(struct vty *vty);
 int bts_vty_is_config_node(struct vty *vty, int node);
 
-int bts_vty_init(struct gsm_bts *bts);
+int bts_vty_init(void *ctx);
 
 struct gsm_network *gsmnet_from_vty(struct vty *v);
 
diff --git a/src/common/main.c b/src/common/main.c
index 279e823..463b7a8 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -277,6 +277,9 @@
 	osmo_cpu_sched_vty_init(tall_bts_ctx);
 	rate_ctr_init(tall_bts_ctx);
 
+	bts_vty_init(tall_bts_ctx);
+	e1inp_vty_init();
+
 	handle_options(argc, argv);
 
 	bts = gsm_bts_alloc(tall_bts_ctx, 0);
@@ -285,9 +288,6 @@
 		exit(1);
 	}
 
-	e1inp_vty_init();
-	bts_vty_init(bts);
-
 	/* enable realtime priority for us */
 	if (rt_prio != -1) {
 		struct sched_param param;
diff --git a/src/common/vty.c b/src/common/vty.c
index d20b143..957678a 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1815,33 +1815,33 @@
 	return CMD_SUCCESS;
 }
 
-int bts_vty_init(struct gsm_bts *bts)
+int bts_vty_init(void *ctx)
 {
-	cfg_trx_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(bts, gsmtap_sapi_names,
+	cfg_trx_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(ctx, gsmtap_sapi_names,
 						"gsmtap-sapi (",
 						"|",")", VTY_DO_LOWER);
-	cfg_trx_gsmtap_sapi_cmd.doc = vty_cmd_string_from_valstr(bts, gsmtap_sapi_names,
+	cfg_trx_gsmtap_sapi_cmd.doc = vty_cmd_string_from_valstr(ctx, gsmtap_sapi_names,
 						"Enable sending of UL/DL messages over GSMTAP\n",
 						"\n", "", 0);
 
-	cfg_trx_no_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(bts, gsmtap_sapi_names,
+	cfg_trx_no_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(ctx, gsmtap_sapi_names,
 						"no gsmtap-sapi (",
 						"|",")", VTY_DO_LOWER);
-	cfg_trx_no_gsmtap_sapi_cmd.doc = vty_cmd_string_from_valstr(bts, gsmtap_sapi_names,
+	cfg_trx_no_gsmtap_sapi_cmd.doc = vty_cmd_string_from_valstr(ctx, gsmtap_sapi_names,
 						NO_STR "Disable sending of UL/DL messages over GSMTAP\n",
 						"\n", "", 0);
 
-	logging_fltr_l1_sapi_cmd.string = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names,
+	logging_fltr_l1_sapi_cmd.string = vty_cmd_string_from_valstr(ctx, l1sap_common_sapi_names,
 						"logging filter l1-sapi (",
 						"|", ")", VTY_DO_LOWER);
-	logging_fltr_l1_sapi_cmd.doc = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names,
+	logging_fltr_l1_sapi_cmd.doc = vty_cmd_string_from_valstr(ctx, l1sap_common_sapi_names,
 						LOGGING_STR FILTER_STR "L1 SAPI\n",
 						"\n", "", 0);
 
-	no_logging_fltr_l1_sapi_cmd.string = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names,
+	no_logging_fltr_l1_sapi_cmd.string = vty_cmd_string_from_valstr(ctx, l1sap_common_sapi_names,
 						"no logging filter l1-sapi (",
 						"|", ")", VTY_DO_LOWER);
-	no_logging_fltr_l1_sapi_cmd.doc = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names,
+	no_logging_fltr_l1_sapi_cmd.doc = vty_cmd_string_from_valstr(ctx, l1sap_common_sapi_names,
 						NO_STR LOGGING_STR FILTER_STR "L1 SAPI\n",
 						"\n", "", 0);
 

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ic356a950da85de02c82e9882a5fbadaaa6929680
Gerrit-Change-Number: 20954
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
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/20201102/bb91e56f/attachment.htm>


More information about the gerrit-log mailing list