Re: [RFC PATCH v2 14/22] devlink: implement DEVLINK_CMD_REGION_NEW

Jacob Keller
2020-03-02T22:35:26Z

On 3/2/2020 9:41 AM, Jiri Pirko wrote:
>> struct devlink_region_ops {
>> const char *name;
>> void (*destructor)(const void *data);
>> + int (*snapshot)(struct devlink *devlink, struct netlink_ext_ack *extack,
>> + u8 **data);
>
> Please have the same type here and for destructor. "u8 *" I guess.
>

So... if I use void **data, this ends up looking a little weird because
core code has to cast to (void **)...

I agree it looks a bit odd to use u8 ** for snapshot and void * for the
destructor.

I really do not want to change destructor to u8 *, because that makes
callers have to write a wrapper function if their destructor is simply
kvfree.

I'm ok with the cast to (void **) but it does seem a bit ugly.

Thoughts on which approach to take, or to leave this as is?

Thanks,
Jake