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

Cyrill Gorcunov gorcunov at openvz.org
Thu Mar 15 16:00:04 EDT 2012


On Thu, Mar 15, 2012 at 11:46:19PM +0400, Pavel Emelyanov wrote:
> 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;
>                 }
>         }
> 

Well, it could be done in a separate patch (because dump_socket_queue
do return error directly via ret without adding additional fuzz after
this patch). I'll think about it.

> 
> >   - 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.
> 

OK, I'll update.

	Cyrill


More information about the CRIU mailing list