Hi Luis,
You will find in answer of this mail the first part of the compat upgrade I am
using to support a network-oriented module on kernel from 2.6.15 to 2.6.36.
All this code is available on my repository on github:
https://github.com/lacombar/linux-compat.git local
This repository also contains the second part I will post later concerning a
tentative to reduce namespace pollution when using the compat module. As it is
mostly mechanical, I will start another thread with a single proof of concept
patch and gather feedbacks :)
Comments welcome !
Thanks,
- Arnaud
Arnaud Lacombe (44):
compat/2.6.17: add header's skeleton
compat/2.6.17: add compat macro for `NET_SKB_PAD'
compat/2.6.18: add compat skeleton for the `hwrng' API
compat/2.6.18: add compat inline for netdev_alloc_skb()
compat/2.6.19: fix comment
compat/2.6.19: add typedef for `bool' and `true'/`false'
compat/2.6.19: rework compat macro to kmem_cache_destroy()
compat/2.6.20: add header's skeleton
compat/2.6.20: add compat macro for `struct delayed_work'
compat/2.6.23: add compat inline for notifier_{from,to}_errno()
compat/2.6.24: add compat macro for sk_alloc()
compat/2.6.25: don't include <linux/hw_random.h> prior to 2.6.18
compat/2.6.25: don't include <linux/{io,leds}.h> prior to 2.6.17
compat/2.6.25: conditionally defines `__WARN'
compat/2.6.25: add compat macro for ip_route_output_key()
compat/2.6.29: don't include <linux/if_link.h> prior to 2.6.19
compat/2.6.29: const'ify compat inline to dev_get_stats()
compat/2.6.31: gather all the threaded IRQ backport together
compat/2.6.31: fix threaded irq backport wrt. INIT_WORK() macro
compat/2.6.32: fix compat inline to flush_delayed_work()
compat/2.6.32: add compat macros for sysctl helpers
compat/2.6.33: add compat macro to BUILD_BUG_ON_NOT_POWER_OF_2()
compat/2.6.33: fix pcmcia include
compat/2.6.33: don't export prototype for pccard_loop_tuple()
compat/2.6.36: `va_list' needs <stdarg.h>
compat: remove a couple of macro definition protection
compat/2.6.33: remove macro not in mainline
compat: avoid using `#include_next' directive in compat headers
compat/2.6.22: rework `uninitialized_var' and `__maybe_unused' macros
compat/2.6.22: nuke pci_{clear,set}_mwi()
compat/2.6.22: add compat for couple of TCP accessors
compat/2.6.22: add compat inline for ip_hdrlen()
compat/2.6.22: constify skb_transport_header()'s argument
compat/2.6.24: move 'struct net' to its own compat header
compat/2.6.26: {U,}SHORT_MAX/SHORT_MIN have been deprecated
compat/2.6.26: move unaligned backport to its own header
compat/2.6.2{7,8}: fix definition for IEEE80211_HT_CAP_DSSSCCK40
compat/2.6.2{8,9}: fix tracepoint macros
compat/2.6.29: protect headers inclusion
compat/2.6.29: don't waste space around DIV_ROUND_CLOSEST()
compat/2.6.29: fix typos
compat/2.6.{21,30}: make dev_set_uevent_suppress() a no-op for
<2.6.21
compat/2.6.{19,31}: fix threaded irq backport for <2.6.19
compat/2.6.35: 2.6.35 does not define `SHRT_MIN'
include/linux/asm/unaligned.h | 194 ++++++++++++++++++++++++++++++++++++
include/linux/compat-2.6.17.h | 13 +++
include/linux/compat-2.6.18.h | 45 +++++++++
include/linux/compat-2.6.19.h | 23 ++---
include/linux/compat-2.6.20.h | 14 +++
include/linux/compat-2.6.22.h | 41 ++++++--
include/linux/compat-2.6.23.h | 18 +++-
include/linux/compat-2.6.24.h | 34 +------
include/linux/compat-2.6.25.h | 10 ++-
include/linux/compat-2.6.26.h | 219 +----------------------------------------
include/linux/compat-2.6.27.h | 3 -
include/linux/compat-2.6.28.h | 27 +-----
include/linux/compat-2.6.29.h | 40 ++++++--
include/linux/compat-2.6.30.h | 2 +
include/linux/compat-2.6.31.h | 54 ++++++++---
include/linux/compat-2.6.32.h | 31 ++++++-
include/linux/compat-2.6.33.h | 12 +--
include/linux/compat-2.6.35.h | 1 -
include/linux/compat-2.6.36.h | 1 +
include/linux/pm_qos_params.h | 7 +-
include/linux/tracepoint.h | 14 ++--
include/net/net_namespace.h | 50 ++++++++--
include/trace/define_trace.h | 5 -
23 files changed, 503 insertions(+), 355 deletions(-)
create mode 100644 include/linux/asm/unaligned.h
create mode 100644 include/linux/compat-2.6.17.h
create mode 100644 include/linux/compat-2.6.20.h
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.29.h | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/compat-2.6.29.h b/include/linux/compat-2.6.29.h
index fa29806..b83aca0 100644
--- a/include/linux/compat-2.6.29.h
+++ b/include/linux/compat-2.6.29.h
@@ -2,7 +2,10 @@
#define LINUX_26_29_COMPAT_H
#include <linux/version.h>
+
#include <linux/netdevice.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
#include <linux/if_link.h>
#endif
@@ -14,8 +17,6 @@
*/
#include <linux/compat-2.6.32.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
-
#include <linux/skbuff.h>
#include <linux/usb.h>
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/asm/unaligned.h | 194 +++++++++++++++++++++++++++++++++++++
include/linux/compat-2.6.26.h | 214 +----------------------------------------
2 files changed, 197 insertions(+), 211 deletions(-)
create mode 100644 include/linux/asm/unaligned.h
diff --git a/include/linux/asm/unaligned.h b/include/linux/asm/unaligned.h
new file mode 100644
index 0000000..7175e92
--- /dev/null
+++ b/include/linux/asm/unaligned.h
@@ -0,0 +1,194 @@
+#ifndef _COMPAT_ASM_UNALIGNED_H
+#define _COMPAT_ASM_UNALIGNED_H
+
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
+
+/*
+ * 2.6.26 added its own unaligned API which the
+ * new drivers can use. Lets port it here by including it in older
+ * kernels and also deal with the architecture handling here.
+ */
+
+#ifdef CONFIG_ALPHA
+#include <linux/unaligned/be_struct.h>
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/generic.h>
+#endif /* alpha */
+
+#ifdef CONFIG_ARM
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/be_byteshift.h>
+#include <linux/unaligned/generic.h>
+#endif /* arm */
+
+#ifdef CONFIG_AVR32
+/*
+ * AVR32 can handle some unaligned accesses, depending on the
+ * implementation. The AVR32 AP implementation can handle unaligned
+ * words, but halfwords must be halfword-aligned, and doublewords must
+ * be word-aligned.
+ *
+ * However, swapped word loads must be word-aligned so we can't
+ * optimize word loads in general.
+ */
+#include <linux/unaligned/be_struct.h>
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/generic.h>
+#endif
+
+#ifdef CONFIG_BLACKFIN
+#include <linux/unaligned/le_struct.h>
+#include <linux/unaligned/be_byteshift.h>
+#include <linux/unaligned/generic.h>
+#endif /* blackfin */
+
+#ifdef CONFIG_CRIS
+/*
+ * CRIS can do unaligned accesses itself.
+ */
+#include <linux/unaligned/access_ok.h>
+#include <linux/unaligned/generic.h>
+#endif /* cris */
+
+#ifdef CONFIG_FRV
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/be_byteshift.h>
+#include <linux/unaligned/generic.h>
+#endif /* frv */
+
+#ifdef CONFIG_H8300
+#include <linux/unaligned/be_memmove.h>
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/generic.h>
+#endif /* h8300 */
+
+#ifdef CONFIG_IA64
+#include <linux/unaligned/le_struct.h>
+#include <linux/unaligned/be_byteshift.h>
+#include <linux/unaligned/generic.h>
+#endif /* ia64 */
+
+#ifdef CONFIG_M32R
+#if defined(__LITTLE_ENDIAN__)
+# include <linux/unaligned/le_memmove.h>
+# include <linux/unaligned/be_byteshift.h>
+# include <linux/unaligned/generic.h>
+#else
+# include <linux/unaligned/be_memmove.h>
+# include <linux/unaligned/le_byteshift.h>
+# include <linux/unaligned/generic.h>
+#endif
+#endif /* m32r */
+
+#ifdef CONFIG_M68K /* this handles both m68k and m68knommu */
+#ifdef CONFIG_COLDFIRE
+#include <linux/unaligned/be_struct.h>
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/generic.h>
+#else
+/*
+ * The m68k can do unaligned accesses itself.
+ */
+#include <linux/unaligned/access_ok.h>
+#include <linux/unaligned/generic.h>
+#endif
+#endif /* m68k and m68knommu */
+
+#ifdef CONFIG_MIPS
+#if defined(__MIPSEB__)
+# include <linux/unaligned/be_struct.h>
+# include <linux/unaligned/le_byteshift.h>
+# include <linux/unaligned/generic.h>
+# define get_unaligned __get_unaligned_be
+# define put_unaligned __put_unaligned_be
+#elif defined(__MIPSEL__)
+# include <linux/unaligned/le_struct.h>
+# include <linux/unaligned/be_byteshift.h>
+# include <linux/unaligned/generic.h>
+#endif
+#endif /* mips */
+
+#ifdef CONFIG_MN10300
+#include <linux/unaligned/access_ok.h>
+#include <linux/unaligned/generic.h>
+#endif /* mn10300 */
+
+#ifdef CONFIG_PARISC
+#include <linux/unaligned/be_struct.h>
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/generic.h>
+#endif /* parisc */
+
+#ifdef CONFIG_PPC
+/*
+ * The PowerPC can do unaligned accesses itself in big endian mode.
+ */
+#include <linux/unaligned/access_ok.h>
+#include <linux/unaligned/generic.h>
+#endif /* ppc */
+
+#ifdef CONFIG_S390
+/*
+ * The S390 can do unaligned accesses itself.
+ */
+#include <linux/unaligned/access_ok.h>
+#include <linux/unaligned/generic.h>
+#endif /* s390 */
+
+#ifdef CONFIG_SUPERH
+/* SH can't handle unaligned accesses. */
+#ifdef __LITTLE_ENDIAN__
+# include <linux/unaligned/le_struct.h>
+# include <linux/unaligned/be_byteshift.h>
+# include <linux/unaligned/generic.h>
+#else
+# include <linux/unaligned/be_struct.h>
+# include <linux/unaligned/le_byteshift.h>
+# include <linux/unaligned/generic.h>
+#endif
+#endif /* sh - SUPERH */
+
+#ifdef CONFIG_SPARC
+/* sparc and sparc64 */
+#include <linux/unaligned/be_struct.h>
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/generic.h>
+#endif /* sparc */
+
+#ifdef CONFIG_UML
+#include "asm/arch/unaligned.h"
+#endif /* um - uml */
+
+#ifdef CONFIG_V850
+#include <linux/unaligned/be_byteshift.h>
+#include <linux/unaligned/le_byteshift.h>
+#include <linux/unaligned/generic.h>
+#endif /* v850 */
+
+#ifdef CONFIG_X86
+/*
+ * The x86 can do unaligned accesses itself.
+ */
+#include <linux/unaligned/access_ok.h>
+#include <linux/unaligned/generic.h>
+#endif /* x86 */
+
+#ifdef CONFIG_XTENSA
+#ifdef __XTENSA_EL__
+# include <linux/unaligned/le_memmove.h>
+# include <linux/unaligned/be_byteshift.h>
+# include <linux/unaligned/generic.h>
+#elif defined(__XTENSA_EB__)
+# include <linux/unaligned/be_memmove.h>
+# include <linux/unaligned/le_byteshift.h>
+# include <linux/unaligned/generic.h>
+#else
+# error processor byte order undefined!
+#endif
+#endif /* xtensa */
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) */
+
+#endif /* _COMPAT_ASM_UNALIGNED_H */
diff --git a/include/linux/compat-2.6.26.h b/include/linux/compat-2.6.26.h
index 38e1d8d..9178e49 100644
--- a/include/linux/compat-2.6.26.h
+++ b/include/linux/compat-2.6.26.h
@@ -181,217 +181,9 @@ struct net *dev_net(const struct net_device *dev)
#endif
}
-
-/*
- * 2.6.26 added its own unaligned API which the
- * new drivers can use. Lets port it here by including it in older
- * kernels and also deal with the architecture handling here.
- */
-
-#ifdef CONFIG_ALPHA
-
-#include <linux/unaligned/be_struct.h>
-#include <linux/unaligned/le_byteshift.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* alpha */
-#ifdef CONFIG_ARM
-
-/* arm */
-#include <linux/unaligned/le_byteshift.h>
-#include <linux/unaligned/be_byteshift.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* arm */
-#ifdef CONFIG_AVR32
-
-/*
- * AVR32 can handle some unaligned accesses, depending on the
- * implementation. The AVR32 AP implementation can handle unaligned
- * words, but halfwords must be halfword-aligned, and doublewords must
- * be word-aligned.
- *
- * However, swapped word loads must be word-aligned so we can't
- * optimize word loads in general.
- */
-
-#include <linux/unaligned/be_struct.h>
-#include <linux/unaligned/le_byteshift.h>
-#include <linux/unaligned/generic.h>
-
-#endif
-#ifdef CONFIG_BLACKFIN
-
-#include <linux/unaligned/le_struct.h>
-#include <linux/unaligned/be_byteshift.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* blackfin */
-#ifdef CONFIG_CRIS
-
-/*
- * CRIS can do unaligned accesses itself.
- */
-#include <linux/unaligned/access_ok.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* cris */
-#ifdef CONFIG_FRV
-
-#include <linux/unaligned/le_byteshift.h>
-#include <linux/unaligned/be_byteshift.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* frv */
-#ifdef CONFIG_H8300
-
-#include <linux/unaligned/be_memmove.h>
-#include <linux/unaligned/le_byteshift.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* h8300 */
-#ifdef CONFIG_IA64
-
-#include <linux/unaligned/le_struct.h>
-#include <linux/unaligned/be_byteshift.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* ia64 */
-#ifdef CONFIG_M32R
-
-#if defined(__LITTLE_ENDIAN__)
-# include <linux/unaligned/le_memmove.h>
-# include <linux/unaligned/be_byteshift.h>
-# include <linux/unaligned/generic.h>
-#else
-# include <linux/unaligned/be_memmove.h>
-# include <linux/unaligned/le_byteshift.h>
-# include <linux/unaligned/generic.h>
-#endif
-
-#endif /* m32r */
-#ifdef CONFIG_M68K /* this handles both m68k and m68knommu */
-
-#ifdef CONFIG_COLDFIRE
-#include <linux/unaligned/be_struct.h>
-#include <linux/unaligned/le_byteshift.h>
-#include <linux/unaligned/generic.h>
-#else
-
-/*
- * The m68k can do unaligned accesses itself.
- */
-#include <linux/unaligned/access_ok.h>
-#include <linux/unaligned/generic.h>
-#endif
-
-#endif /* m68k and m68knommu */
-#ifdef CONFIG_MIPS
-
-#if defined(__MIPSEB__)
-# include <linux/unaligned/be_struct.h>
-# include <linux/unaligned/le_byteshift.h>
-# include <linux/unaligned/generic.h>
-# define get_unaligned __get_unaligned_be
-# define put_unaligned __put_unaligned_be
-#elif defined(__MIPSEL__)
-# include <linux/unaligned/le_struct.h>
-# include <linux/unaligned/be_byteshift.h>
-# include <linux/unaligned/generic.h>
-#endif
-
-#endif /* mips */
-#ifdef CONFIG_MN10300
-
-#include <linux/unaligned/access_ok.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* mn10300 */
-#ifdef CONFIG_PARISC
-
-#include <linux/unaligned/be_struct.h>
-#include <linux/unaligned/le_byteshift.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* parisc */
-#ifdef CONFIG_PPC
-/*
- * The PowerPC can do unaligned accesses itself in big endian mode.
- */
-#include <linux/unaligned/access_ok.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* ppc */
-#ifdef CONFIG_S390
-
-/*
- * The S390 can do unaligned accesses itself.
- */
-#include <linux/unaligned/access_ok.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* s390 */
-#ifdef CONFIG_SUPERH
-
-/* SH can't handle unaligned accesses. */
-#ifdef __LITTLE_ENDIAN__
-# include <linux/unaligned/le_struct.h>
-# include <linux/unaligned/be_byteshift.h>
-# include <linux/unaligned/generic.h>
-#else
-# include <linux/unaligned/be_struct.h>
-# include <linux/unaligned/le_byteshift.h>
-# include <linux/unaligned/generic.h>
-#endif
-
-#endif /* sh - SUPERH */
-#ifdef CONFIG_SPARC
-
-/* sparc and sparc64 */
-#include <linux/unaligned/be_struct.h>
-#include <linux/unaligned/le_byteshift.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* sparc */
-#ifdef CONFIG_UML
-
-#include "asm/arch/unaligned.h"
-
-#endif /* um - uml */
-#ifdef CONFIG_V850
-
-#include <linux/unaligned/be_byteshift.h>
-#include <linux/unaligned/le_byteshift.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* v850 */
-#ifdef CONFIG_X86
-/*
- * The x86 can do unaligned accesses itself.
- */
-#include <linux/unaligned/access_ok.h>
-#include <linux/unaligned/generic.h>
-
-#endif /* x86 */
-#ifdef CONFIG_XTENSA
-
-#ifdef __XTENSA_EL__
-# include <linux/unaligned/le_memmove.h>
-# include <linux/unaligned/be_byteshift.h>
-# include <linux/unaligned/generic.h>
-#elif defined(__XTENSA_EB__)
-# include <linux/unaligned/be_memmove.h>
-# include <linux/unaligned/le_byteshift.h>
-# include <linux/unaligned/generic.h>
-#else
-# error processor byte order undefined!
-#endif
-
-#endif /* xtensa */
-
-#define PCIE_LINK_STATE_L0S 1
-#define PCIE_LINK_STATE_L1 2
-#define PCIE_LINK_STATE_CLKPM 4
+#define PCIE_LINK_STATE_L0S 1
+#define PCIE_LINK_STATE_L1 2
+#define PCIE_LINK_STATE_CLKPM 4
static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
{
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.29.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/include/linux/compat-2.6.29.h b/include/linux/compat-2.6.29.h
index ef40d00..bd112d0 100644
--- a/include/linux/compat-2.6.29.h
+++ b/include/linux/compat-2.6.29.h
@@ -229,7 +229,8 @@ static inline struct sk_buff *skb_queue_prev(const struct sk_buff_head *list,
}
-static inline struct net_device_stats *dev_get_stats(struct net_device *dev)
+static inline const struct net_device_stats *
+dev_get_stats(struct net_device *dev)
{
return dev->get_stats(dev);
}
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.23.h | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/include/linux/compat-2.6.23.h b/include/linux/compat-2.6.23.h
index 5dd6301..1a486ab 100644
--- a/include/linux/compat-2.6.23.h
+++ b/include/linux/compat-2.6.23.h
@@ -84,10 +84,6 @@ static inline void tcf_destroy_chain_compat(struct tcf_proto **fl)
#define da_users dmi_users
#define da_gusers dmi_gusers
-/* dev_set_promiscuity() was moved to __dev_set_promiscuity() on 2.6.23 and
- * dev_set_promiscuity() became a wrapper. */
-#define __dev_set_promiscuity dev_set_promiscuity
-
/* Our own 2.6.22 port on compat.c */
extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
extern int dev_mc_sync(struct net_device *to, struct net_device *from);
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.19.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/compat-2.6.19.h b/include/linux/compat-2.6.19.h
index 1e648c0..9bb1ace 100644
--- a/include/linux/compat-2.6.19.h
+++ b/include/linux/compat-2.6.19.h
@@ -19,6 +19,6 @@ compat_kmem_cache_destroy(struct kmem_cache *cachep)
#endif
}
-#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)) */
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) */
#endif /* LINUX_26_19_COMPAT_H */
--
1.7.2.30.gc37d7.dirty
Protect their definitions, and add fallbacks.
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.22.h | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/include/linux/compat-2.6.22.h b/include/linux/compat-2.6.22.h
index 7ca1b18..174a269 100644
--- a/include/linux/compat-2.6.22.h
+++ b/include/linux/compat-2.6.22.h
@@ -80,9 +80,18 @@ static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
memcpy(to, skb->data + offset, len);
}
-#define __maybe_unused __attribute__((unused))
+#if defined(__GNUC__)
+#define __maybe_unused __attribute__((unused))
+#define uninitialized_var(x) x = x
+#endif
+
+#ifndef __maybe_unused
+#define __maybe_unused /* unimplemented */
+#endif
-#define uninitialized_var(x) x = x
+#ifndef uninitialized_var
+#define uninitialized_var(x) x
+#endif
/* This will lead to very weird behaviour... */
#define NLA_BINARY NLA_STRING
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.20.h | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
create mode 100644 include/linux/compat-2.6.20.h
diff --git a/include/linux/compat-2.6.20.h b/include/linux/compat-2.6.20.h
new file mode 100644
index 0000000..bbfdacb
--- /dev/null
+++ b/include/linux/compat-2.6.20.h
@@ -0,0 +1,11 @@
+#ifndef LINUX_26_20_COMPAT_H
+#define LINUX_26_20_COMPAT_H
+
+#include <linux/version.h>
+
+/* Compat work for 2.6.20 */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) */
+
+#endif /* LINUX_26_20_COMPAT_H */
--
1.7.2.30.gc37d7.dirty
Mainline kernel does not defines any prototype for this function.
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.33.h | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h
index 8c8789d..9b9ad35 100644
--- a/include/linux/compat-2.6.33.h
+++ b/include/linux/compat-2.6.33.h
@@ -87,13 +87,6 @@ int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code,
#endif /* CONFIG_PCMCIA */
-/* loop over CIS entries */
-int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function,
- cisdata_t code, cisparse_t *parse, void *priv_data,
- int (*loop_tuple) (tuple_t *tuple,
- cisparse_t *parse,
- void *priv_data));
-
#endif /* CONFIG_PCCARD */
/* Backport for kfifo
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.22.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/linux/compat-2.6.22.h b/include/linux/compat-2.6.22.h
index 6675027..7c0c615 100644
--- a/include/linux/compat-2.6.22.h
+++ b/include/linux/compat-2.6.22.h
@@ -46,7 +46,7 @@ static inline void skb_set_transport_header(struct sk_buff *skb, int offset)
skb->h.raw = skb->data + offset;
}
-static inline unsigned char *skb_transport_header(struct sk_buff *skb)
+static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
{
return skb->h.raw;
}
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.18.h | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.18.h b/include/linux/compat-2.6.18.h
index 5e0182b..a45cfc7 100644
--- a/include/linux/compat-2.6.18.h
+++ b/include/linux/compat-2.6.18.h
@@ -8,6 +8,30 @@
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
+struct hwrng
+{
+ const char *name;
+ int (*init)(struct hwrng *rng);
+ void (*cleanup)(struct hwrng *rng);
+ int (*data_present)(struct hwrng *rng);
+ int (*data_read)(struct hwrng *rng, u32 *data);
+ unsigned long priv;
+
+ /* internal. */
+ struct list_head list;
+};
+
+static inline int
+hwrng_register(struct hwrng *rng)
+{
+ return -ENOSYS;
+}
+
+static void
+hwrng_unregister(struct hwrng *rng)
+{
+}
+
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) */
#endif /* LINUX_26_18_COMPAT_H */
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.35.h | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/include/linux/compat-2.6.35.h b/include/linux/compat-2.6.35.h
index 32fd039..c1e5dea 100644
--- a/include/linux/compat-2.6.35.h
+++ b/include/linux/compat-2.6.35.h
@@ -11,7 +11,6 @@
/* added on linux/kernel.h */
#define USHRT_MAX ((u16)(~0U))
#define SHRT_MAX ((s16)(USHRT_MAX>>1))
-#define SHRT_MIN ((s16)(-SHRT_MAX - 1))
#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */
#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */
--
1.7.2.30.gc37d7.dirty
Hi,
On Tue, Nov 9, 2010 at 9:20 PM, Arnaud Lacombe <[email protected]> wrote:
> Signed-off-by: Arnaud Lacombe <[email protected]>
> ---
> ?include/linux/compat-2.6.22.h | ? 20 ++++++++++++++++++++
> ?1 files changed, 20 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/compat-2.6.22.h b/include/linux/compat-2.6.22.h
> index e0cdab2..73dbbb6 100644
> --- a/include/linux/compat-2.6.22.h
> +++ b/include/linux/compat-2.6.22.h
> @@ -80,6 +80,26 @@ static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
> ? ? ? ?memcpy(to, skb->data + offset, len);
> ?}
>
> +static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
> +{
> + ? ? ? return (struct iphdr *)skb_network_header(skb);
> +}
> +
Actually, this one is already defined a few lines above, but lost in
the middle of skb accessor inlines :/ I'll remove this part.
- Arnaud
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.22.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.22.h b/include/linux/compat-2.6.22.h
index 73dbbb6..6675027 100644
--- a/include/linux/compat-2.6.22.h
+++ b/include/linux/compat-2.6.22.h
@@ -85,6 +85,11 @@ static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
return (struct iphdr *)skb_network_header(skb);
}
+static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
+{
+ return ip_hdr(skb)->ihl * 4;
+}
+
static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
{
return (struct tcphdr *)skb_transport_header(skb);
--
1.7.2.30.gc37d7.dirty
On Tue, Nov 09, 2010 at 06:20:10PM -0800, Arnaud Lacombe wrote:
> Signed-off-by: Arnaud Lacombe <[email protected]>
> ---
> include/linux/pm_qos_params.h | 7 +++----
> include/linux/tracepoint.h | 14 +++++++-------
> include/net/net_namespace.h | 14 +++++++-------
> include/trace/define_trace.h | 5 -----
> 4 files changed, 17 insertions(+), 23 deletions(-)
>
> diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
> index e1f083c..8c69ab2 100644
> --- a/include/linux/pm_qos_params.h
> +++ b/include/linux/pm_qos_params.h
> @@ -1,8 +1,7 @@
> #include <linux/version.h>
>
> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
> -#include_next <linux/pm_qos_params.h>
> -#else
> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
> +
But will the kernels' own pm_qos_params.h be included for kernels >= 2.6.25?
Luis
This was needed as major API changes was made in 2.6.21.
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.32.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.32.h b/include/linux/compat-2.6.32.h
index 321a89a..873ae3d 100644
--- a/include/linux/compat-2.6.32.h
+++ b/include/linux/compat-2.6.32.h
@@ -20,6 +20,10 @@
static inline void flush_delayed_work(struct delayed_work *dwork)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
+ cancel_delayed_work(dwork);
+ flush_scheduled_work();
+#else
if (del_timer_sync(&dwork->timer)) {
/*
* This is what would happen on 2.6.32 but since we don't have
@@ -34,6 +38,7 @@ static inline void flush_delayed_work(struct delayed_work *dwork)
*/
}
flush_work(&dwork->work);
+#endif
}
/*
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.33.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h
index c2dbc1b..fe1783c 100644
--- a/include/linux/compat-2.6.33.h
+++ b/include/linux/compat-2.6.33.h
@@ -14,6 +14,9 @@
#include <linux/kfifo.h>
#include <linux/firmware.h>
+#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
+ BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
+
#define release_firmware compat_release_firmware
#define request_firmware compat_request_firmware
#define request_firmware_nowait compat_request_firmware_nowait
--
1.7.2.30.gc37d7.dirty
On Tue, Nov 09, 2010 at 06:19:49PM -0800, Arnaud Lacombe wrote:
> Signed-off-by: Arnaud Lacombe <[email protected]>
> ---
> include/linux/compat-2.6.19.h | 11 +----------
> 1 files changed, 1 insertions(+), 10 deletions(-)
>
> diff --git a/include/linux/compat-2.6.19.h b/include/linux/compat-2.6.19.h
> index bcffc47..ddba97d 100644
> --- a/include/linux/compat-2.6.19.h
> +++ b/include/linux/compat-2.6.19.h
> @@ -8,16 +8,7 @@
>
> #include <linux/slab.h>
>
> -static inline int
> -compat_kmem_cache_destroy(struct kmem_cache *cachep)
> -{
> -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
> - return kmem_cache_destroy(cachep);
> -#else
> - kmem_cache_destroy(cachep);
> - return 0;
> -#endif
> -}
> +#define kmem_cache_destroy(cachep) ({ kmem_cache_destroy(cachep); 0; })
Is this because it shall not even fail for older kernels?
Luis
On Mon, Nov 22, 2010 at 6:40 PM, Arnaud Lacombe <[email protected]> wrote:
> Hi,
>
> On Mon, Nov 22, 2010 at 9:32 PM, Luis R. Rodriguez
> <[email protected]> wrote:
>> On Mon, Nov 22, 2010 at 6:19 PM, Arnaud Lacombe <[email protected]> wrote:
>>> Hi,
>>>
>>> On Mon, Nov 22, 2010 at 1:09 PM, Luis R. Rodriguez
>>> <[email protected]> wrote:
>>>> On Sun, Nov 21, 2010 at 5:36 PM, Arnaud Lacombe <[email protected]> wrote:
>>>>> [...]
>>>>> The compat headers should be at the end of the include list, so that
>>>>> the kernel headers get included first, and the compat one will only be
>>>>> when the kernel does not provide the header. This is the only sane way
>>>>> to override kernel provided stuff. That said, there is certainly a
>>>>> use-case I missed.
>>>>
>>>> Agreed, but you are missing the purpose of the trick used here.
>>> certainly :)
>>>
>>>> The
>>>> purpose of the include_next was so that we can name our own
>>>> <linux/pm_qos_params.h> which is part of compat and these directories
>>>> *will* get a priority over the kernel's so that way we can avoid
>>>> ifdef'ing all includes for the same file on the upstream code.
>>> I'm not sure to get what you mean by "we can avoid ifdef'ing all
>>> includes for the same file on the upstream code", can you details ?
>>
>> Ah, that's right, you don't see or use compat-wireless likely. Ok, so
>> what we do for backporting the 802.11 subsystem, Bluetooth and some
>> Ethernet drivers is we take the stock upstream files, stuff them into
>> a new directory, and then apply a series of patches to them to get the
>> files to properly compile. The patches address all things that was not
>> possible to backport through compat.git. Header file changes is one of
>> the typical things we run into. If a new header file is added to newer
>> kernels we can play a hack for older kernels and leave the code intact
>> and introduce our own include/linux/foo.h through compat by prefering
>> the local path over the kernel's path. If we're on newer kernels
>> though include_next will go on the search path and find the kernel's
>> own header file.
>>
> Is there any reason you want the compat's include directory to be
> *before* the kernel include directory ?
Hm, yeah but I forget why. It'll come to me.
> Because just considering this
> issue, if the kernel include directory was seen first, this would not
> arise, as the compat-provided header would just be a fallback.
True.
Luis
Hi,
On Mon, Nov 22, 2010 at 9:32 PM, Luis R. Rodriguez
<[email protected]> wrote:
> On Mon, Nov 22, 2010 at 6:19 PM, Arnaud Lacombe <[email protected]> wrote:
>> Hi,
>>
>> On Mon, Nov 22, 2010 at 1:09 PM, Luis R. Rodriguez
>> <[email protected]> wrote:
>>> On Sun, Nov 21, 2010 at 5:36 PM, Arnaud Lacombe <[email protected]> wrote:
>>>> [...]
>>>> The compat headers should be at the end of the include list, so that
>>>> the kernel headers get included first, and the compat one will only be
>>>> when the kernel does not provide the header. This is the only sane way
>>>> to override kernel provided stuff. That said, there is certainly a
>>>> use-case I missed.
>>>
>>> Agreed, but you are missing the purpose of the trick used here.
>> certainly :)
>>
>>> The
>>> purpose of the include_next was so that we can name our own
>>> <linux/pm_qos_params.h> which is part of compat and these directories
>>> *will* get a priority over the kernel's so that way we can avoid
>>> ifdef'ing all includes for the same file on the upstream code.
>> I'm not sure to get what you mean by "we can avoid ifdef'ing all
>> includes for the same file on the upstream code", can you details ?
>
> Ah, that's right, you don't see or use compat-wireless likely. Ok, so
> what we do for backporting the 802.11 subsystem, Bluetooth and some
> Ethernet drivers is we take the stock upstream files, stuff them into
> a new directory, and then apply a series of patches to them to get the
> files to properly compile. The patches address all things that was not
> possible to backport through compat.git. Header file changes is one of
> the typical things we run into. If a new header file is added to newer
> kernels we can play a hack for older kernels and leave the code intact
> and introduce our own include/linux/foo.h through compat by prefering
> the local path over the kernel's path. If we're on newer kernels
> though include_next will go on the search path and find the kernel's
> own header file.
>
Is there any reason you want the compat's include directory to be
*before* the kernel include directory ? Because just considering this
issue, if the kernel include directory was seen first, this would not
arise, as the compat-provided header would just be a fallback.
- Arnaud
On 2010-11-10 3:20 AM, Arnaud Lacombe wrote:
> Signed-off-by: Arnaud Lacombe <[email protected]>
> ---
> include/linux/pm_qos_params.h | 7 +++----
> include/linux/tracepoint.h | 14 +++++++-------
> include/net/net_namespace.h | 14 +++++++-------
> include/trace/define_trace.h | 5 -----
> 4 files changed, 17 insertions(+), 23 deletions(-)
>
> diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
> index e1f083c..8c69ab2 100644
> --- a/include/linux/pm_qos_params.h
> +++ b/include/linux/pm_qos_params.h
> @@ -1,8 +1,7 @@
> #include <linux/version.h>
>
> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
> -#include_next <linux/pm_qos_params.h>
> -#else
> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
> +
> /* interface for the pm_qos_power infrastructure of the linux kernel.
> *
> * Mark Gross <[email protected]>
> @@ -28,5 +27,5 @@ int pm_qos_requirement(int qos);
>
> int pm_qos_add_notifier(int qos, struct notifier_block *notifier);
> int pm_qos_remove_notifier(int qos, struct notifier_block *notifier);
> -#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) */
>
> +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) */
With #include_next gone, how would the compiler find the other header
file for version >= 2.6.25?
- Felix
powerpc has a MD definition for it already.
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.25.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.25.h b/include/linux/compat-2.6.25.h
index 6183a89..b2bf50f 100644
--- a/include/linux/compat-2.6.25.h
+++ b/include/linux/compat-2.6.25.h
@@ -72,7 +72,9 @@ int compat_pm_qos_power_deinit(void);
/* Although pm_qos stuff is not implemented on <= 2.6.24 lets keep the define */
#define PM_QOS_DEFAULT_VALUE -1
+#ifndef __WARN
#define __WARN(foo) dump_stack()
+#endif
#define dev_emerg(dev, format, arg...) \
dev_printk(KERN_EMERG , dev , format , ## arg)
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.27.h | 3 ---
include/linux/compat-2.6.28.h | 3 +++
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/compat-2.6.27.h b/include/linux/compat-2.6.27.h
index b9d7029..fa2dbd6 100644
--- a/include/linux/compat-2.6.27.h
+++ b/include/linux/compat-2.6.27.h
@@ -86,9 +86,6 @@ bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
#define dma_mapping_error(pdev, dma_addr) dma_mapping_error(dma_addr)
#define pci_dma_mapping_error(pdev, dma_addr) dma_mapping_error(pdev, dma_addr)
-/* This is from include/linux/ieee80211.h */
-#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
-
/* New link list changes added as of 2.6.27, needed for ath9k */
static inline void __list_cut_position(struct list_head *list,
diff --git a/include/linux/compat-2.6.28.h b/include/linux/compat-2.6.28.h
index 1de39ad..4cd623b 100644
--- a/include/linux/compat-2.6.28.h
+++ b/include/linux/compat-2.6.28.h
@@ -234,6 +234,9 @@ extern void skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
unsigned int cmd, unsigned long arg);
+/* This is from include/linux/ieee80211.h */
+#define IEEE80211_HT_CAP_DSSSCCK40 0x1000
+
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */
#endif /* LINUX_26_28_COMPAT_H */
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.19.h | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.19.h b/include/linux/compat-2.6.19.h
index 9bb1ace..bcffc47 100644
--- a/include/linux/compat-2.6.19.h
+++ b/include/linux/compat-2.6.19.h
@@ -19,6 +19,14 @@ compat_kmem_cache_destroy(struct kmem_cache *cachep)
#endif
}
+#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) */
+
+typedef _Bool bool;
+enum {
+ false = 0,
+ true = 1
+};
+
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) */
#endif /* LINUX_26_19_COMPAT_H */
--
1.7.2.30.gc37d7.dirty
Hi,
On Wed, Nov 10, 2010 at 5:24 PM, Luis R. Rodriguez
<[email protected]> wrote:
> On Tue, Nov 09, 2010 at 06:20:10PM -0800, Arnaud Lacombe wrote:
>> Signed-off-by: Arnaud Lacombe <[email protected]>
>> ---
>> ?include/linux/pm_qos_params.h | ? ?7 +++----
>> ?include/linux/tracepoint.h ? ?| ? 14 +++++++-------
>> ?include/net/net_namespace.h ? | ? 14 +++++++-------
>> ?include/trace/define_trace.h ?| ? ?5 -----
>> ?4 files changed, 17 insertions(+), 23 deletions(-)
>>
>> diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
>> index e1f083c..8c69ab2 100644
>> --- a/include/linux/pm_qos_params.h
>> +++ b/include/linux/pm_qos_params.h
>> @@ -1,8 +1,7 @@
>> ?#include <linux/version.h>
>>
>> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
>> -#include_next <linux/pm_qos_params.h>
>> -#else
>> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
>> +
>
> But will the kernels' own pm_qos_params.h be included for kernels >= 2.6.25?
>
The compat headers should be at the end of the include list, so that
the kernel headers get included first, and the compat one will only be
when the kernel does not provide the header. This is the only sane way
to override kernel provided stuff. That said, there is certainly a
use-case I missed.
- Arnaud
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.19.h | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/include/linux/compat-2.6.19.h b/include/linux/compat-2.6.19.h
index bcffc47..ddba97d 100644
--- a/include/linux/compat-2.6.19.h
+++ b/include/linux/compat-2.6.19.h
@@ -8,16 +8,7 @@
#include <linux/slab.h>
-static inline int
-compat_kmem_cache_destroy(struct kmem_cache *cachep)
-{
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
- return kmem_cache_destroy(cachep);
-#else
- kmem_cache_destroy(cachep);
- return 0;
-#endif
-}
+#define kmem_cache_destroy(cachep) ({ kmem_cache_destroy(cachep); 0; })
#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)) */
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.17.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.17.h b/include/linux/compat-2.6.17.h
index 36d9fb2..b7c9473 100644
--- a/include/linux/compat-2.6.17.h
+++ b/include/linux/compat-2.6.17.h
@@ -6,6 +6,8 @@
/* Compat work for 2.6.17 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
+#define NET_SKB_PAD 16
+
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)) */
#endif /* LINUX_26_17_COMPAT_H */
--
1.7.2.30.gc37d7.dirty
On Tue, Nov 09, 2010 at 06:20:18PM -0800, Arnaud Lacombe wrote:
> Signed-off-by: Arnaud Lacombe <[email protected]>
> ---
> include/linux/asm/unaligned.h | 194 +++++++++++++++++++++++++++++++++++++
> include/linux/compat-2.6.26.h | 214 +----------------------------------------
> 2 files changed, 197 insertions(+), 211 deletions(-)
> create mode 100644 include/linux/asm/unaligned.h
Good idea :)
Luis
This fixes the following build error:
include/linux/compat-2.6.36.h:13: error: syntax error before "va_list"
include/linux/compat-2.6.36.h:13: warning: no semicolon at end of struct or union
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.36.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.36.h b/include/linux/compat-2.6.36.h
index 1d929d7..7ca787d 100644
--- a/include/linux/compat-2.6.36.h
+++ b/include/linux/compat-2.6.36.h
@@ -12,6 +12,7 @@
#define kparam_block_sysfs_write(a)
#define kparam_unblock_sysfs_write(a)
+#include <stdarg.h>
struct va_format {
const char *fmt;
va_list *va;
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.18.h | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.18.h b/include/linux/compat-2.6.18.h
index a45cfc7..4a7034a 100644
--- a/include/linux/compat-2.6.18.h
+++ b/include/linux/compat-2.6.18.h
@@ -6,8 +6,29 @@
/* Compat work for 2.6.18 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
+#include <linux/gfp.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
+#ifndef NET_SKB_PAD
+#define NET_SKB_PAD 16
+#endif
+
+static inline struct sk_buff *
+netdev_alloc_skb(struct net_device *dev, unsigned int length)
+{
+ struct sk_buff *skb;
+
+ skb = alloc_skb(length + NET_SKB_PAD, GFP_ATOMIC);
+ if (likely(skb)) {
+ skb_reserve(skb, NET_SKB_PAD);
+ skb->dev = dev;
+ }
+ return skb;
+}
+
struct hwrng
{
const char *name;
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.29.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.29.h b/include/linux/compat-2.6.29.h
index cce678f..ef40d00 100644
--- a/include/linux/compat-2.6.29.h
+++ b/include/linux/compat-2.6.29.h
@@ -3,7 +3,9 @@
#include <linux/version.h>
#include <linux/netdevice.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19))
#include <linux/if_link.h>
+#endif
/*
* I kow this looks odd.. but 2.6.32 added the netdev_tx_t
--
1.7.2.30.gc37d7.dirty
On Tue, Nov 09, 2010 at 06:20:12PM -0800, Arnaud Lacombe wrote:
> All 2.6 kernel have had them.
Odd, wonder why we added it. Ah well, away it goes! Thanks.
Luis
This is was a late network namespace conversion :)
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.25.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.25.h b/include/linux/compat-2.6.25.h
index b2bf50f..4d55bbb 100644
--- a/include/linux/compat-2.6.25.h
+++ b/include/linux/compat-2.6.25.h
@@ -88,6 +88,8 @@ extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct
#define seq_file_net &init_net;
+#define ip_route_output_key(net, rt, fl) ip_route_output_key(rt, fl)
+
enum nf_inet_hooks {
NF_INET_PRE_ROUTING = 0,
NF_INET_LOCAL_IN = 1,
--
1.7.2.30.gc37d7.dirty
It was introduced in 2.6.29, not 2.6.28.
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.28.h | 24 ------------------------
include/linux/compat-2.6.29.h | 20 ++++++++++++++++++++
2 files changed, 20 insertions(+), 24 deletions(-)
diff --git a/include/linux/compat-2.6.28.h b/include/linux/compat-2.6.28.h
index 4cd623b..289ec06 100644
--- a/include/linux/compat-2.6.28.h
+++ b/include/linux/compat-2.6.28.h
@@ -192,30 +192,6 @@ static inline void skb_queue_splice_tail(const struct sk_buff_head *list,
head->qlen += list->qlen;
}
}
-
-#ifndef DECLARE_TRACE
-
-#define TP_PROTO(args...) args
-#define TP_ARGS(args...) args
-
-#define DECLARE_TRACE(name, proto, args) \
- static inline void _do_trace_##name(struct tracepoint *tp, proto) \
- { } \
- static inline void trace_##name(proto) \
- { } \
- static inline int register_trace_##name(void (*probe)(proto)) \
- { \
- return -ENOSYS; \
- } \
- static inline int unregister_trace_##name(void (*probe)(proto)) \
- { \
- return -ENOSYS; \
- }
-
-#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
-#define EXPORT_TRACEPOINT_SYMBOL(name)
-
-
#endif
/* openSuse includes round_jiffies_up in it's kernel 2.6.27.
diff --git a/include/linux/compat-2.6.29.h b/include/linux/compat-2.6.29.h
index bd112d0..fa29806 100644
--- a/include/linux/compat-2.6.29.h
+++ b/include/linux/compat-2.6.29.h
@@ -277,6 +277,26 @@ static inline struct net *read_pnet(struct net * const *pnet)
#endif
+#define TP_PROTO(args...) args
+#define TP_ARGS(args...) args
+
+#define DECLARE_TRACE(name, proto, args) \
+ static inline void _do_trace_##name(struct tracepoint *tp, proto) \
+ { } \
+ static inline void trace_##name(proto) \
+ { } \
+ static inline int register_trace_##name(void (*probe)(proto)) \
+ { \
+ return -ENOSYS; \
+ } \
+ static inline int unregister_trace_##name(void (*probe)(proto)) \
+ { \
+ return -ENOSYS; \
+ }
+
+#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
+#define EXPORT_TRACEPOINT_SYMBOL(name)
+
extern int init_dummy_netdev(struct net_device *dev);
#else
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.17.h | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
create mode 100644 include/linux/compat-2.6.17.h
diff --git a/include/linux/compat-2.6.17.h b/include/linux/compat-2.6.17.h
new file mode 100644
index 0000000..36d9fb2
--- /dev/null
+++ b/include/linux/compat-2.6.17.h
@@ -0,0 +1,11 @@
+#ifndef LINUX_26_17_COMPAT_H
+#define LINUX_26_17_COMPAT_H
+
+#include <linux/version.h>
+
+/* Compat work for 2.6.17 */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17))
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)) */
+
+#endif /* LINUX_26_17_COMPAT_H */
--
1.7.2.30.gc37d7.dirty
On Sun, Nov 21, 2010 at 5:36 PM, Arnaud Lacombe <[email protected]> wrote:
> Hi,
>
> On Wed, Nov 10, 2010 at 5:24 PM, Luis R. Rodriguez
> <[email protected]> wrote:
>> On Tue, Nov 09, 2010 at 06:20:10PM -0800, Arnaud Lacombe wrote:
>>> Signed-off-by: Arnaud Lacombe <[email protected]>
>>> ---
>>> include/linux/pm_qos_params.h | 7 +++----
>>> include/linux/tracepoint.h | 14 +++++++-------
>>> include/net/net_namespace.h | 14 +++++++-------
>>> include/trace/define_trace.h | 5 -----
>>> 4 files changed, 17 insertions(+), 23 deletions(-)
>>>
>>> diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
>>> index e1f083c..8c69ab2 100644
>>> --- a/include/linux/pm_qos_params.h
>>> +++ b/include/linux/pm_qos_params.h
>>> @@ -1,8 +1,7 @@
>>> #include <linux/version.h>
>>>
>>> -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
>>> -#include_next <linux/pm_qos_params.h>
>>> -#else
>>> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
>>> +
>>
>> But will the kernels' own pm_qos_params.h be included for kernels >= 2.6.25?
>>
> The compat headers should be at the end of the include list, so that
> the kernel headers get included first, and the compat one will only be
> when the kernel does not provide the header. This is the only sane way
> to override kernel provided stuff. That said, there is certainly a
> use-case I missed.
Agreed, but you are missing the purpose of the trick used here. The
purpose of the include_next was so that we can name our own
<linux/pm_qos_params.h> which is part of compat and these directories
*will* get a priority over the kernel's so that way we can avoid
ifdef'ing all includes for the same file on the upstream code. Without
an include_next we'd simply skip including the kernel's own original
header file.
Luis
On Tue, Nov 09, 2010 at 06:19:42PM -0800, Arnaud Lacombe wrote:
> Hi Luis,
>
> You will find in answer of this mail the first part of the compat upgrade I am
> using to support a network-oriented module on kernel from 2.6.15 to 2.6.36.
>
> All this code is available on my repository on github:
>
> https://github.com/lacombar/linux-compat.git local
>
> This repository also contains the second part I will post later concerning a
> tentative to reduce namespace pollution when using the compat module. As it is
> mostly mechanical, I will start another thread with a single proof of concept
> patch and gather feedbacks :)
>
> Comments welcome !
All in all, very sexy, thanks alot. Can you provide me with a
git pull url once you review the comments? If you can first
git fetch; git rebase origin/master
that would be great too.
Thanks a lot!
Luis
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.31.h | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.31.h b/include/linux/compat-2.6.31.h
index b9a70bd..b1b7b28 100644
--- a/include/linux/compat-2.6.31.h
+++ b/include/linux/compat-2.6.31.h
@@ -115,12 +115,22 @@ struct compat_threaded_irq {
struct work_struct work;
};
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
+static inline
+void compat_irq_work(void *arg)
+{
+ struct work_struct *work = arg;
+ struct compat_threaded_irq *comp = container_of(work, struct compat_threaded_irq, work);
+ comp->thread_fn(comp->irq, comp->dev_id);
+}
+#else
static inline
void compat_irq_work(struct work_struct *work)
{
struct compat_threaded_irq *comp = container_of(work, struct compat_threaded_irq, work);
comp->thread_fn(comp->irq, comp->dev_id);
}
+#endif
static inline
irqreturn_t compat_irq_dispatcher(int irq, void *dev_id)
@@ -150,7 +160,11 @@ int compat_request_threaded_irq(struct compat_threaded_irq *comp,
comp->handler = handler;
comp->thread_fn = thread_fn;
comp->dev_id = dev_id;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
+ INIT_WORK(&comp->work, compat_irq_work, &comp->work);
+#else
INIT_WORK(&comp->work, compat_irq_work);
+#endif
if (!comp->wq) {
snprintf(comp->wq_name, sizeof(comp->wq_name),
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.24.h | 31 -------------------------------
include/net/net_namespace.h | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/include/linux/compat-2.6.24.h b/include/linux/compat-2.6.24.h
index 6d5dce5..4c1231f 100644
--- a/include/linux/compat-2.6.24.h
+++ b/include/linux/compat-2.6.24.h
@@ -21,37 +21,6 @@
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
-struct proc_dir_entry;
-struct net_device;
-struct net {
- atomic_t count; /* To decided when the network
- * namespace should be freed.
- */
- atomic_t use_count; /* To track references we
- * destroy on demand
- */
- struct list_head list; /* list of network namespaces */
- struct work_struct work; /* work struct for freeing */
-
- struct proc_dir_entry *proc_net;
- struct proc_dir_entry *proc_net_stat;
- struct proc_dir_entry *proc_net_root;
-
- struct net_device *loopback_dev; /* The loopback */
-
- struct list_head dev_base_head;
- struct hlist_head *dev_name_head;
- struct hlist_head *dev_index_head;
-};
-
-#ifdef CONFIG_NET
-/* Init's network namespace */
-extern struct net init_net;
-#define INIT_NET_NS(net_ns) .net_ns = &init_net,
-#else
-#define INIT_NET_NS(net_ns)
-#endif
-
/* Added on 2.6.24 in include/linux/types.h by Al viro on commit 142956af */
typedef unsigned long uintptr_t;
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 23a517a..250fea2 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -5,6 +5,42 @@
#ifndef __NET_NET_NAMESPACE_H
#define __NET_NET_NAMESPACE_H
+#include <linux/list.h>
+#include <linux/workqueue.h>
+
+#include <asm/atomic.h>
+
+struct proc_dir_entry;
+struct net_device;
+struct net {
+ atomic_t count; /* To decided when the network
+ * namespace should be freed.
+ */
+ atomic_t use_count; /* To track references we
+ * destroy on demand
+ */
+ struct list_head list; /* list of network namespaces */
+ struct work_struct work; /* work struct for freeing */
+
+ struct proc_dir_entry *proc_net;
+ struct proc_dir_entry *proc_net_stat;
+ struct proc_dir_entry *proc_net_root;
+
+ struct net_device *loopback_dev; /* The loopback */
+
+ struct list_head dev_base_head;
+ struct hlist_head *dev_name_head;
+ struct hlist_head *dev_index_head;
+};
+
+#ifdef CONFIG_NET
+/* Init's network namespace */
+extern struct net init_net;
+#define INIT_NET_NS(net_ns) .net_ns = &init_net,
+#else
+#define INIT_NET_NS(net_ns)
+#endif
+
#endif /* __NET_NET_NAMESPACE_H */
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) */
--
1.7.2.30.gc37d7.dirty
On Mon, Nov 22, 2010 at 07:22:28PM -0800, Luis R. Rodriguez wrote:
> On Mon, Nov 22, 2010 at 6:40 PM, Arnaud Lacombe <[email protected]> wrote:
> > Hi,
> >
> > On Mon, Nov 22, 2010 at 9:32 PM, Luis R. Rodriguez
> > <[email protected]> wrote:
> >> On Mon, Nov 22, 2010 at 6:19 PM, Arnaud Lacombe <[email protected]> wrote:
> >>> Hi,
> >>>
> >>> On Mon, Nov 22, 2010 at 1:09 PM, Luis R. Rodriguez
> >>> <[email protected]> wrote:
> >>>> On Sun, Nov 21, 2010 at 5:36 PM, Arnaud Lacombe <[email protected]> wrote:
> >>>>> [...]
> >>>>> The compat headers should be at the end of the include list, so that
> >>>>> the kernel headers get included first, and the compat one will only be
> >>>>> when the kernel does not provide the header. This is the only sane way
> >>>>> to override kernel provided stuff. That said, there is certainly a
> >>>>> use-case I missed.
> >>>>
> >>>> Agreed, but you are missing the purpose of the trick used here.
> >>> certainly :)
> >>>
> >>>> The
> >>>> purpose of the include_next was so that we can name our own
> >>>> <linux/pm_qos_params.h> which is part of compat and these directories
> >>>> *will* get a priority over the kernel's so that way we can avoid
> >>>> ifdef'ing all includes for the same file on the upstream code.
> >>> I'm not sure to get what you mean by "we can avoid ifdef'ing all
> >>> includes for the same file on the upstream code", can you details ?
> >>
> >> Ah, that's right, you don't see or use compat-wireless likely. Ok, so
> >> what we do for backporting the 802.11 subsystem, Bluetooth and some
> >> Ethernet drivers is we take the stock upstream files, stuff them into
> >> a new directory, and then apply a series of patches to them to get the
> >> files to properly compile. The patches address all things that was not
> >> possible to backport through compat.git. Header file changes is one of
> >> the typical things we run into. If a new header file is added to newer
> >> kernels we can play a hack for older kernels and leave the code intact
> >> and introduce our own include/linux/foo.h through compat by prefering
> >> the local path over the kernel's path. If we're on newer kernels
> >> though include_next will go on the search path and find the kernel's
> >> own header file.
> >>
> > Is there any reason you want the compat's include directory to be
> > *before* the kernel include directory ?
>
> Hm, yeah but I forget why. It'll come to me.
Ah, OK so its because we provide our own mac80211.h, and new cfg80211.h
Luis
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.26.h | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/include/linux/compat-2.6.26.h b/include/linux/compat-2.6.26.h
index 30ee46c..38e1d8d 100644
--- a/include/linux/compat-2.6.26.h
+++ b/include/linux/compat-2.6.26.h
@@ -39,11 +39,6 @@
#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any"
set = radio enabled */
-/* From kernel.h */
-#define USHORT_MAX ((u16)(~0U))
-#define SHORT_MAX ((s16)(USHORT_MAX>>1))
-#define SHORT_MIN (-SHORT_MAX - 1)
-
extern int dev_set_name(struct device *dev, const char *name, ...)
__attribute__((format(printf, 2, 3)));
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.32.h | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.32.h b/include/linux/compat-2.6.32.h
index 873ae3d..3b9915e 100644
--- a/include/linux/compat-2.6.32.h
+++ b/include/linux/compat-2.6.32.h
@@ -99,6 +99,30 @@ struct dev_pm_ops name = { \
#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
+#define proc_dostring(table, write, buff, lenp, ppos) \
+ ({ proc_dostring(table, write, NULL, buff, lenp, ppos); })
+
+#define proc_dointvec(table, write, buff, lenp, ppos) \
+ ({ proc_dointvec(table, write, NULL, buff, lenp, ppos); })
+
+#define proc_dointvec_minmax(table, write, buff, lenp, ppos) \
+ ({ proc_dointvec_minmax(table, write, NULL, buff, lenp, ppos); })
+
+#define proc_dointvec_jiffies(table, write, buff, lenp, ppos) \
+ ({ proc_dointvec_jiffies(table, write, NULL, buff, lenp, ppos); })
+
+#define proc_dointvec_userhz_jiffies(table, write, buff, lenp, ppos) \
+ ({ proc_dointvec_userhz_jiffies(table, write, NULL, buff, lenp, ppos); })
+
+#define proc_dointvec_ms_jiffies(table, write, buff, lenp, ppos) \
+ ({ proc_dointvec_ms_jiffies(table, write, NULL, buff, lenp, ppos); })
+
+#define proc_doulongvec_minmax(table, write, buff, lenp, ppos) \
+ ({ proc_doulongvec_minmax(table, write, NULL, buff, lenp, ppos); })
+
+#define proc_doulongvec_ms_jiffies_minmax(table, write, buff, lenp, ppos) \
+ ({ proc_doulongvec_ms_jiffies_minmax(table, write, NULL, buff, lenp, ppos); })
+
#define lockdep_assert_held(l) do { } while (0)
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) */
--
1.7.2.30.gc37d7.dirty
Hi,
On Mon, Nov 22, 2010 at 1:09 PM, Luis R. Rodriguez
<[email protected]> wrote:
> On Sun, Nov 21, 2010 at 5:36 PM, Arnaud Lacombe <[email protected]> wrote:
>> [...]
>> The compat headers should be at the end of the include list, so that
>> the kernel headers get included first, and the compat one will only be
>> when the kernel does not provide the header. This is the only sane way
>> to override kernel provided stuff. That said, there is certainly a
>> use-case I missed.
>
> Agreed, but you are missing the purpose of the trick used here.
certainly :)
> The
> purpose of the include_next was so that we can name our own
> <linux/pm_qos_params.h> which is part of compat and these directories
> *will* get a priority over the kernel's so that way we can avoid
> ifdef'ing all includes for the same file on the upstream code.
I'm not sure to get what you mean by "we can avoid ifdef'ing all
includes for the same file on the upstream code", can you details ?
> Without
> an include_next we'd simply skip including the kernel's own original
> header file.
>
I admit that I removed that part merely because I went loose on the
trigger that day. AFAIR, there was no technical point per-se, so I
would not mind omitting this patch.
- Arnaud
On Mon, Nov 22, 2010 at 6:19 PM, Arnaud Lacombe <[email protected]> wrote:
> Hi,
>
> On Mon, Nov 22, 2010 at 1:09 PM, Luis R. Rodriguez
> <[email protected]> wrote:
>> On Sun, Nov 21, 2010 at 5:36 PM, Arnaud Lacombe <[email protected]> wrote:
>>> [...]
>>> The compat headers should be at the end of the include list, so that
>>> the kernel headers get included first, and the compat one will only be
>>> when the kernel does not provide the header. This is the only sane way
>>> to override kernel provided stuff. That said, there is certainly a
>>> use-case I missed.
>>
>> Agreed, but you are missing the purpose of the trick used here.
> certainly :)
>
>> The
>> purpose of the include_next was so that we can name our own
>> <linux/pm_qos_params.h> which is part of compat and these directories
>> *will* get a priority over the kernel's so that way we can avoid
>> ifdef'ing all includes for the same file on the upstream code.
> I'm not sure to get what you mean by "we can avoid ifdef'ing all
> includes for the same file on the upstream code", can you details ?
Ah, that's right, you don't see or use compat-wireless likely. Ok, so
what we do for backporting the 802.11 subsystem, Bluetooth and some
Ethernet drivers is we take the stock upstream files, stuff them into
a new directory, and then apply a series of patches to them to get the
files to properly compile. The patches address all things that was not
possible to backport through compat.git. Header file changes is one of
the typical things we run into. If a new header file is added to newer
kernels we can play a hack for older kernels and leave the code intact
and introduce our own include/linux/foo.h through compat by prefering
the local path over the kernel's path. If we're on newer kernels
though include_next will go on the search path and find the kernel's
own header file.
>> Without
>> an include_next we'd simply skip including the kernel's own original
>> header file.
>>
> I admit that I removed that part merely because I went loose on the
> trigger that day. AFAIR, there was no technical point per-se, so I
> would not mind omitting this patch.
OK cool, lets skip that then.
Luis
Hi,
On Wed, Nov 10, 2010 at 4:53 PM, Luis R. Rodriguez
<[email protected]> wrote:
> On Tue, Nov 09, 2010 at 06:19:46PM -0800, Arnaud Lacombe wrote:
>> Signed-off-by: Arnaud Lacombe <[email protected]>
>> ---
>> ?include/linux/compat-2.6.18.h | ? 21 +++++++++++++++++++++
>> ?1 files changed, 21 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/linux/compat-2.6.18.h b/include/linux/compat-2.6.18.h
>> index a45cfc7..4a7034a 100644
>> --- a/include/linux/compat-2.6.18.h
>> +++ b/include/linux/compat-2.6.18.h
>> @@ -6,8 +6,29 @@
>> ?/* Compat work for 2.6.18 */
>> ?#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
>>
>> +#include <linux/gfp.h>
>> +#include <linux/netdevice.h>
>> +#include <linux/skbuff.h>
>> +
>> ?#define roundup(x, y) ? ? ? ?((((x) + ((y) - 1)) / (y)) * (y))
>>
>> +#ifndef NET_SKB_PAD
>> +#define NET_SKB_PAD ?16
>
> Why are you adding the ifndef for NET_SKB_PAD if you know you already added it
> for 2.6.17 on your patch 2/44 ?
>
I should have lost a track when I made that change, it correctly
appeared in 2.6.17. My mistake :)
- Arnaud
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.22.h | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.22.h b/include/linux/compat-2.6.22.h
index e0cdab2..73dbbb6 100644
--- a/include/linux/compat-2.6.22.h
+++ b/include/linux/compat-2.6.22.h
@@ -80,6 +80,26 @@ static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
memcpy(to, skb->data + offset, len);
}
+static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
+{
+ return (struct iphdr *)skb_network_header(skb);
+}
+
+static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)
+{
+ return (struct tcphdr *)skb_transport_header(skb);
+}
+
+static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
+{
+ return tcp_hdr(skb)->doff * 4;
+}
+
+static inline unsigned int tcp_optlen(const struct sk_buff *skb)
+{
+ return (tcp_hdr(skb)->doff - 5) * 4;
+}
+
#if defined(__GNUC__)
#define __maybe_unused __attribute__((unused))
#define uninitialized_var(x) x = x
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.31.h | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/include/linux/compat-2.6.31.h b/include/linux/compat-2.6.31.h
index d2e0f01..b9a70bd 100644
--- a/include/linux/compat-2.6.31.h
+++ b/include/linux/compat-2.6.31.h
@@ -58,16 +58,6 @@
#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104
#endif
-struct compat_threaded_irq {
- unsigned int irq;
- irq_handler_t handler;
- irq_handler_t thread_fn;
- void *dev_id;
- char wq_name[64];
- struct workqueue_struct *wq;
- struct work_struct work;
-};
-
/*
* kmemleak was introduced on 2.6.31, since older kernels do not have
* we simply ignore its tuning.
@@ -115,6 +105,15 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
}
/* Backport threaded IRQ support */
+struct compat_threaded_irq {
+ unsigned int irq;
+ irq_handler_t handler;
+ irq_handler_t thread_fn;
+ void *dev_id;
+ char wq_name[64];
+ struct workqueue_struct *wq;
+ struct work_struct work;
+};
static inline
void compat_irq_work(struct work_struct *work)
--
1.7.2.30.gc37d7.dirty
This fix 'ppc6xx_defconfig' build.
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.33.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.33.h b/include/linux/compat-2.6.33.h
index fe1783c..8c8789d 100644
--- a/include/linux/compat-2.6.33.h
+++ b/include/linux/compat-2.6.33.h
@@ -7,8 +7,10 @@
#include <linux/skbuff.h>
#if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE)
+struct pcmcia_socket;
#include <pcmcia/cs_types.h>
#include <pcmcia/cistpl.h>
+#include <pcmcia/cs.h>
#include <pcmcia/ds.h>
#endif
#include <linux/kfifo.h>
--
1.7.2.30.gc37d7.dirty
All 2.6 kernel have had them.
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.22.h | 9 ---------
1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/include/linux/compat-2.6.22.h b/include/linux/compat-2.6.22.h
index 174a269..e0cdab2 100644
--- a/include/linux/compat-2.6.22.h
+++ b/include/linux/compat-2.6.22.h
@@ -96,15 +96,6 @@ static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
/* This will lead to very weird behaviour... */
#define NLA_BINARY NLA_STRING
-static inline int pci_set_mwi(struct pci_dev *dev)
-{
- return -ENOSYS;
-}
-
-static inline void pci_clear_mwi(struct pci_dev *dev)
-{
-}
-
#define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member)
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/pm_qos_params.h | 7 +++----
include/linux/tracepoint.h | 14 +++++++-------
include/net/net_namespace.h | 14 +++++++-------
include/trace/define_trace.h | 5 -----
4 files changed, 17 insertions(+), 23 deletions(-)
diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
index e1f083c..8c69ab2 100644
--- a/include/linux/pm_qos_params.h
+++ b/include/linux/pm_qos_params.h
@@ -1,8 +1,7 @@
#include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
-#include_next <linux/pm_qos_params.h>
-#else
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
+
/* interface for the pm_qos_power infrastructure of the linux kernel.
*
* Mark Gross <[email protected]>
@@ -28,5 +27,5 @@ int pm_qos_requirement(int qos);
int pm_qos_add_notifier(int qos, struct notifier_block *notifier);
int pm_qos_remove_notifier(int qos, struct notifier_block *notifier);
-#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)) */
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) */
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 9f5add1..4619247 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -1,10 +1,10 @@
-#ifndef _COMPAT_LINUX_TRACEPOINT_H
-#define _COMPAT_LINUX_TRACEPOINT_H 1
-
#include <linux/version.h>
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
-#include_next <linux/tracepoint.h>
-#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28))
+
+#ifndef _LINUX_TRACEPOINT_H
+#define _LINUX_TRACEPOINT_H
+
+#endif /* _LINUX_TRACEPOINT_H */
-#endif /* _COMPAT_LINUX_TRACEPOINT_H */
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 0f74944..23a517a 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -1,10 +1,10 @@
-#ifndef _COMPAT_NET_NET_NAMESPACE_H
-#define _COMPAT_NET_NET_NAMESPACE_H 1
-
#include <linux/version.h>
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23))
-#include_next <net/net_namespace.h>
-#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23)) */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
+
+#ifndef __NET_NET_NAMESPACE_H
+#define __NET_NET_NAMESPACE_H
+
+#endif /* __NET_NET_NAMESPACE_H */
-#endif /* _COMPAT_NET_NET_NAMESPACE_H */
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)) */
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index 7d03ccf..e69de29 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -1,5 +0,0 @@
-#include <linux/version.h>
-
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))
-#include_next <trace/define_trace.h>
-#endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)) */
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.31.h | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.31.h b/include/linux/compat-2.6.31.h
index 52291f4..76b2cf8 100644
--- a/include/linux/compat-2.6.31.h
+++ b/include/linux/compat-2.6.31.h
@@ -101,6 +101,10 @@ static inline struct rtable *skb_rtable(const struct sk_buff *skb)
}
/* Backport threaded IRQ support */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+typedef irqreturn_t (*irq_handler_t)(int, void *, struct pt_regs *);
+#endif
+
struct compat_threaded_irq {
unsigned int irq;
irq_handler_t handler;
@@ -117,7 +121,11 @@ void compat_irq_work(void *arg)
{
struct work_struct *work = arg;
struct compat_threaded_irq *comp = container_of(work, struct compat_threaded_irq, work);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ comp->thread_fn(comp->irq, comp->dev_id, NULL);
+#else
comp->thread_fn(comp->irq, comp->dev_id);
+#endif
}
#else
static inline
@@ -128,13 +136,22 @@ void compat_irq_work(struct work_struct *work)
}
#endif
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+static inline
+irqreturn_t compat_irq_dispatcher(int irq, void *dev_id, struct pt_regs *regs)
+#else
static inline
irqreturn_t compat_irq_dispatcher(int irq, void *dev_id)
+#endif
{
struct compat_threaded_irq *comp = dev_id;
irqreturn_t res;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19))
+ res = comp->handler(irq, comp->dev_id, regs);
+#else
res = comp->handler(irq, comp->dev_id);
+#endif
if (res == IRQ_WAKE_THREAD) {
queue_work(comp->wq, &comp->work);
res = IRQ_HANDLED;
--
1.7.2.30.gc37d7.dirty
On Tue, Nov 09, 2010 at 06:19:46PM -0800, Arnaud Lacombe wrote:
> Signed-off-by: Arnaud Lacombe <[email protected]>
> ---
> include/linux/compat-2.6.18.h | 21 +++++++++++++++++++++
> 1 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/compat-2.6.18.h b/include/linux/compat-2.6.18.h
> index a45cfc7..4a7034a 100644
> --- a/include/linux/compat-2.6.18.h
> +++ b/include/linux/compat-2.6.18.h
> @@ -6,8 +6,29 @@
> /* Compat work for 2.6.18 */
> #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18))
>
> +#include <linux/gfp.h>
> +#include <linux/netdevice.h>
> +#include <linux/skbuff.h>
> +
> #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
>
> +#ifndef NET_SKB_PAD
> +#define NET_SKB_PAD 16
Why are you adding the ifndef for NET_SKB_PAD if you know you already added it
for 2.6.17 on your patch 2/44 ?
Luis
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.30.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.30.h b/include/linux/compat-2.6.30.h
index 28f3d54..e824c22 100644
--- a/include/linux/compat-2.6.30.h
+++ b/include/linux/compat-2.6.30.h
@@ -27,7 +27,9 @@ enum dpm_order {
static inline void dev_set_uevent_suppress(struct device *dev, int val)
{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21))
dev->uevent_suppress = val;
+#endif
}
/*
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.29.h | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/include/linux/compat-2.6.29.h b/include/linux/compat-2.6.29.h
index b83aca0..0c20c9e 100644
--- a/include/linux/compat-2.6.29.h
+++ b/include/linux/compat-2.6.29.h
@@ -242,12 +242,10 @@ extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
#endif /* CONFIG_USB */
#endif
-#define DIV_ROUND_CLOSEST(x, divisor)( \
-{ \
+#define DIV_ROUND_CLOSEST(x, divisor) ({ \
typeof(divisor) __divisor = divisor; \
(((x) + ((__divisor) / 2)) / (__divisor)); \
-} \
-)
+})
extern int eth_mac_addr(struct net_device *dev, void *p);
extern int eth_change_mtu(struct net_device *dev, int new_mtu);
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.25.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.25.h b/include/linux/compat-2.6.25.h
index 641fbde..6183a89 100644
--- a/include/linux/compat-2.6.25.h
+++ b/include/linux/compat-2.6.25.h
@@ -7,8 +7,10 @@
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25))
#include <linux/types.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17))
#include <linux/io.h>
#include <linux/leds.h>
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18))
#include <linux/hw_random.h>
#endif
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.23.h | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.23.h b/include/linux/compat-2.6.23.h
index fbfb470..5dd6301 100644
--- a/include/linux/compat-2.6.23.h
+++ b/include/linux/compat-2.6.23.h
@@ -7,11 +7,25 @@
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23))
#include <linux/netdevice.h>
+#include <linux/notifier.h>
#include <linux/sched.h>
#include <linux/workqueue.h>
#include <linux/genetlink.h>
#include <net/sch_generic.h>
+/* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */
+static inline int notifier_from_errno(int err)
+{
+ return NOTIFY_STOP_MASK | (NOTIFY_OK - err);
+}
+
+/* Restore (negative) errno value from notify return value. */
+static inline int notifier_to_errno(int ret)
+{
+ ret &= ~NOTIFY_STOP_MASK;
+ return ret > NOTIFY_OK ? NOTIFY_OK - ret : 0;
+}
+
/*
* Tell gcc if a function is cold. The compiler will assume any path
* directly leading to the call is unlikely.
--
1.7.2.30.gc37d7.dirty
This was part of the network namespace move.
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.24.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.24.h b/include/linux/compat-2.6.24.h
index f9c777c..6d5dce5 100644
--- a/include/linux/compat-2.6.24.h
+++ b/include/linux/compat-2.6.24.h
@@ -13,6 +13,7 @@
#include <linux/types.h>
#include <linux/list.h>
#include <linux/scatterlist.h>
+#include <net/sock.h>
#define KEY_BLUETOOTH 237
#define KEY_WLAN 238
@@ -161,6 +162,8 @@ struct ssb_device_id {
/* Namespace stuff, introduced on 2.6.24 */
#define dev_get_by_index(a, b) dev_get_by_index(b)
#define __dev_get_by_index(a, b) __dev_get_by_index(b)
+#define sk_alloc(net, fam, pri, prot) sk_alloc(fam, pri, prot, 1)
+
/*
* Display a 6 byte device address (MAC) in a readable format.
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.20.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/linux/compat-2.6.20.h b/include/linux/compat-2.6.20.h
index bbfdacb..c77e87e 100644
--- a/include/linux/compat-2.6.20.h
+++ b/include/linux/compat-2.6.20.h
@@ -6,6 +6,9 @@
/* Compat work for 2.6.20 */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
+/* `struct work_struct' and `struct delayed_work' are field compatible */
+#define delayed_work work_struct
+
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) */
#endif /* LINUX_26_20_COMPAT_H */
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.29.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/compat-2.6.29.h b/include/linux/compat-2.6.29.h
index 0c20c9e..845a0d8 100644
--- a/include/linux/compat-2.6.29.h
+++ b/include/linux/compat-2.6.29.h
@@ -11,8 +11,8 @@
#endif
/*
- * I kow this looks odd.. but 2.6.32 added the netdev_tx_t
- * and we backport that there so inlcude that header first
+ * I know this looks odd.. but 2.6.32 added the netdev_tx_t
+ * and we backport that there so include that header first
* as we need it for the netdev ops.
*/
#include <linux/compat-2.6.32.h>
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.25.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/include/linux/compat-2.6.25.h b/include/linux/compat-2.6.25.h
index ad3220a..641fbde 100644
--- a/include/linux/compat-2.6.25.h
+++ b/include/linux/compat-2.6.25.h
@@ -8,8 +8,10 @@
#include <linux/types.h>
#include <linux/io.h>
-#include <linux/hw_random.h>
#include <linux/leds.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18))
+#include <linux/hw_random.h>
+#endif
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/pm.h>
--
1.7.2.30.gc37d7.dirty
Signed-off-by: Arnaud Lacombe <[email protected]>
---
include/linux/compat-2.6.31.h | 4 ----
include/linux/compat-2.6.32.h | 2 --
2 files changed, 0 insertions(+), 6 deletions(-)
diff --git a/include/linux/compat-2.6.31.h b/include/linux/compat-2.6.31.h
index b1b7b28..52291f4 100644
--- a/include/linux/compat-2.6.31.h
+++ b/include/linux/compat-2.6.31.h
@@ -50,13 +50,9 @@
#endif
#endif
-#ifndef NETDEV_PRE_UP
#define NETDEV_PRE_UP 0x000D
-#endif
-#ifndef SDIO_DEVICE_ID_MARVELL_8688WLAN
#define SDIO_DEVICE_ID_MARVELL_8688WLAN 0x9104
-#endif
/*
* kmemleak was introduced on 2.6.31, since older kernels do not have
diff --git a/include/linux/compat-2.6.32.h b/include/linux/compat-2.6.32.h
index 3b9915e..8f139b3 100644
--- a/include/linux/compat-2.6.32.h
+++ b/include/linux/compat-2.6.32.h
@@ -59,7 +59,6 @@ static inline void flush_delayed_work(struct delayed_work *dwork)
#define SET_NETDEV_DEVTYPE(netdev, type)
-#ifdef __KERNEL__
/* Driver transmit return codes */
enum netdev_tx {
BACKPORT_NETDEV_TX_OK = NETDEV_TX_OK, /* driver took care of packet */
@@ -67,7 +66,6 @@ enum netdev_tx {
BACKPORT_NETDEV_TX_LOCKED = NETDEV_TX_LOCKED, /* driver tx lock was already taken */
};
typedef enum netdev_tx netdev_tx_t;
-#endif /* __KERNEL__ */
/*
* dev_pm_ops is only available on kernels >= 2.6.29, for
--
1.7.2.30.gc37d7.dirty
On Tue, Nov 09, 2010 at 06:20:09PM -0800, Arnaud Lacombe wrote:
> Signed-off-by: Arnaud Lacombe <[email protected]>
> ---
> include/linux/compat-2.6.23.h | 4 ----
> 1 files changed, 0 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/compat-2.6.23.h b/include/linux/compat-2.6.23.h
> index 5dd6301..1a486ab 100644
> --- a/include/linux/compat-2.6.23.h
> +++ b/include/linux/compat-2.6.23.h
> @@ -84,10 +84,6 @@ static inline void tcf_destroy_chain_compat(struct tcf_proto **fl)
> #define da_users dmi_users
> #define da_gusers dmi_gusers
>
> -/* dev_set_promiscuity() was moved to __dev_set_promiscuity() on 2.6.23 and
> - * dev_set_promiscuity() became a wrapper. */
> -#define __dev_set_promiscuity dev_set_promiscuity
> -
Good call, how did you find these non-in-kernel thingies?
Luis