[CRIU] [PATCH 3/2] libcriu: Ability to fetch arguments from notifications
Pavel Emelyanov
xemul at parallels.com
Thu Jun 26 03:33:25 PDT 2014
On 06/26/2014 02:15 PM, Cyrill Gorcunov wrote:
> 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.
Why should lib user know whether it's a pointer or not? I'd prefer that it
doesn't, so no attempts to dereference :)
Thanks,
Pavel
More information about the CRIU
mailing list