[CRIU] [PATCH 3/2] libcriu: Ability to fetch arguments from notifications

Cyrill Gorcunov gorcunov at gmail.com
Thu Jun 26 03:15:18 PDT 2014


On Thu, Jun 26, 2014 at 02:06:44PM +0400, Pavel Emelyanov wrote:
> After a bit more thinking I found a way to fetch arguments
> from notifications -- pass opaque value into callback and
> provide a set of calls for exploring one.
> 
> With this we can
> 
> a) provide more data if service supplies additional fields
>    in the future
> b) not check the action name to decide whether or not the
>    requested argument is available
> 
> Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
...
> +/*
> + * The criu_notify_arg_t na argument is an opaque
> + * value that callbacks (cb-s) should pass into
> + * criu_notify_xxx() calls to fetch arbitrary values
> + * from notification. If the value is not available
> + * some non-existing one is reported.
> + */
> +
> +typedef struct _CriuNotify *criu_notify_arg_t;
> +void criu_set_notify(int (*cb)(char *action, criu_notify_arg_t na));
> +
> +/* Get pid of root task. 0 if not available */
> +int criu_notify_pid(criu_notify_arg_t na);

Pavel, I think better to not hide the fact that this type is a _pointer_.
IOW, why not define it as

	typedef struct _CriuNotify criu_notify_arg_t;
	void criu_set_notify(int (*cb)(char *action, criu_notify_arg_t *na));

instead. Everytime you'll be using this function there won't be any question
about if this type is a pointer or not.


More information about the CRIU mailing list