[PATCH] backports: add backport for old devcoredumpm (i.e. < 4.7)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luca Coelho <luciano.coelho@xxxxxxxxx>

The API has changed in kernel version 4.7.  So now we need to backport
to this intermediate version if the kernel is > 3.18, but < 4.7.

To do so, add wrappers around the old functions and save the functions
passed by the caller so that they can be passed by the wrappers.

Signed-off-by: Luca Coelho <luciano.coelho@xxxxxxxxx>
---
 backport/backport-include/linux/bp-devcoredump.h | 27 ++++++++++++++++++++++++
 patches/backport-adjustments/devcoredump.patch   | 10 +++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 backport/backport-include/linux/bp-devcoredump.h

diff --git a/backport/backport-include/linux/bp-devcoredump.h b/backport/backport-include/linux/bp-devcoredump.h
new file mode 100644
index 0000000..f116bd2
--- /dev/null
+++ b/backport/backport-include/linux/bp-devcoredump.h
@@ -0,0 +1,27 @@
+#ifndef __BACKPORT_LINUX_DEVCOREDUMP_H
+#define __BACKPORT_LINUX_DEVCOREDUMP_H
+#include <linux/version.h>
+
+/* We only need to add our wrapper inside the range from 3.18 until
+ * 4.6, outside that we can let our BPAUTO mechanism handle it.
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) &&	\
+     LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0))
+static inline
+void backport_dev_coredumpm(struct device *dev, struct module *owner,
+			    void *data, size_t datalen, gfp_t gfp,
+			    ssize_t (*read_fn)(char *buffer, loff_t offset,
+					    size_t count, void *data,
+					    size_t datalen),
+			    void (*free_fn)(void *data))
+{
+	return dev_coredumpm(dev, owner, (const void *)data, datalen, gfp,
+			     (void *)read_fn, (void *)free_fn);
+}
+
+#define dev_coredumpm LINUX_BACKPORT(dev_coredumpm)
+
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0) &&	\
+	   LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)) */
+
+#endif /* __BACKPORT_LINUX_DEVCOREDUMP_H */
diff --git a/patches/backport-adjustments/devcoredump.patch b/patches/backport-adjustments/devcoredump.patch
index b438f32..2e90720 100644
--- a/patches/backport-adjustments/devcoredump.patch
+++ b/patches/backport-adjustments/devcoredump.patch
@@ -114,3 +114,13 @@
 +#endif /* CPTCFG_BPAUTO_WANT_DEV_COREDUMP */
  
  #endif /* __DEVCOREDUMP_H */
+--- a/include/linux/devcoredump.h
++++ b/include/linux/devcoredump.h
+@@ -1,6 +1,7 @@
+ /* Automatically created during backport process */
+ #ifndef CPTCFG_BPAUTO_BUILD_WANT_DEV_COREDUMP
+ #include_next <linux/devcoredump.h>
++#include <linux/bp-devcoredump.h>
+ #else
+ #undef dev_coredumpv
+ #define dev_coredumpv LINUX_BACKPORT(dev_coredumpv)
-- 
2.8.1

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



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux