[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e652424b85218d370a9bbf922cf09f8b21b26822.camel@sipsolutions.net>
Date: Wed, 24 Aug 2022 21:44:22 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net
Cc: netdev@...r.kernel.org, edumazet@...gle.com, pabeni@...hat.com,
mkubecek@...e.cz
Subject: Re: [PATCH net-next 3/6] genetlink: add helper for checking
required attrs and use it in devlink
On Tue, 2022-08-23 at 21:50 -0700, Jakub Kicinski wrote:
>
> +/* Report that a root attribute is missing */
> +#define GENL_REQ_ATTR_CHECK(info, attr) ({ \
> + struct genl_info *__info = (info); \
> + u32 __attr = (attr); \
> + int __retval; \
> + \
> + __retval = !__info->attrs[__attr]; \
> + if (__retval) \
> + NL_SET_ERR_ATTR_MISS(__info->extack, \
> + __info->userhdr ? : __info->genlhdr, \
> + __attr); \
> + __retval; \
> +})
Not sure this needs to be a macro btw, could be an inline returning a
bool? You're not really expanding anything here, nor doing something
with strings (unlike GENL_SET_ERR_MSG for example.)
johannes
Powered by blists - more mailing lists