aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netlink.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2018-08-23 10:48:13 +0200
committerJohannes Berg <johannes.berg@intel.com>2018-11-09 11:20:07 +0100
commit801f87469ee8d97af5997ef52188bb0e1908b110 (patch)
tree099bea79832948f202936299d1159b0f4d67be61 /include/linux/netlink.h
parentmac80211: tx: avoid variable shadowing (diff)
downloadlinux-dev-801f87469ee8d97af5997ef52188bb0e1908b110.tar.xz
linux-dev-801f87469ee8d97af5997ef52188bb0e1908b110.zip
netlink: add nl_set_extack_cookie_u64()
Add a helper function nl_set_extack_cookie_u64() to use a u64 as the netlink extended ACK cookie, to avoid having to open-code it in any users of the cookie. A u64 should be sufficient for most subsystems though we allow for up to 20 bytes right now. This also matches the cookies in nl80211 where I intend to use this. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/linux/netlink.h')
-rw-r--r--include/linux/netlink.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 4da90a6ab536..0b83dbae0a57 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -110,6 +110,15 @@ struct netlink_ext_ack {
} \
} while (0)
+static inline void nl_set_extack_cookie_u64(struct netlink_ext_ack *extack,
+ u64 cookie)
+{
+ u64 __cookie = cookie;
+
+ memcpy(extack->cookie, &__cookie, sizeof(__cookie));
+ extack->cookie_len = sizeof(__cookie);
+}
+
extern void netlink_kernel_release(struct sock *sk);
extern int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);