linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Kubecek <mkubecek@suse.cz>
To: David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Cc: Johannes Berg <johannes@sipsolutions.net>, linux-kernel@vger.kernel.org
Subject: [PATCH net 2/3] netlink: add nl_set_extack_cookie_u32()
Date: Sun, 15 Mar 2020 18:17:48 +0100 (CET)	[thread overview]
Message-ID: <1c58a7ea30236aedbd0f87611778878071b0b4a6.1584292182.git.mkubecek@suse.cz> (raw)
In-Reply-To: <cover.1584292182.git.mkubecek@suse.cz>

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>
---
 include/linux/netlink.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 205fa7b1f07a..4090524c3462 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -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);
-- 
2.25.1


  parent reply	other threads:[~2020-03-15 17:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-15 17:17 [PATCH net 0/3] ethtool: fail with error if request has unknown flags Michal Kubecek
2020-03-15 17:17 ` [PATCH net 1/3] netlink: allow extack cookie also for error messages Michal Kubecek
2020-03-15 17:17 ` Michal Kubecek [this message]
2020-03-15 17:17 ` [PATCH net 3/3] ethtool: reject unrecognized request flags Michal Kubecek
2020-03-16  9:39   ` Sergei Shtylyov
2020-03-16  9:04 ` [PATCH net 0/3] ethtool: fail with error if request has unknown flags David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c58a7ea30236aedbd0f87611778878071b0b4a6.1584292182.git.mkubecek@suse.cz \
    --to=mkubecek@suse.cz \
    --cc=davem@davemloft.net \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).