Change in libosmocore[master]: vty: Introduce API vty_read_config_filep

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

laforge gerrit-no-reply at lists.osmocom.org
Tue May 18 18:54:20 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/24262 )

Change subject: vty: Introduce API vty_read_config_filep
......................................................................

vty: Introduce API vty_read_config_filep

This new API doesn't use host_config_set(), and allows passing a FILE*
from any source, not only a filesystem path.

Related: SYS#5369
Change-Id: I720ac04386261628c0798a1bfcaa91e2490a86c3
---
M TODO-RELEASE
M include/osmocom/vty/vty.h
M src/vty/vty.c
3 files changed, 11 insertions(+), 5 deletions(-)

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



diff --git a/TODO-RELEASE b/TODO-RELEASE
index c5d4ee8..e57ffab 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -11,3 +11,4 @@
 libosmogsm      gsm0808_old_bss_to_new_bss_info ABI break (struct changes size), gsm0808_old_bss_to_new_bss_info_att_tlvdef symbol added
 libosmosim	osim_card_hdl		ABI + API breakage due to new struct members
 libosmocore	osmo_tdef_fsm_inst_state_chg	change default_timeout arg from unsigned long to long type (API breakage, not ABI)
+libosmovty      vty_read_config_filep   New API
diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h
index d34433f..3e6178f 100644
--- a/include/osmocom/vty/vty.h
+++ b/include/osmocom/vty/vty.h
@@ -141,7 +141,7 @@
 #define TELNET_NAWS_SB_LEN 5
 	/*! sub-negotiation buffer */
 	unsigned char sb_buf[TELNET_NAWS_SB_LEN];
-	/*! How many subnegotiation characters have we received?  
+	/*! How many subnegotiation characters have we received?
 	 *
 	 * We just drop those that do not fit in the buffer. */
 	size_t sb_len;
@@ -210,6 +210,7 @@
 /* Prototypes. */
 void vty_init(struct vty_app_info *app_info);
 int vty_read_config_file(const char *file_name, void *priv);
+int vty_read_config_filep(FILE *confp, void *priv);
 void vty_init_vtysh (void);
 void vty_reset (void);
 struct vty *vty_new (void);
diff --git a/src/vty/vty.c b/src/vty/vty.c
index f4e8e80..76c6ef5 100644
--- a/src/vty/vty.c
+++ b/src/vty/vty.c
@@ -1462,9 +1462,13 @@
 	return 0;
 }
 
-/* Read up configuration file */
-static int
-vty_read_file(FILE *confp, void *priv)
+/* Read up configuration from a file stream */
+/*! Read up VTY configuration from a file stream
+ *  \param[in] confp file pointer of the stream for the configuration file
+ *  \param[in] priv private data to be passed to \ref vty_read_file
+ *  \returns Zero on success, non-zero on error
+ */
+int vty_read_config_filep(FILE *confp, void *priv)
 {
 	int ret;
 	struct vty *vty;
@@ -1870,7 +1874,7 @@
 	if (!cfile)
 		return -ENOENT;
 
-	rc = vty_read_file(cfile, priv);
+	rc = vty_read_config_filep(cfile, priv);
 	fclose(cfile);
 
 	host_config_set(file_name);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I720ac04386261628c0798a1bfcaa91e2490a86c3
Gerrit-Change-Number: 24262
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210518/dacab584/attachment.htm>


More information about the gerrit-log mailing list