]> git.baikalelectronics.ru Git - kernel.git/commitdiff
netlink: add nl_set_extack_cookie_u32()
authorMichal Kubecek <mkubecek@suse.cz>
Sun, 15 Mar 2020 17:17:48 +0000 (18:17 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 Mar 2020 09:04:24 +0000 (02:04 -0700)
Similar to existing nl_set_extack_cookie_u64(), add new helper
nl_set_extack_cookie_u32() which sets extack cookie to a u32 value.

Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netlink.h

index 205fa7b1f07adcb4717e32e5497106b09d1d272d..4090524c3462f67fa77d1bddc1864d693f1bada2 100644 (file)
@@ -119,6 +119,15 @@ static inline void nl_set_extack_cookie_u64(struct netlink_ext_ack *extack,
        extack->cookie_len = sizeof(__cookie);
 }
 
+static inline void nl_set_extack_cookie_u32(struct netlink_ext_ack *extack,
+                                           u32 cookie)
+{
+       u32 __cookie = cookie;
+
+       memcpy(extack->cookie, &__cookie, sizeof(__cookie));
+       extack->cookie_len = sizeof(__cookie);
+}
+
 void netlink_kernel_release(struct sock *sk);
 int __netlink_change_ngroups(struct sock *sk, unsigned int groups);
 int netlink_change_ngroups(struct sock *sk, unsigned int groups);