diff mbox series

[V2,01/10] Move global structure for installer in private header

Message ID 20201113083108.12567-2-sbabic@denx.de
State Changes Requested
Headers show
Series Rework and extend IPC for install | expand

Commit Message

Stefano Babic Nov. 13, 2020, 8:30 a.m. UTC
The "struct installer" is a shared global data structure used to store
setup for the current installation and to lock if an update is running
by storing the current status. It is loaded just by the initiator of an
update (the installers as streaming or file). It should be better moved
to a private file instead of beeing in util.h that is included by all
due to get logging facilities.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 core/network_thread.c    |  1 +
 core/stream_interface.c  |  1 +
 include/installer_priv.h | 25 +++++++++++++++++++++++++
 include/util.h           | 12 ------------
 4 files changed, 27 insertions(+), 12 deletions(-)
 create mode 100644 include/installer_priv.h
diff mbox series

Patch

diff --git a/core/network_thread.c b/core/network_thread.c
index b565a80..698c139 100644
--- a/core/network_thread.c
+++ b/core/network_thread.c
@@ -27,6 +27,7 @@ 
 #include "network_ipc.h"
 #include "network_interface.h"
 #include "installer.h"
+#include "installer_priv.h"
 #include "swupdate.h"
 #include "pctl.h"
 #include "generated/autoconf.h"
diff --git a/core/stream_interface.c b/core/stream_interface.c
index 87883ae..8285c72 100644
--- a/core/stream_interface.c
+++ b/core/stream_interface.c
@@ -40,6 +40,7 @@ 
 #include "network_interface.h"
 #include "mongoose_interface.h"
 #include "installer.h"
+#include "installer_priv.h"
 #include "progress.h"
 #include "pctl.h"
 #include "state.h"
diff --git a/include/installer_priv.h b/include/installer_priv.h
new file mode 100644
index 0000000..a84143d
--- /dev/null
+++ b/include/installer_priv.h
@@ -0,0 +1,25 @@ 
+/*
+ * (C) Copyright 2020
+ * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
+ *
+ * SPDX-License-Identifier:     GPL-2.0-or-later
+ */
+
+#ifndef _INSTALLER_PRIV_H
+#define _INSTALLER_PRIV_H
+
+#include "swupdate_status.h"
+
+struct installer {
+	int	fd;			/* install image file handle */
+	RECOVERY_STATUS	status;		/* "idle" or "request source" info */
+	RECOVERY_STATUS	last_install;	/* result from last installation */
+	int	last_error;		/* error code if installation failed */
+	char	errormsg[64];		/* error message if installation failed */
+	sourcetype source; 		/* Who triggered the update */
+	int	dry_run;		/* set it if no changes in hardware must be done */
+	unsigned int len;    		/* Len of data valid in info, data is optional */
+	char	info[2048];   		/* info */
+};
+
+#endif
diff --git a/include/util.h b/include/util.h
index 7d9c721..99da3a8 100644
--- a/include/util.h
+++ b/include/util.h
@@ -76,18 +76,6 @@  enum {
 	RECOVERY_DWL,
 };
 
-struct installer {
-	int	fd;			/* install image file handle */
-	RECOVERY_STATUS	status;		/* "idle" or "request source" info */
-	RECOVERY_STATUS	last_install;	/* result from last installation */
-	int	last_error;		/* error code if installation failed */
-	char	errormsg[64];		/* error message if installation failed */
-	sourcetype source; 		/* Who triggered the update */
-	int	dry_run;		/* set it if no changes in hardware must be done */
-	unsigned int len;    		/* Len of data valid in info */
-	char	info[2048];   		/* info */
-};
-
 typedef void (*notifier) (RECOVERY_STATUS status, int error, int level, const char *msg);
 
 void notify(RECOVERY_STATUS status, int error, int level, const char *msg);