[MERGED] libosmocore[master]: gb: drop special vty exit commands, use vty_install_default()

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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Sep 27 14:04:09 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: gb: drop special vty exit commands, use vty_install_default()
......................................................................


gb: drop special vty exit commands, use vty_install_default()

L_NS_NODE and L_BSSGP_NODE had specialized 'exit' and 'end' vty commands, but
all they do is return to the CONFIG and ENABLE_NODEs like the default 'exit'
and 'end' commands. Drop them and use the default 'exit' and 'end' cmds.

Examining BSSGP and NS node behavior in osmo-sgsn exhibited identical list and
exit/end behavior before and after this patch.

Prepares for an upcoming commit incorporating vty_install_default() into
install_node(), see I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b: this patch
changes to the default commands, the upcoming change implies them.

Change-Id: I5b0de066b4249d482c22620d5b1bcb03f381293c
---
M src/gb/common_vty.c
M src/gb/common_vty.h
M src/gb/gprs_bssgp_vty.c
M src/gb/gprs_ns_vty.c
4 files changed, 2 insertions(+), 43 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gb/common_vty.c b/src/gb/common_vty.c
index 5de5135..16f3bbd 100644
--- a/src/gb/common_vty.c
+++ b/src/gb/common_vty.c
@@ -35,40 +35,6 @@
 
 #include "common_vty.h"
 
-/* Down vty node level. */
-gDEFUN(libgb_exit,
-       libgb_exit_cmd, "exit", "Exit current mode and down to previous mode\n")
-{
-	switch (vty->node) {
-	case L_NS_NODE:
-	case L_BSSGP_NODE:
-		vty->node = CONFIG_NODE;
-		vty->index = NULL;
-		break;
-	default:
-		break;
-	}
-	return CMD_SUCCESS;
-}
-
-/* End of configuration. */
-gDEFUN(libgb_end,
-       libgb_end_cmd, "end", "End current mode and change to enable mode.")
-{
-	switch (vty->node) {
-	case L_NS_NODE:
-	case L_BSSGP_NODE:
-		vty_config_unlock(vty);
-		vty->node = ENABLE_NODE;
-		vty->index = NULL;
-		vty->index_sub = NULL;
-		break;
-	default:
-		break;
-	}
-	return CMD_SUCCESS;
-}
-
 int gprs_log_filter_fn(const struct log_context *ctx,
 			struct log_target *tar)
 {
diff --git a/src/gb/common_vty.h b/src/gb/common_vty.h
index a0674a7..801d2da 100644
--- a/src/gb/common_vty.h
+++ b/src/gb/common_vty.h
@@ -5,6 +5,3 @@
 
 extern int DNS, DBSSGP;
 
-extern struct cmd_element libgb_exit_cmd;
-extern struct cmd_element libgb_end_cmd;
-
diff --git a/src/gb/gprs_bssgp_vty.c b/src/gb/gprs_bssgp_vty.c
index 30ba603..dc786a1 100644
--- a/src/gb/gprs_bssgp_vty.c
+++ b/src/gb/gprs_bssgp_vty.c
@@ -211,9 +211,7 @@
 
 	install_element(CONFIG_NODE, &cfg_bssgp_cmd);
 	install_node(&bssgp_node, config_write_bssgp);
-	install_default(L_BSSGP_NODE);
-	install_element(L_BSSGP_NODE, &libgb_exit_cmd);
-	install_element(L_BSSGP_NODE, &libgb_end_cmd);
+	vty_install_default(L_BSSGP_NODE);
 
 	return 0;
 }
diff --git a/src/gb/gprs_ns_vty.c b/src/gb/gprs_ns_vty.c
index e320ba2..4bd5097 100644
--- a/src/gb/gprs_ns_vty.c
+++ b/src/gb/gprs_ns_vty.c
@@ -594,9 +594,7 @@
 
 	install_element(CONFIG_NODE, &cfg_ns_cmd);
 	install_node(&ns_node, config_write_ns);
-	install_default(L_NS_NODE);
-	install_element(L_NS_NODE, &libgb_exit_cmd);
-	install_element(L_NS_NODE, &libgb_end_cmd);
+	vty_install_default(L_NS_NODE);
 	install_element(L_NS_NODE, &cfg_nse_nsvci_cmd);
 	install_element(L_NS_NODE, &cfg_nse_remoteip_cmd);
 	install_element(L_NS_NODE, &cfg_nse_remoteport_cmd);

-- 
To view, visit https://gerrit.osmocom.org/4054
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5b0de066b4249d482c22620d5b1bcb03f381293c
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list