[CRIU] Re: [PATCH 01/10] parasite: Refactor code to follow calling convention

Pavel Emelyanov xemul at parallels.com
Thu Mar 15 15:46:19 EDT 2012


On 03/13/2012 12:55 AM, Cyrill Gorcunov wrote:
> It happened some routines in parasite service code
> were not following calling convention so I fixed the
> callers and added a comment about adding new code here.
> 
> At the same time the 3 error code madness is dropped
> as being requested by Pavel -- now we return one error
> code only.
> 
> The PARASITE_ERR_ codes were dropped as well due to
> become redundant.
> 
> The status of parasite service routine is set via
> SET_PARASITE helpers
> 
>  - SET_PARASITE_ERR, if you have some error code
>    to return
> 
>  - SET_PARASITE_RET, if you have some value to return,
>    but you don't know if it's error or not (basically
>    it's simply semanatic wrapper over SET_PARASITE_ERR,
>    should be used in places where _ERR version migh confuse
>    the reader)

One wrong usage in the patch:

-               ret = dump_socket_queue(img_fd, &args->items[i], &err);
+               ret = dump_socket_queue(img_fd, &args->items[i]);
                if (ret < 0) {
-                       SET_PARASITE_STATUS(st, ret, err);
+                       SET_PARASITE_RET(st, ret);
                        goto err_dmp;
                }
        }


>   - SET_PARASITE_FAIL, if it's a generic error

Unused, can be removed.

>   - SET_PARASITE_PASS, if routine finished without errors

IMHO can be dropped. If the parasite function ret code is 0, then the
status can be not read at all.

> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  include/parasite.h |   42 ++++++------
>  parasite-syscall.c |   10 +--
>  parasite.c         |  192 ++++++++++++++++++++++++++++++----------------------
>  3 files changed, 137 insertions(+), 107 deletions(-)
> 


More information about the CRIU mailing list