backports: add spatch to backport ndo_stats64 prototype change
authorJohannes Berg <johannes.berg@intel.com>
Tue, 7 Feb 2017 10:20:07 +0000 (11:20 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 7 Feb 2017 14:07:19 +0000 (15:07 +0100)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
patches/0075-ndo-stats-64.cocci [new file with mode: 0644]

diff --git a/patches/0075-ndo-stats-64.cocci b/patches/0075-ndo-stats-64.cocci
new file mode 100644 (file)
index 0000000..ac449de
--- /dev/null
@@ -0,0 +1,28 @@
+@r@
+identifier OPS;
+identifier stats64_fn;
+fresh identifier stats64_fn_wrap = "bp_" ## stats64_fn;
+position p;
+@@
+struct net_device_ops OPS@p = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
+       .ndo_get_stats64 = stats64_fn,
++#else
++      .ndo_get_stats64 = stats64_fn_wrap,
++#endif
+};
+
+@@
+identifier r.stats64_fn_wrap;
+identifier r.stats64_fn;
+@@
+void stats64_fn(...) {...}
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0)
++static struct rtnl_link_stats64 *
++stats64_fn_wrap(struct net_device *dev,
++               struct rtnl_link_stats64 *stats)
++{
++      stats64_fn(dev, stats);
++      return stats;
++}
++#endif