mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
netlink: add helpers for extack attr presence checking
Being able to check attribute presence and set extack if not on one line is handy, add helpers. Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
690252f19f
commit
45dca15759
@@ -139,6 +139,17 @@ struct netlink_ext_ack {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define NL_REQ_ATTR_CHECK(extack, nest, tb, type) ({ \
|
||||
struct nlattr **__tb = (tb); \
|
||||
u32 __attr = (type); \
|
||||
int __retval; \
|
||||
\
|
||||
__retval = !__tb[__attr]; \
|
||||
if (__retval) \
|
||||
NL_SET_ERR_ATTR_MISS((extack), (nest), __attr); \
|
||||
__retval; \
|
||||
})
|
||||
|
||||
static inline void nl_set_extack_cookie_u64(struct netlink_ext_ack *extack,
|
||||
u64 cookie)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user