* [PATCH] backports: deal better with possible_net_t
@ 2015-04-07 8:42 Johannes Berg
2015-04-25 14:01 ` Hauke Mehrtens
0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2015-04-07 8:42 UTC (permalink / raw)
To: backports; +Cc: Emmanuel Grumbach
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] backports: deal better with possible_net_t
2015-04-07 8:42 [PATCH] backports: deal better with possible_net_t Johannes Berg
@ 2015-04-25 14:01 ` Hauke Mehrtens
0 siblings, 0 replies; 2+ messages in thread
From: Hauke Mehrtens @ 2015-04-25 14:01 UTC (permalink / raw)
To: Johannes Berg, backports; +Cc: Emmanuel Grumbach
On 04/07/2015 10:42 AM, Johannes Berg wrote:
> 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
>
Thank you for the patch, I applied and pushed it out.
Hauke
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-25 14:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-07 8:42 [PATCH] backports: deal better with possible_net_t Johannes Berg
2015-04-25 14:01 ` Hauke Mehrtens
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.