Backports Archive on lore.kernel.org
 help / color / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: backports@vger.kernel.org
Cc: johannes@sipsolutions.net, Hauke Mehrtens <hauke@hauke-m.de>
Subject: [PATCH 07/12] backport: Add genl_callback_extack() function
Date: Mon,  5 Aug 2019 14:06:59 +0200
Message-ID: <20190805120704.13128-8-hauke@hauke-m.de> (raw)
In-Reply-To: <20190805120704.13128-1-hauke@hauke-m.de>

The struct netlink_callback got a new extack attribute in commit
4a19edb60d02 ("netlink: Pass extack to dump handlers") in kernel 4.20.
Use a function instead of directly accessing it to return NULL on older
kernel versions, the code should handle NULL.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/net/genetlink.h | 10 ++++++++++
 patches/0078-genl-extack.cocci            |  6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/backport/backport-include/net/genetlink.h b/backport/backport-include/net/genetlink.h
index 772f10f0..747b6dac 100644
--- a/backport/backport-include/net/genetlink.h
+++ b/backport/backport-include/net/genetlink.h
@@ -34,6 +34,16 @@ static inline struct netlink_ext_ack *genl_info_extack(struct genl_info *info)
 #endif
 }
 
+/* this is for patches we apply */
+static inline struct netlink_ext_ack *genl_callback_extack(struct netlink_callback *cb)
+{
+#if LINUX_VERSION_IS_GEQ(4,20,0)
+	return cb->extack;
+#else
+	return NULL;
+#endif
+}
+
 /* this gets put in place of info->userhdr, since we use that above */
 static inline void *genl_info_userhdr(struct genl_info *info)
 {
diff --git a/patches/0078-genl-extack.cocci b/patches/0078-genl-extack.cocci
index 5560e09d..860d68b4 100644
--- a/patches/0078-genl-extack.cocci
+++ b/patches/0078-genl-extack.cocci
@@ -9,3 +9,9 @@ struct genl_info *info;
 @@
 -info->userhdr
 +genl_info_userhdr(info)
+
+@@
+struct netlink_callback *cb;
+@@
+-cb->extack
++genl_callback_extack(cb)
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

  parent reply index

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-05 12:06 [PATCH 00/12] backports: Update to kernel 5.3-rc3 Hauke Mehrtens
2019-08-05 12:06 ` [PATCH 01/12] patches: Refresh patches against " Hauke Mehrtens
2019-08-05 12:06 ` [PATCH 02/12] header: Add BITS_PER_TYPE() Hauke Mehrtens
2019-08-05 12:06 ` [PATCH 03/12] header: Add ktime_get_boottime_ns() Hauke Mehrtens
2019-08-05 12:06 ` [PATCH 04/12] header: Add nl80211_validate_nested() Hauke Mehrtens
2019-08-05 12:06 ` [PATCH 05/12] header: Add trace_##name##_enabled() Hauke Mehrtens
2019-08-05 12:06 ` [PATCH 06/12] header: Remove skb_xmit_more() Hauke Mehrtens
2019-08-05 12:06 ` Hauke Mehrtens [this message]
2019-08-05 12:07 ` [PATCH 08/12] backport: Add arc4 library Hauke Mehrtens
2019-08-05 12:07 ` [PATCH 09/12] patches: Add include in cfg80211.h Hauke Mehrtens
2019-08-05 12:07 ` [PATCH 10/12] patches: Do not use GRO_CONSUMED on kernel < 4.11 Hauke Mehrtens
2019-08-05 12:07 ` [PATCH 11/12] dependencies: Make AIRO depend on kernel 4.20 Hauke Mehrtens
2019-08-05 12:07 ` [PATCH 12/12] kconfig: Update to KConfig to version from kernel 4.17 Hauke Mehrtens

Reply instructions:

You may reply publically 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=20190805120704.13128-8-hauke@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=backports@vger.kernel.org \
    --cc=johannes@sipsolutions.net \
    /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

Backports Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/backports/0 backports/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 backports backports/ https://lore.kernel.org/backports \
		backports@vger.kernel.org backports@archiver.kernel.org
	public-inbox-index backports


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.backports


AGPL code for this site: git clone https://public-inbox.org/ public-inbox