From: Johannes Berg <johannes@sipsolutions.net>
To: backports@vger.kernel.org
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH] backports: deal better with possible_net_t
Date: Tue, 7 Apr 2015 10:42:18 +0200 [thread overview]
Message-ID: <1428396138-11310-1-git-send-email-johannes@sipsolutions.net> (raw)
From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Instead of just assuming CONFIG_NET_NS is defined, deal with
this better. Sadly, it needs a header file patch (as an spatch
doesn't deal properly with header files.)
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
backport/backport-include/net/net_namespace.h | 22 +++++++++++++++++++++-
.../network/0053-possible_net_t.patch | 19 +++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
create mode 100644 patches/collateral-evolutions/network/0053-possible_net_t.patch
diff --git a/backport/backport-include/net/net_namespace.h b/backport/backport-include/net/net_namespace.h
index b9f8b2ba7dba..90c044f1ba31 100644
--- a/backport/backport-include/net/net_namespace.h
+++ b/backport/backport-include/net/net_namespace.h
@@ -36,7 +36,27 @@ static inline struct net *get_net_ns_by_fd(int fd)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
-#define possible_net_t struct net *
+typedef struct {
+#ifdef CONFIG_NET_NS
+ struct net *net;
#endif
+} possible_net_t;
+
+static inline void possible_write_pnet(possible_net_t *pnet, struct net *net)
+{
+#ifdef CONFIG_NET_NS
+ pnet->net = net;
+#endif
+}
+
+static inline struct net *possible_read_pnet(const possible_net_t *pnet)
+{
+#ifdef CONFIG_NET_NS
+ return pnet->net;
+#else
+ return &init_net;
+#endif
+}
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) */
#endif /* _COMPAT_NET_NET_NAMESPACE_H */
diff --git a/patches/collateral-evolutions/network/0053-possible_net_t.patch b/patches/collateral-evolutions/network/0053-possible_net_t.patch
new file mode 100644
index 000000000000..c2217b5b9d42
--- /dev/null
+++ b/patches/collateral-evolutions/network/0053-possible_net_t.patch
@@ -0,0 +1,19 @@
+diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
+index 04e5785..a251da1 100644
+--- a/include/net/cfg80211.h
++++ b/include/net/cfg80211.h
+@@ -3239,12 +3239,12 @@ struct wiphy {
+
+ static inline struct net *wiphy_net(struct wiphy *wiphy)
+ {
+- return read_pnet(&wiphy->_net);
++ return possible_read_pnet(&wiphy->_net);
+ }
+
+ static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
+ {
+- write_pnet(&wiphy->_net, net);
++ possible_write_pnet(&wiphy->_net, net);
+ }
+
+ /**
--
2.1.4
next reply other threads:[~2015-04-07 8:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 8:42 Johannes Berg [this message]
2015-04-25 14:01 ` [PATCH] backports: deal better with possible_net_t Hauke Mehrtens
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=1428396138-11310-1-git-send-email-johannes@sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=backports@vger.kernel.org \
--cc=emmanuel.grumbach@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.