diff mbox series

[2/3] Lua: Create accessors to get selection mode

Message ID 20201117094122.2153374-2-sbabic@denx.de
State Accepted
Headers show
Series [1/3] Connect the internal data tree to the shared data structure | expand

Commit Message

Stefano Babic Nov. 17, 2020, 9:41 a.m. UTC
It can be useful to know inside an embedded script which selection is
running.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 core/stream_interface.c | 24 ++++++++++++++++++++++++
 include/util.h          |  2 ++
 2 files changed, 26 insertions(+)
diff mbox series

Patch

diff --git a/core/stream_interface.c b/core/stream_interface.c
index 7df33ec..3f8a168 100644
--- a/core/stream_interface.c
+++ b/core/stream_interface.c
@@ -617,6 +617,30 @@  void *network_initializer(void *data)
 	pthread_exit((void *)0);
 }
 
+/*
+ * Accessors to get information about an update, they are the interface
+ * to the "inst" structure.
+ */
+
+void get_install_swset(char *buf, size_t len)
+{
+
+	if (!buf)
+		return;
+
+	strncpy(buf, inst.software->software_set, len - 1);
+
+}
+
+void get_install_running_mode(char *buf, size_t len)
+{
+
+	if (!buf)
+		return;
+
+	strncpy(buf, inst.software->running_mode, len - 1);
+}
+
 /*
  * Retrieve additional info sent by the source
  * The data is not locked because it is retrieve
diff --git a/include/util.h b/include/util.h
index 99da3a8..92aec5f 100644
--- a/include/util.h
+++ b/include/util.h
@@ -226,6 +226,8 @@  int set_aes_ivt(const char *ivt);
 
 /* Getting global information */
 int get_install_info(sourcetype *source, char *buf, size_t len);
+void get_install_swset(char *buf, size_t len);
+void get_install_running_mode(char *buf, size_t len);
 
 unsigned long long ustrtoull(const char *cp, unsigned int base);