diff mbox series

[2/6] Type dry_run as bool

Message ID 20210311114031.71507-2-sbabic@denx.de
State Changes Requested
Headers show
Series [1/6] Introduce an upper check for version to be installed | expand

Commit Message

Stefano Babic March 11, 2021, 11:40 a.m. UTC
dry_run is used as boolean, switch from int type.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 core/installer.c        | 4 ++--
 core/stream_interface.c | 4 ++--
 core/swupdate.c         | 2 +-
 include/installer.h     | 2 +-
 include/swupdate.h      | 4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/core/installer.c b/core/installer.c
index a324f1b..fdce432 100644
--- a/core/installer.c
+++ b/core/installer.c
@@ -209,7 +209,7 @@  static int run_prepost_scripts(struct imglist *list, script_fn type)
 	return 0;
 }
 
-int install_single_image(struct img_type *img, int dry_run)
+int install_single_image(struct img_type *img, bool dry_run)
 {
 	struct installer_handler *hnd;
 	int ret;
@@ -255,7 +255,7 @@  int install_images(struct swupdate_cfg *sw)
 	char *filename;
 	struct stat buf;
 	const char* TMPDIR = get_tmpdir();
-	int dry_run = sw->globals.dry_run;
+	bool dry_run = sw->globals.dry_run;
 	bool dropimg;
 
 	/* Extract all scripts, preinstall scripts must be run now */
diff --git a/core/stream_interface.c b/core/stream_interface.c
index d459010..6566bf9 100644
--- a/core/stream_interface.c
+++ b/core/stream_interface.c
@@ -525,10 +525,10 @@  void *network_initializer(void *data)
 		 */
 		switch (req->dry_run){
 		case RUN_DRYRUN:
-			software->globals.dry_run = 1;
+			software->globals.dry_run = true;
 			break;
 		case RUN_INSTALL:
-			software->globals.dry_run = 0;
+			software->globals.dry_run = false;
 			break;
 		case RUN_DEFAULT:
 		default:
diff --git a/core/swupdate.c b/core/swupdate.c
index 2b7cdc2..617a19b 100644
--- a/core/swupdate.c
+++ b/core/swupdate.c
@@ -629,7 +629,7 @@  int main(int argc, char **argv)
 			loglevel = strtoul(optarg, NULL, 10);
 			break;
 		case 'n':
-			swcfg.globals.default_dry_run = 1;
+			swcfg.globals.default_dry_run = true;
 			break;
 		case 'L':
 			swcfg.globals.syslog_enabled = 1;
diff --git a/include/installer.h b/include/installer.h
index f69a94f..9e7fb16 100644
--- a/include/installer.h
+++ b/include/installer.h
@@ -18,7 +18,7 @@  swupdate_file_t check_if_required(struct imglist *list, struct filehdr *pfdh,
 				const char *destdir,
 				struct img_type **pimg);
 int install_images(struct swupdate_cfg *sw);
-int install_single_image(struct img_type *img, int dry_run);
+int install_single_image(struct img_type *img, bool dry_run);
 int install_from_file(const char *filename, bool check);
 int postupdate(struct swupdate_cfg *swcfg, const char *info);
 int preupdatecmd(struct swupdate_cfg *swcfg);
diff --git a/include/swupdate.h b/include/swupdate.h
index f9b6093..d2ff532 100644
--- a/include/swupdate.h
+++ b/include/swupdate.h
@@ -127,7 +127,7 @@  struct swupdate_global_cfg {
 	char mtdblacklist[SWUPDATE_GENERAL_STRING_SIZE];
 	int loglevel;
 	int syslog_enabled;
-	int dry_run;
+	bool dry_run;
 	int no_downgrading;
 	int no_reinstalling;
 	int no_transaction_marker;
@@ -139,7 +139,7 @@  struct swupdate_global_cfg {
 	char preupdatecmd[SWUPDATE_GENERAL_STRING_SIZE];
 	char default_software_set[SWUPDATE_GENERAL_STRING_SIZE];
 	char default_running_mode[SWUPDATE_GENERAL_STRING_SIZE];
-	int  default_dry_run;
+	bool default_dry_run;
 	char minimum_version[SWUPDATE_GENERAL_STRING_SIZE];
 	char maximum_version[SWUPDATE_GENERAL_STRING_SIZE];
 	char current_version[SWUPDATE_GENERAL_STRING_SIZE];