diff mbox series

Consolidate variable naming for the dry run option

Message ID 20200424144930.30928-1-christian.storm@siemens.com
State Accepted
Headers show
Series Consolidate variable naming for the dry run option | expand

Commit Message

Storm, Christian April 24, 2020, 2:49 p.m. UTC
There are different spellings for the dry run option,
consolidate them to dry_run.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 core/network_thread.c   | 2 +-
 core/stream_interface.c | 2 +-
 corelib/channel_curl.c  | 2 +-
 include/network_ipc.h   | 4 ++--
 ipc/network_ipc-if.c    | 4 ++--
 ipc/network_ipc.c       | 4 ++--
 tools/swupdate-client.c | 8 ++++----
 7 files changed, 13 insertions(+), 13 deletions(-)

Comments

Stefano Babic April 27, 2020, 8:33 p.m. UTC | #1
On 24.04.20 16:49, Christian Storm wrote:
> There are different spellings for the dry run option,
> consolidate them to dry_run.
> 
> Signed-off-by: Christian Storm <christian.storm@siemens.com>
> ---
>  core/network_thread.c   | 2 +-
>  core/stream_interface.c | 2 +-
>  corelib/channel_curl.c  | 2 +-
>  include/network_ipc.h   | 4 ++--
>  ipc/network_ipc-if.c    | 4 ++--
>  ipc/network_ipc.c       | 4 ++--
>  tools/swupdate-client.c | 8 ++++----
>  7 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/core/network_thread.c b/core/network_thread.c
> index 0fd6227..41f17e5 100644
> --- a/core/network_thread.c
> +++ b/core/network_thread.c
> @@ -350,7 +350,7 @@ void *network_thread (void *data)
>  					instp->len = min(msg.data.instmsg.len, sizeof(instp->info));
>  
>  					/*
> -					 * Communicate if a dryrun is asked and set it
> +					 * Communicate if a dry run is asked and set it
>  					 */
>  					if (msg.type == REQ_INSTALL_DRYRUN)
>  						instp->dry_run = 1;
> diff --git a/core/stream_interface.c b/core/stream_interface.c
> index bf502e5..e0d6fa4 100644
> --- a/core/stream_interface.c
> +++ b/core/stream_interface.c
> @@ -501,7 +501,7 @@ void *network_initializer(void *data)
>  		notify(START, RECOVERY_NO_ERROR, INFOLEVEL, "Software Update started !");
>  
>  		/*
> -		 * Check if the dryrun flag is overwrittn
> +		 * Check if the dry run flag is overwritten
>  		 */
>  		if (inst.dry_run)
>  			software->globals.dry_run = 1;
> diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c
> index 128f2ec..5acae2c 100644
> --- a/corelib/channel_curl.c
> +++ b/corelib/channel_curl.c
> @@ -898,7 +898,7 @@ channel_op_res_t channel_get_file(channel_t *this, void *data)
>  		file_handle = ipc_inst_start_ext(channel_data->source,
>  			channel_data->info == NULL ? 0 : strlen(channel_data->info),
>  			channel_data->info,
> -			false /*no dryrun */);
> +			false /*no dry run */);
>  		if (file_handle > 0)
>  			break;
>  		sleep(1);
> diff --git a/include/network_ipc.h b/include/network_ipc.h
> index 9cc40f8..520ae09 100644
> --- a/include/network_ipc.h
> +++ b/include/network_ipc.h
> @@ -78,7 +78,7 @@ typedef struct {
>  
>  char *get_ctrl_socket(void);
>  int ipc_inst_start(void);
> -int ipc_inst_start_ext(sourcetype source, size_t len, const char *info, bool dryrun);
> +int ipc_inst_start_ext(sourcetype source, size_t len, const char *info, bool dry_run);
>  int ipc_send_data(int connfd, char *buf, int size);
>  void ipc_end(int connfd);
>  int ipc_get_status(ipc_message *msg);
> @@ -92,7 +92,7 @@ typedef int (*terminated)(RECOVERY_STATUS status);
>  int ipc_wait_for_complete(getstatus callback);
>  int swupdate_image_write(char *buf, int size);
>  int swupdate_async_start(writedata wr_func, getstatus status_func,
> -				terminated end_func, bool dryrun);
> +				terminated end_func, bool dry_run);
>  
>  #ifdef __cplusplus
>  }   // extern "C"
> diff --git a/ipc/network_ipc-if.c b/ipc/network_ipc-if.c
> index 1f6a4d7..06cf74c 100644
> --- a/ipc/network_ipc-if.c
> +++ b/ipc/network_ipc-if.c
> @@ -108,7 +108,7 @@ static pthread_t start_ipc_thread(void *(* start_routine) (void *), void *arg)
>   * Only one running request is accepted
>   */
>  int swupdate_async_start(writedata wr_func, getstatus status_func,
> -				terminated end_func, bool dryrun)
> +				terminated end_func, bool dry_run)
>  {
>  	struct async_lib *rq;
>  	int connfd;
> @@ -122,7 +122,7 @@ int swupdate_async_start(writedata wr_func, getstatus status_func,
>  	rq->get = status_func;
>  	rq->end = end_func;
>  
> -	connfd = ipc_inst_start_ext(SOURCE_UNKNOWN, 0, NULL, dryrun);
> +	connfd = ipc_inst_start_ext(SOURCE_UNKNOWN, 0, NULL, dry_run);
>  
>  	if (connfd < 0)
>  		return connfd;
> diff --git a/ipc/network_ipc.c b/ipc/network_ipc.c
> index 96215e9..9b5d811 100644
> --- a/ipc/network_ipc.c
> +++ b/ipc/network_ipc.c
> @@ -175,7 +175,7 @@ int ipc_get_status_timeout(ipc_message *msg, unsigned int timeout_ms)
>  	return ret;
>  }
>  
> -int ipc_inst_start_ext(sourcetype source, size_t len, const char *buf, bool dryrun)
> +int ipc_inst_start_ext(sourcetype source, size_t len, const char *buf, bool dry_run)
>  {
>  	int connfd;
>  	ipc_message msg;
> @@ -191,7 +191,7 @@ int ipc_inst_start_ext(sourcetype source, size_t len, const char *buf, bool dryr
>  	 * Command is request to install
>  	 */
>  	msg.magic = IPC_MAGIC;
> -	msg.type = (!dryrun) ? REQ_INSTALL : REQ_INSTALL_DRYRUN;
> +	msg.type = (!dry_run) ? REQ_INSTALL : REQ_INSTALL_DRYRUN;
>  
>  	/*
>  	 * Pass data from interface originating
> diff --git a/tools/swupdate-client.c b/tools/swupdate-client.c
> index d73d2bb..32928f5 100644
> --- a/tools/swupdate-client.c
> +++ b/tools/swupdate-client.c
> @@ -39,7 +39,7 @@ static void usage(void) {
>  	fprintf(stdout,
>  		" Available OPTIONS\n"
>  		" -h : print help and exit\n"
> -		" -d : ask the server to only perform a dryrun\n"
> +		" -d : ask the server to only perform a dry run\n"
>  		" -q : go quite, resets verbosity\n"
>  		" -v : go verbose, essentially print upgrade status messages from server\n"
>  		" -p : ask the server to run post-update commands if upgrade succeeds\n"
> @@ -49,7 +49,7 @@ static void usage(void) {
>  char buf[256];
>  int fd = STDIN_FILENO;
>  int verbose = 1;
> -bool dryrun = false;
> +bool dry_run = false;
>  bool run_postupdate = false;
>  int end_status = EXIT_SUCCESS;
>  
> @@ -130,7 +130,7 @@ static int send_file(const char* filename) {
>  	end_status = EXIT_SUCCESS;
>  
>  	rc = swupdate_async_start(readimage, printstatus,
> -				end, dryrun);
> +				end, dry_run);
>  
>  	/* return if we've hit an error scenario */
>  	if (rc < 0) {
> @@ -165,7 +165,7 @@ int main(int argc, char *argv[]) {
>  	while ((c = getopt(argc, argv, "dhqvp")) != EOF) {
>  		switch (c) {
>  		case 'd':
> -			dryrun = true;
> +			dry_run = true;
>  			break;
>  		case 'h':
>  			usage();
> 

Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/core/network_thread.c b/core/network_thread.c
index 0fd6227..41f17e5 100644
--- a/core/network_thread.c
+++ b/core/network_thread.c
@@ -350,7 +350,7 @@  void *network_thread (void *data)
 					instp->len = min(msg.data.instmsg.len, sizeof(instp->info));
 
 					/*
-					 * Communicate if a dryrun is asked and set it
+					 * Communicate if a dry run is asked and set it
 					 */
 					if (msg.type == REQ_INSTALL_DRYRUN)
 						instp->dry_run = 1;
diff --git a/core/stream_interface.c b/core/stream_interface.c
index bf502e5..e0d6fa4 100644
--- a/core/stream_interface.c
+++ b/core/stream_interface.c
@@ -501,7 +501,7 @@  void *network_initializer(void *data)
 		notify(START, RECOVERY_NO_ERROR, INFOLEVEL, "Software Update started !");
 
 		/*
-		 * Check if the dryrun flag is overwrittn
+		 * Check if the dry run flag is overwritten
 		 */
 		if (inst.dry_run)
 			software->globals.dry_run = 1;
diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c
index 128f2ec..5acae2c 100644
--- a/corelib/channel_curl.c
+++ b/corelib/channel_curl.c
@@ -898,7 +898,7 @@  channel_op_res_t channel_get_file(channel_t *this, void *data)
 		file_handle = ipc_inst_start_ext(channel_data->source,
 			channel_data->info == NULL ? 0 : strlen(channel_data->info),
 			channel_data->info,
-			false /*no dryrun */);
+			false /*no dry run */);
 		if (file_handle > 0)
 			break;
 		sleep(1);
diff --git a/include/network_ipc.h b/include/network_ipc.h
index 9cc40f8..520ae09 100644
--- a/include/network_ipc.h
+++ b/include/network_ipc.h
@@ -78,7 +78,7 @@  typedef struct {
 
 char *get_ctrl_socket(void);
 int ipc_inst_start(void);
-int ipc_inst_start_ext(sourcetype source, size_t len, const char *info, bool dryrun);
+int ipc_inst_start_ext(sourcetype source, size_t len, const char *info, bool dry_run);
 int ipc_send_data(int connfd, char *buf, int size);
 void ipc_end(int connfd);
 int ipc_get_status(ipc_message *msg);
@@ -92,7 +92,7 @@  typedef int (*terminated)(RECOVERY_STATUS status);
 int ipc_wait_for_complete(getstatus callback);
 int swupdate_image_write(char *buf, int size);
 int swupdate_async_start(writedata wr_func, getstatus status_func,
-				terminated end_func, bool dryrun);
+				terminated end_func, bool dry_run);
 
 #ifdef __cplusplus
 }   // extern "C"
diff --git a/ipc/network_ipc-if.c b/ipc/network_ipc-if.c
index 1f6a4d7..06cf74c 100644
--- a/ipc/network_ipc-if.c
+++ b/ipc/network_ipc-if.c
@@ -108,7 +108,7 @@  static pthread_t start_ipc_thread(void *(* start_routine) (void *), void *arg)
  * Only one running request is accepted
  */
 int swupdate_async_start(writedata wr_func, getstatus status_func,
-				terminated end_func, bool dryrun)
+				terminated end_func, bool dry_run)
 {
 	struct async_lib *rq;
 	int connfd;
@@ -122,7 +122,7 @@  int swupdate_async_start(writedata wr_func, getstatus status_func,
 	rq->get = status_func;
 	rq->end = end_func;
 
-	connfd = ipc_inst_start_ext(SOURCE_UNKNOWN, 0, NULL, dryrun);
+	connfd = ipc_inst_start_ext(SOURCE_UNKNOWN, 0, NULL, dry_run);
 
 	if (connfd < 0)
 		return connfd;
diff --git a/ipc/network_ipc.c b/ipc/network_ipc.c
index 96215e9..9b5d811 100644
--- a/ipc/network_ipc.c
+++ b/ipc/network_ipc.c
@@ -175,7 +175,7 @@  int ipc_get_status_timeout(ipc_message *msg, unsigned int timeout_ms)
 	return ret;
 }
 
-int ipc_inst_start_ext(sourcetype source, size_t len, const char *buf, bool dryrun)
+int ipc_inst_start_ext(sourcetype source, size_t len, const char *buf, bool dry_run)
 {
 	int connfd;
 	ipc_message msg;
@@ -191,7 +191,7 @@  int ipc_inst_start_ext(sourcetype source, size_t len, const char *buf, bool dryr
 	 * Command is request to install
 	 */
 	msg.magic = IPC_MAGIC;
-	msg.type = (!dryrun) ? REQ_INSTALL : REQ_INSTALL_DRYRUN;
+	msg.type = (!dry_run) ? REQ_INSTALL : REQ_INSTALL_DRYRUN;
 
 	/*
 	 * Pass data from interface originating
diff --git a/tools/swupdate-client.c b/tools/swupdate-client.c
index d73d2bb..32928f5 100644
--- a/tools/swupdate-client.c
+++ b/tools/swupdate-client.c
@@ -39,7 +39,7 @@  static void usage(void) {
 	fprintf(stdout,
 		" Available OPTIONS\n"
 		" -h : print help and exit\n"
-		" -d : ask the server to only perform a dryrun\n"
+		" -d : ask the server to only perform a dry run\n"
 		" -q : go quite, resets verbosity\n"
 		" -v : go verbose, essentially print upgrade status messages from server\n"
 		" -p : ask the server to run post-update commands if upgrade succeeds\n"
@@ -49,7 +49,7 @@  static void usage(void) {
 char buf[256];
 int fd = STDIN_FILENO;
 int verbose = 1;
-bool dryrun = false;
+bool dry_run = false;
 bool run_postupdate = false;
 int end_status = EXIT_SUCCESS;
 
@@ -130,7 +130,7 @@  static int send_file(const char* filename) {
 	end_status = EXIT_SUCCESS;
 
 	rc = swupdate_async_start(readimage, printstatus,
-				end, dryrun);
+				end, dry_run);
 
 	/* return if we've hit an error scenario */
 	if (rc < 0) {
@@ -165,7 +165,7 @@  int main(int argc, char *argv[]) {
 	while ((c = getopt(argc, argv, "dhqvp")) != EOF) {
 		switch (c) {
 		case 'd':
-			dryrun = true;
+			dry_run = true;
 			break;
 		case 'h':
 			usage();