diff mbox series

Name of a running handler is never updated in the progress_msg

Message ID 3fb0220105ef46d8a7a92f213a320582@COIL-ExMb3.woodward.com
State Accepted
Headers show
Series Name of a running handler is never updated in the progress_msg | expand

Commit Message

'Darko Komljenovic' via swupdate July 3, 2019, 2:05 p.m. UTC
Fix: hnd_name is set when new installation of an image is started

Signed-off-by: Daniel Cyran <daniel.cyran@woodward.com>
---
 corelib/installer.c       | 2 +-
 corelib/progress_thread.c | 3 ++-
 include/progress.h        | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

Comments

Stefano Babic July 11, 2019, 5:24 p.m. UTC | #1
On 03/07/19 16:05, 'Daniel Cyran' via swupdate wrote:
> Fix: hnd_name is set when new installation of an image is started
> 
> Signed-off-by: Daniel Cyran <daniel.cyran@woodward.com>
> ---
>  corelib/installer.c       | 2 +-
>  corelib/progress_thread.c | 3 ++-
>  include/progress.h        | 2 +-
>  3 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/corelib/installer.c b/corelib/installer.c
> index 498fcc8..ff6cb18 100644
> --- a/corelib/installer.c
> +++ b/corelib/installer.c
> @@ -233,7 +233,7 @@ int install_single_image(struct img_type *img, int dry_run)
>  	}
>  	TRACE("Found installer for stream %s %s", img->fname, hnd->desc);
>  
> -	swupdate_progress_inc_step(img->fname);
> +	swupdate_progress_inc_step(img->fname, hnd->desc);
>  
>  	/* TODO : check callback to push results / progress */
>  	ret = hnd->installer(img, hnd->data);
> diff --git a/corelib/progress_thread.c b/corelib/progress_thread.c
> index b3fad3d..4f29d6a 100644
> --- a/corelib/progress_thread.c
> +++ b/corelib/progress_thread.c
> @@ -113,13 +113,14 @@ void swupdate_progress_update(unsigned int perc)
>  	pthread_mutex_unlock(&prbar->lock);
>  }
>  
> -void swupdate_progress_inc_step(char *image)
> +void swupdate_progress_inc_step(char *image, char *handler_name)
>  {
>  	struct swupdate_progress *prbar = &progress;
>  	pthread_mutex_lock(&prbar->lock);
>  	prbar->msg.cur_step++;
>  	prbar->msg.cur_percent = 0;
>  	strncpy(prbar->msg.cur_image, image, sizeof(prbar->msg.cur_image));
> +	strncpy(prbar->msg.hnd_name, handler_name, sizeof(prbar->msg.hnd_name));
>  	prbar->step_running = true;
>  	prbar->msg.status = RUN;
>  	send_progress_msg();
> diff --git a/include/progress.h b/include/progress.h
> index 982bdd0..b4d09d2 100644
> --- a/include/progress.h
> +++ b/include/progress.h
> @@ -18,7 +18,7 @@
>   */
>  void swupdate_progress_init(unsigned int nsteps);
>  void swupdate_progress_update(unsigned int perc);
> -void swupdate_progress_inc_step(char *image);
> +void swupdate_progress_inc_step(char *image, char *handler_name);
>  void swupdate_progress_step_completed(void);
>  void swupdate_progress_end(RECOVERY_STATUS status);
>  void swupdate_progress_done(const char *info);
> 

Applied to -master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/corelib/installer.c b/corelib/installer.c
index 498fcc8..ff6cb18 100644
--- a/corelib/installer.c
+++ b/corelib/installer.c
@@ -233,7 +233,7 @@  int install_single_image(struct img_type *img, int dry_run)
 	}
 	TRACE("Found installer for stream %s %s", img->fname, hnd->desc);
 
-	swupdate_progress_inc_step(img->fname);
+	swupdate_progress_inc_step(img->fname, hnd->desc);
 
 	/* TODO : check callback to push results / progress */
 	ret = hnd->installer(img, hnd->data);
diff --git a/corelib/progress_thread.c b/corelib/progress_thread.c
index b3fad3d..4f29d6a 100644
--- a/corelib/progress_thread.c
+++ b/corelib/progress_thread.c
@@ -113,13 +113,14 @@  void swupdate_progress_update(unsigned int perc)
 	pthread_mutex_unlock(&prbar->lock);
 }
 
-void swupdate_progress_inc_step(char *image)
+void swupdate_progress_inc_step(char *image, char *handler_name)
 {
 	struct swupdate_progress *prbar = &progress;
 	pthread_mutex_lock(&prbar->lock);
 	prbar->msg.cur_step++;
 	prbar->msg.cur_percent = 0;
 	strncpy(prbar->msg.cur_image, image, sizeof(prbar->msg.cur_image));
+	strncpy(prbar->msg.hnd_name, handler_name, sizeof(prbar->msg.hnd_name));
 	prbar->step_running = true;
 	prbar->msg.status = RUN;
 	send_progress_msg();
diff --git a/include/progress.h b/include/progress.h
index 982bdd0..b4d09d2 100644
--- a/include/progress.h
+++ b/include/progress.h
@@ -18,7 +18,7 @@ 
  */
 void swupdate_progress_init(unsigned int nsteps);
 void swupdate_progress_update(unsigned int perc);
-void swupdate_progress_inc_step(char *image);
+void swupdate_progress_inc_step(char *image, char *handler_name);
 void swupdate_progress_step_completed(void);
 void swupdate_progress_end(RECOVERY_STATUS status);
 void swupdate_progress_done(const char *info);