[CRIU] Re: [PATCH 3/8] parasite: Use SET_PARASITE_STATUS_SUCCESS where appropriate

Pavel Emelyanov xemul at parallels.com
Wed Feb 22 05:41:22 EST 2012


On 02/22/2012 12:22 AM, Cyrill Gorcunov wrote:
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>

NAK

The whole parasite_status_t is ugly. We have 4 return codes from parasite:
the one returned by function, the abstract PARASITE_CMD_ERR_XXX one, the
syscall retcode and the __LINE__. Plus, we have a mess in PARASITE_CMD_ERR_XXX
macroses and the way they are set.

Please, rework it to look like:

* Only 3 return codes from parasite -- whether the operation succeeded or not,
  the __LINE__ where error occurred and the corresponding errno value (if applicable).
* Remove PARASITE_CMD_ERR_XXX set
* The SET_PARASITE_STATUS_SUCCESS should thus disappear.

> ---
>  parasite.c |   13 ++++++++-----
>  1 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/parasite.c b/parasite.c
> index d77a24a..544376f 100644
> --- a/parasite.c
> +++ b/parasite.c
> @@ -106,6 +106,7 @@ static int dump_pages_init(parasite_status_t *st)
>  	if (fd_pages[PG_SHARED] < 0)
>  		goto err_s;
>  
> +	SET_PARASITE_STATUS_SUCCESS(st);
>  	return 0;
>  
>  err_s:
> @@ -229,8 +230,7 @@ static int dump_pages(struct parasite_dump_pages_args *args)
>  		}
>  	}
>  
> -	/* on success ret = 0 */
> -	SET_PARASITE_STATUS(st, ret, ret);
> +	SET_PARASITE_STATUS_SUCCESS(st);
>  
>  err_free:
>  	if (map_brk)
> @@ -245,6 +245,8 @@ static int dump_pages_fini(parasite_status_t *st)
>  {
>  	sys_close(fd_pages[PG_PRIV]);
>  	sys_close(fd_pages[PG_SHARED]);
> +
> +	SET_PARASITE_STATUS_SUCCESS(st);
>  	return 0;
>  }
>  
> @@ -289,7 +291,7 @@ static int dump_sigact(parasite_status_t *st)
>  	}
>  
>  	ret = 0;
> -	SET_PARASITE_STATUS(st, 0, ret);
> +	SET_PARASITE_STATUS_SUCCESS(st);
>  
>  err_close:
>  	sys_close(fd);
> @@ -321,6 +323,7 @@ static int dump_itimer(int which, int fd, parasite_status_t *st)
>  		return st->ret;
>  	}
>  
> +	SET_PARASITE_STATUS_SUCCESS(st);
>  	return 0;
>  }
>  
> @@ -351,7 +354,7 @@ static int dump_itimers(parasite_status_t *st)
>  		goto err_close;
>  
>  	ret = 0;
> -	SET_PARASITE_STATUS(st, 0, ret);
> +	SET_PARASITE_STATUS_SUCCESS(st);
>  
>  err_close:
>  	sys_close(fd);
> @@ -369,7 +372,7 @@ static int dump_misc(struct parasite_dump_misc *args)
>  	args->brk = sys_brk(0);
>  	args->blocked = old_blocked;
>  
> -	SET_PARASITE_STATUS(st, 0, 0);
> +	SET_PARASITE_STATUS_SUCCESS(st);
>  	return 0;
>  }
>  



More information about the CRIU mailing list