Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 801f8746 authored by Johannes Berg's avatar Johannes Berg
Browse files

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: default avatarJohannes Berg <johannes.berg@intel.com>
Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent e0ba7095
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -110,6 +110,15 @@ struct netlink_ext_ack {
	}						\
	}						\
} while (0)
} 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 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);
extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);