soft_uart: add osmo_soft_uart_{get,set}_name()

Change-Id: Iabf29f42d876035481011fa8e8a51c0590fe63b8
Related: OS#4396
diff --git a/include/osmocom/core/soft_uart.h b/include/osmocom/core/soft_uart.h
index 097d2ee..7b7c394 100644
--- a/include/osmocom/core/soft_uart.h
+++ b/include/osmocom/core/soft_uart.h
@@ -87,6 +87,10 @@
 					    const struct osmo_soft_uart_cfg *cfg);
 void osmo_soft_uart_free(struct osmo_soft_uart *suart);
 int osmo_soft_uart_configure(struct osmo_soft_uart *suart, const struct osmo_soft_uart_cfg *cfg);
+
+const char *osmo_soft_uart_get_name(const struct osmo_soft_uart *suart);
+void osmo_soft_uart_set_name(struct osmo_soft_uart *suart, const char *name);
+
 int osmo_soft_uart_set_rx(struct osmo_soft_uart *suart, bool enable);
 int osmo_soft_uart_set_tx(struct osmo_soft_uart *suart, bool enable);
 
diff --git a/src/core/libosmocore.map b/src/core/libosmocore.map
index 3d6aa42..4ae5108 100644
--- a/src/core/libosmocore.map
+++ b/src/core/libosmocore.map
@@ -444,6 +444,8 @@
 osmo_soft_uart_alloc;
 osmo_soft_uart_free;
 osmo_soft_uart_configure;
+osmo_soft_uart_get_name;
+osmo_soft_uart_set_name;
 osmo_soft_uart_set_rx;
 osmo_soft_uart_set_tx;
 osmo_soft_uart_rx_ubits;
diff --git a/src/core/soft_uart.c b/src/core/soft_uart.c
index 4fffaee..5ddddb4 100644
--- a/src/core/soft_uart.c
+++ b/src/core/soft_uart.c
@@ -396,6 +396,22 @@
 	return 0;
 }
 
+/*! Get a name for the given soft-UART instance.
+ * \param[in] suart soft-UART instance to get the name from.
+ * \returns name of the given soft-UART instance. */
+const char *osmo_soft_uart_get_name(const struct osmo_soft_uart *suart)
+{
+	return suart->name;
+}
+
+/*! Set a new name for the given soft-UART instance.
+ * \param[in] suart soft-UART instance to set the name for.
+ * \param[in] name the new name. */
+void osmo_soft_uart_set_name(struct osmo_soft_uart *suart, const char *name)
+{
+	osmo_talloc_replace_string(suart, (char **)&suart->name, name);
+}
+
 /*! Enable/disable receiver of the given soft-UART.
  * \param[in] suart soft-UART instance to be re-configured.
  * \param[in] enable enable/disable state of the receiver.