diff mbox series

[10/12] Enum for cause field in progress messages

Message ID 20231016165740.1374614-10-stefano.babic@swupdate.org
State Changes Requested
Delegated to: Stefano Babic
Headers show
Series [01/12] Cleanup: use #pragma once in all headers | expand

Commit Message

Stefano Babic Oct. 16, 2023, 4:57 p.m. UTC
The cause field is unused up now and just zeroed. Add an enum to support
info of specific type and replace occurencies where zero is forced.

The first introduced cause is CAUSE_REBOOT_MODE to infor if the update
requires a reboot or it is a on the fly update.

Signed-off-by: Stefano Babic <stefano.babic@swupdate.org>
---
 core/parser.c      | 2 +-
 include/progress.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/core/parser.c b/core/parser.c
index 50d9957b..28005597 100644
--- a/core/parser.c
+++ b/core/parser.c
@@ -265,7 +265,7 @@  int parse(struct swupdate_cfg *sw, const char *descfile)
 	if (asprintf(&versioninfo, "{\"VERSION\" : \"%s\"}", sw->version) == ENOMEM_ASPRINTF)
 		ERROR("OOM sending version info");
 	else {
-		swupdate_progress_info(RUN, 0, versioninfo);
+		swupdate_progress_info(RUN, NONE, versioninfo);
 		free(versioninfo);
 	}
 
diff --git a/include/progress.h b/include/progress.h
index de680f47..af7b702c 100644
--- a/include/progress.h
+++ b/include/progress.h
@@ -10,6 +10,11 @@ 
 #include <swupdate_status.h>
 #include <progress_ipc.h>
 
+typedef enum progress_cause {
+	CAUSE_NONE,
+	CAUSE_REBOOT_MODE,
+} progress_cause_t;
+
 /*
  * Internal SWUpdate functions to drive the progress
  * interface. Common progress definitions for internal