]> git.openfabrics.org - compat-rdma/compat.git/commitdiff
Added support for RHEL6.5
authorVladimir Sokolovsky <vlad@mellanox.com>
Mon, 11 Nov 2013 11:06:18 +0000 (13:06 +0200)
committerVladimir Sokolovsky <vlad@mellanox.com>
Mon, 11 Nov 2013 11:36:45 +0000 (13:36 +0200)
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
54 files changed:
compat/Makefile
compat/compat-2.6.14.c [deleted file]
compat/compat-2.6.23.c
compat/compat-2.6.28.c
compat/compat-2.6.33.c
compat/compat-2.6.34.c
compat/compat-2.6.34.h
compat/compat-2.6.35.c
compat/compat-2.6.36.c
compat/compat-2.6.37.c
compat/compat-3.0.c
compat/compat-3.2.c
compat/compat-3.4.c
compat/compat-3.5.c
compat/compat-3.6.c [new file with mode: 0644]
compat/compat-3.7.c [new file with mode: 0644]
compat/compat_firmware_class.c
compat/kfifo.c
compat/kstrtox.c
compat/main.c
compat/pm_qos_params.c
compat/scripts/compat_firmware_install [new file with mode: 0755]
compat/scripts/gen-compat-autoconf.sh [new file with mode: 0755]
compat/scripts/gen-compat-config.sh [new file with mode: 0755]
compat/scripts/skip-colors [new file with mode: 0755]
include/linux/compat-2.6.23.h
include/linux/compat-2.6.24.h
include/linux/compat-2.6.25.h
include/linux/compat-2.6.26.h
include/linux/compat-2.6.27.h
include/linux/compat-2.6.28.h
include/linux/compat-2.6.29.h
include/linux/compat-2.6.31.h
include/linux/compat-2.6.32.h
include/linux/compat-2.6.33.h
include/linux/compat-2.6.34.h
include/linux/compat-2.6.35.h
include/linux/compat-2.6.36.h
include/linux/compat-2.6.37.h
include/linux/compat-2.6.38.h
include/linux/compat-2.6.39.h
include/linux/compat-2.6.h
include/linux/compat-3.0.h
include/linux/compat-3.1.h
include/linux/compat-3.10.h
include/linux/compat-3.12.h
include/linux/compat-3.2.h
include/linux/compat-3.3.h
include/linux/compat-3.4.h
include/linux/compat-3.5.h
include/linux/compat-3.6.h
include/linux/compat-3.7.h
include/linux/llist.h
include/linux/uidgid.h [new file with mode: 0644]

index 9493112f9a667629128056a108558a20fbe2e9fb..bf7955ff978b87a8418f63f169908e9d259ce914 100644 (file)
@@ -8,7 +8,6 @@ obj-$(CONFIG_COMPAT_NET_SCH_FQ_CODEL) += sch_fq_codel.o
 compat-y += main.o
 
 # Compat kernel compatibility code
-compat-$(CONFIG_COMPAT_KERNEL_2_6_14) += compat-2.6.14.o
 compat-$(CONFIG_COMPAT_KERNEL_2_6_18) += compat-2.6.18.o
 compat-$(CONFIG_COMPAT_KERNEL_2_6_19) += compat-2.6.19.o
 compat-$(CONFIG_COMPAT_KERNEL_2_6_21) += compat-2.6.21.o
@@ -39,10 +38,11 @@ compat-$(CONFIG_COMPAT_KERNEL_2_6_39) += \
 compat-$(CONFIG_COMPAT_KERNEL_3_0) += compat-3.0.o
 compat-$(CONFIG_COMPAT_KERNEL_3_2) += compat-3.2.o
 compat-$(CONFIG_COMPAT_KERNEL_3_3) += \
-       compat-3.3.o \
-       flow_dissector.o
+       compat-3.3.o
 compat-$(CONFIG_COMPAT_KERNEL_3_4) += compat-3.4.o
 compat-$(CONFIG_COMPAT_KERNEL_3_5) += compat-3.5.o
+compat-$(CONFIG_COMPAT_KERNEL_3_6) += compat-3.6.o
+compat-$(CONFIG_COMPAT_KERNEL_3_7) += compat-3.7.o
 
 compat-$(CONFIG_COMPAT_CORDIC) += cordic.o
 compat-$(CONFIG_COMPAT_CRC8) += crc8.o
diff --git a/compat/compat-2.6.14.c b/compat/compat-2.6.14.c
deleted file mode 100644 (file)
index 3de847d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright 2007      Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Compatibility file for Linux wireless for kernels 2.6.14.
- */
-
-#include <net/compat.h>
-
-/* 2.6.14 compat code goes here */
-
index bc49e9826632ea45b572c3535f878f915b005df2..1a76957db0fd20a548b3e0ca7228d1fdb0144887 100644 (file)
@@ -11,6 +11,7 @@
 #include <net/compat.h>
 
 /* On net/core/dev.c as of 2.6.24 */
+#define __dev_addr_delete LINUX_BACKPORT(__dev_addr_delete)
 int __dev_addr_delete(struct dev_addr_list **list, int *count,
                       void *addr, int alen, int glbl)
 {
@@ -40,6 +41,7 @@ EXPORT_SYMBOL_GPL(__dev_addr_delete);
 
 /* On net/core/dev.c as of 2.6.24. This is not yet used by mac80211 but
  * might as well add it */
+#define __dev_addr_add LINUX_BACKPORT(__dev_addr_add)
 int __dev_addr_add(struct dev_addr_list **list, int *count,
                    void *addr, int alen, int glbl)
 {
index 0ae8f465dbb6636b64b939045ece8dd747f8fa56..8e81ed48486a224cf34344c6533ed1902b29a11c 100644 (file)
  */
 
 #include <linux/compat.h>
-#include <linux/usb.h>
 #include <linux/tty.h>
 #include <asm/poll.h>
 
 /* 2.6.28 compat code goes here */
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
-#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
-/*
- * Compat-wireless notes for USB backport stuff:
- *
- * urb->reject exists on 2.6.27, the poison/unpoison helpers
- * did not though. The anchor poison does not exist so we cannot use them.
- *
- * USB anchor poising seems to exist to prevent future driver sumbissions
- * of usb_anchor_urb() to an anchor marked as poisoned. For older kernels
- * we cannot use that, so new usb_anchor_urb()s will be anchored. The down
- * side to this should be submission of URBs will continue being anchored
- * on an anchor instead of having them being rejected immediately when the
- * driver realized we needed to stop. For ar9170 we poison URBs upon the
- * ar9170 mac80211 stop callback(), don't think this should be so bad.
- * It mean there is period of time in older kernels for which we continue
- * to anchor new URBs to a known stopped anchor. We have two anchors
- * (TX, and RX)
- */
-
-#if 0
-/**
- * usb_poison_urb - reliably kill a transfer and prevent further use of an URB
- * @urb: pointer to URB describing a previously submitted request,
- *     may be NULL
- *
- * This routine cancels an in-progress request.  It is guaranteed that
- * upon return all completion handlers will have finished and the URB
- * will be totally idle and cannot be reused.  These features make
- * this an ideal way to stop I/O in a disconnect() callback.
- * If the request has not already finished or been unlinked
- * the completion handler will see urb->status == -ENOENT.
- *
- * After and while the routine runs, attempts to resubmit the URB will fail
- * with error -EPERM.  Thus even if the URB's completion handler always
- * tries to resubmit, it will not succeed and the URB will become idle.
- *
- * This routine may not be used in an interrupt context (such as a bottom
- * half or a completion handler), or when holding a spinlock, or in other
- * situations where the caller can't schedule().
- *
- * This routine should not be called by a driver after its disconnect
- * method has returned.
- */
-void usb_poison_urb(struct urb *urb)
-{
-       might_sleep();
-       if (!(urb && urb->dev && urb->ep))
-               return;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
-       spin_lock_irq(&usb_reject_lock);
-#endif
-       ++urb->reject;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
-       spin_unlock_irq(&usb_reject_lock);
-#endif
-       /*
-        * XXX: usb_hcd_unlink_urb() needs backporting... this is defined
-        * on usb hcd.c but urb.c gets access to it. That is, older kernels
-        * have usb_hcd_unlink_urb() but its not exported, nor can we
-        * re-implement it exactly. This essentially dequeues the urb from
-        * hw, we need to figure out a way to backport this.
-        */
-       //usb_hcd_unlink_urb(urb, -ENOENT);
-
-       wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0);
-}
-EXPORT_SYMBOL_GPL(usb_poison_urb);
-#endif
-#endif /* CONFIG_USB */
-
-#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
-
-#include <pcmcia/ds.h>
-struct pcmcia_cfg_mem {
-       tuple_t tuple;
-       cisparse_t parse;
-       u8 buf[256];
-       cistpl_cftable_entry_t dflt;
-};
-/**
- * pcmcia_loop_config() - loop over configuration options
- * @p_dev:     the struct pcmcia_device which we need to loop for.
- * @conf_check:        function to call for each configuration option.
- *             It gets passed the struct pcmcia_device, the CIS data
- *             describing the configuration option, and private data
- *             being passed to pcmcia_loop_config()
- * @priv_data: private data to be passed to the conf_check function.
- *
- * pcmcia_loop_config() loops over all configuration options, and calls
- * the driver-specific conf_check() for each one, checking whether
- * it is a valid one. Returns 0 on success or errorcode otherwise.
- */
-int pcmcia_loop_config(struct pcmcia_device *p_dev,
-                      int      (*conf_check)   (struct pcmcia_device *p_dev,
-                                                cistpl_cftable_entry_t *cfg,
-                                                cistpl_cftable_entry_t *dflt,
-                                                unsigned int vcc,
-                                                void *priv_data),
-                      void *priv_data)
-{
-       struct pcmcia_cfg_mem *cfg_mem;
-
-       tuple_t *tuple;
-       int ret;
-       unsigned int vcc;
-
-       cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL);
-       if (cfg_mem == NULL)
-               return -ENOMEM;
-
-       /* get the current Vcc setting */
-       vcc = p_dev->socket->socket.Vcc;
-
-       tuple = &cfg_mem->tuple;
-       tuple->TupleData = cfg_mem->buf;
-       tuple->TupleDataMax = 255;
-       tuple->TupleOffset = 0;
-       tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY;
-       tuple->Attributes = 0;
-
-       ret = pcmcia_get_first_tuple(p_dev, tuple);
-       while (!ret) {
-               cistpl_cftable_entry_t *cfg = &cfg_mem->parse.cftable_entry;
-
-               if (pcmcia_get_tuple_data(p_dev, tuple))
-                       goto next_entry;
-
-               if (pcmcia_parse_tuple(tuple, &cfg_mem->parse))
-                       goto next_entry;
-
-               /* default values */
-               p_dev->conf.ConfigIndex = cfg->index;
-               if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
-                       cfg_mem->dflt = *cfg;
-
-               ret = conf_check(p_dev, cfg, &cfg_mem->dflt, vcc, priv_data);
-               if (!ret)
-                       break;
-
-next_entry:
-               ret = pcmcia_get_next_tuple(p_dev, tuple);
-       }
-
-       return ret;
-}
-EXPORT_SYMBOL_GPL(pcmcia_loop_config);
-
-#endif /* CONFIG_PCMCIA */
-
-#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
-
-void usb_unpoison_urb(struct urb *urb)
-{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
-       unsigned long flags;
-#endif
-
-       if (!urb)
-               return;
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
-       spin_lock_irqsave(&usb_reject_lock, flags);
-#endif
-       --urb->reject;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
-       spin_unlock_irqrestore(&usb_reject_lock, flags);
-#endif
-}
-EXPORT_SYMBOL_GPL(usb_unpoison_urb);
-
-
-#if 0
-/**
- * usb_poison_anchored_urbs - cease all traffic from an anchor
- * @anchor: anchor the requests are bound to
- *
- * this allows all outstanding URBs to be poisoned starting
- * from the back of the queue. Newly added URBs will also be
- * poisoned
- *
- * This routine should not be called by a driver after its disconnect
- * method has returned.
- */
-void usb_poison_anchored_urbs(struct usb_anchor *anchor)
-{
-       struct urb *victim;
-
-       spin_lock_irq(&anchor->lock);
-       // anchor->poisoned = 1; /* XXX: Cannot backport */
-       while (!list_empty(&anchor->urb_list)) {
-               victim = list_entry(anchor->urb_list.prev, struct urb,
-                                   anchor_list);
-               /* we must make sure the URB isn't freed before we kill it*/
-               usb_get_urb(victim);
-               spin_unlock_irq(&anchor->lock);
-               /* this will unanchor the URB */
-               usb_poison_urb(victim);
-               usb_put_urb(victim);
-               spin_lock_irq(&anchor->lock);
-       }
-       spin_unlock_irq(&anchor->lock);
-}
-EXPORT_SYMBOL_GPL(usb_poison_anchored_urbs);
-#endif
-
-/**
- * usb_anchor_empty - is an anchor empty
- * @anchor: the anchor you want to query
- *
- * returns 1 if the anchor has no urbs associated with it
- */
-int usb_anchor_empty(struct usb_anchor *anchor)
-{
-       return list_empty(&anchor->urb_list);
-}
-
-EXPORT_SYMBOL_GPL(usb_anchor_empty);
-#endif /* CONFIG_USB */
-#endif
-
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar)
 {
        /*
index a9172cbcb15b8407e66e0a9588761ebdf1d8a29c..f7eea69b7e8d8dbf3de8fa1118c482797b4a2540 100644 (file)
 
 #include <linux/compat.h>
 #include <linux/autoconf.h>
+#include <linux/string.h>
+#include <linux/ctype.h>
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
+#ifndef BITMAP_FIRST_WORD_MASK
+#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG))
+#endif /* BITMAP_FIRST_WORD_MASK */
 
-#if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE)
+#ifndef CONFIG_COMPAT_IS_BITMAP
 
-/**
- * pccard_loop_tuple() - loop over tuples in the CIS
- * @s:         the struct pcmcia_socket where the card is inserted
- * @function:  the device function we loop for
- * @code:      which CIS code shall we look for?
- * @parse:     buffer where the tuple shall be parsed (or NULL, if no parse)
- * @priv_data: private data to be passed to the loop_tuple function.
- * @loop_tuple:        function to call for each CIS entry of type @function. IT
- *             gets passed the raw tuple, the paresed tuple (if @parse is
- *             set) and @priv_data.
- *
- * pccard_loop_tuple() loops over all CIS entries of type @function, and
- * calls the @loop_tuple function for each entry. If the call to @loop_tuple
- * returns 0, the loop exits. Returns 0 on success or errorcode otherwise.
- */
-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))
+void bitmap_set(unsigned long *map, int start, int nr)
 {
-       tuple_t tuple;
-       cisdata_t *buf;
-       int ret;
-
-       buf = kzalloc(256, GFP_KERNEL);
-       if (buf == NULL) {
-               dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n");
-               return -ENOMEM;
+       unsigned long *p = map + BIT_WORD(start);
+       const int size = start + nr;
+       int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG);
+       unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start);
+
+       while (nr - bits_to_set >= 0) {
+               *p |= mask_to_set;
+               nr -= bits_to_set;
+               bits_to_set = BITS_PER_LONG;
+               mask_to_set = ~0UL;
+               p++;
        }
-
-       tuple.TupleData = buf;
-       tuple.TupleDataMax = 255;
-       tuple.TupleOffset = 0;
-       tuple.DesiredTuple = code;
-       tuple.Attributes = 0;
-
-       ret = pccard_get_first_tuple(s, function, &tuple);
-       while (!ret) {
-               if (pccard_get_tuple_data(s, &tuple))
-                       goto next_entry;
-
-               if (parse)
-                       if (pcmcia_parse_tuple(&tuple, parse))
-                               goto next_entry;
-
-               ret = loop_tuple(&tuple, parse, priv_data);
-               if (!ret)
-                       break;
-
-next_entry:
-               ret = pccard_get_next_tuple(s, function, &tuple);
+       if (nr) {
+               mask_to_set &= BITMAP_LAST_WORD_MASK(size);
+               *p |= mask_to_set;
        }
-
-       kfree(buf);
-       return ret;
 }
-EXPORT_SYMBOL_GPL(pccard_loop_tuple);
-/* Source: drivers/pcmcia/cistpl.c */
+EXPORT_SYMBOL(bitmap_set);
 
-#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
+void bitmap_clear(unsigned long *map, int start, int nr)
+{
+       unsigned long *p = map + BIT_WORD(start);
+       const int size = start + nr;
+       int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG);
+       unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start);
+
+       while (nr - bits_to_clear >= 0) {
+               *p &= ~mask_to_clear;
+               nr -= bits_to_clear;
+               bits_to_clear = BITS_PER_LONG;
+               mask_to_clear = ~0UL;
+               p++;
+       }
+       if (nr) {
+               mask_to_clear &= BITMAP_LAST_WORD_MASK(size);
+               *p &= ~mask_to_clear;
+       }
+}
+EXPORT_SYMBOL(bitmap_clear);
 
-struct pcmcia_loop_mem {
-       struct pcmcia_device *p_dev;
-       void *priv_data;
-       int (*loop_tuple) (struct pcmcia_device *p_dev,
-                          tuple_t *tuple,
-                          void *priv_data);
-};
+/*
+ * bitmap_find_next_zero_area - find a contiguous aligned zero area
+ * @map: The address to base the search on
+ * @size: The bitmap size in bits
+ * @start: The bitnumber to start searching at
+ * @nr: The number of zeroed bits we're looking for
+ * @align_mask: Alignment mask for zero area
+ *
+ * The @align_mask should be one less than a power of 2; the effect is that
+ * the bit offset of all zero areas this function finds is multiples of that
+ * power of 2. A @align_mask of 0 means no alignment is required.
+ */
+unsigned long bitmap_find_next_zero_area(unsigned long *map,
+                                        unsigned long size,
+                                        unsigned long start,
+                                        unsigned int nr,
+                                        unsigned long align_mask)
+{
+       unsigned long index, end, i;
+again:
+       index = find_next_zero_bit(map, size, start);
+
+       /* Align allocation */
+       index = __ALIGN_MASK(index, align_mask);
+
+       end = index + nr;
+       if (end > size)
+               return end;
+       i = find_next_bit(map, end, index);
+       if (i < end) {
+               start = i + 1;
+               goto again;
+       }
+       return index;
+}
+EXPORT_SYMBOL(bitmap_find_next_zero_area);
+#endif /* CONFIG_COMPAT_IS_BITMAP */
 
 /**
- * pcmcia_do_loop_tuple() - internal helper for pcmcia_loop_config()
+ * skip_spaces - Removes leading whitespace from @str.
+ * @str: The string to be stripped.
  *
- * pcmcia_do_loop_tuple() is the internal callback for the call from
- * pcmcia_loop_tuple() to pccard_loop_tuple(). Data is transferred
- * by a struct pcmcia_cfg_mem.
+ * Returns a pointer to the first non-whitespace character in @str.
  */
-static int pcmcia_do_loop_tuple(tuple_t *tuple, cisparse_t *parse, void *priv)
+char *skip_spaces(const char *str)
 {
-       struct pcmcia_loop_mem *loop = priv;
-
-       return loop->loop_tuple(loop->p_dev, tuple, loop->priv_data);
-};
+       while (isspace(*str))
+               ++str;
+       return (char *)str;
+}
+EXPORT_SYMBOL(skip_spaces);
 
 /**
- * pcmcia_loop_tuple() - loop over tuples in the CIS
- * @p_dev:     the struct pcmcia_device which we need to loop for.
- * @code:      which CIS code shall we look for?
- * @priv_data: private data to be passed to the loop_tuple function.
- * @loop_tuple:        function to call for each CIS entry of type @function. IT
- *             gets passed the raw tuple and @priv_data.
+ * strim - Removes leading and trailing whitespace from @s.
+ * @s: The string to be stripped.
  *
- * pcmcia_loop_tuple() loops over all CIS entries of type @function, and
- * calls the @loop_tuple function for each entry. If the call to @loop_tuple
- * returns 0, the loop exits. Returns 0 on success or errorcode otherwise.
+ * Note that the first trailing whitespace is replaced with a %NUL-terminator
+ * in the given string @s. Returns a pointer to the first non-whitespace
+ * character in @s.
  */
-int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code,
-                     int (*loop_tuple) (struct pcmcia_device *p_dev,
-                                        tuple_t *tuple,
-                                        void *priv_data),
-                     void *priv_data)
+char *strim(char *s)
 {
-       struct pcmcia_loop_mem loop = {
-               .p_dev = p_dev,
-               .loop_tuple = loop_tuple,
-               .priv_data = priv_data};
+       size_t size;
+       char *end;
 
-       return pccard_loop_tuple(p_dev->socket, p_dev->func, code, NULL,
-                                &loop, pcmcia_do_loop_tuple);
-}
-EXPORT_SYMBOL_GPL(pcmcia_loop_tuple);
-/* Source: drivers/pcmcia/pcmcia_resource.c */
-
-#endif /* CONFIG_PCMCIA */
+       size = strlen(s);
+       if (!size)
+               return s;
 
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
+       end = s + size - 1;
+       while (end >= s && isspace(*end))
+               end--;
+       *(end + 1) = '\0';
 
-#endif /* CONFIG_PCCARD */
+       return skip_spaces(s);
+}
+EXPORT_SYMBOL(strim);
 
index b905a26cba0118fe05d6ea0f56ab217170548297..0dfe716fd281026a6132d2dccfa2b6ed4f4f30ea 100644 (file)
@@ -9,22 +9,77 @@
  */
 
 #include <linux/mmc/sdio_func.h>
+#include <linux/pci.h>
+#include <linux/export.h>
 
 #include "compat-2.6.34.h"
 
-static mmc_pm_flag_t compat_mmc_pm_flags;
+static mmc_pm_flag_t backport_mmc_pm_flags;
 
-void init_compat_mmc_pm_flags(void)
+void backport_init_mmc_pm_flags(void)
 {
-       compat_mmc_pm_flags = 0;
+       backport_mmc_pm_flags = 0;
 }
 
 mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func)
 {
-       return compat_mmc_pm_flags;
+       return backport_mmc_pm_flags;
 }
 
 int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags)
 {
        return -EINVAL;
 }
+
+int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt)
+{
+       int i;
+
+       for (i = off; i < len; ) {
+               u8 val = buf[i];
+
+               if (val & PCI_VPD_LRDT) {
+                       /* Don't return success of the tag isn't complete */
+                       if (i + PCI_VPD_LRDT_TAG_SIZE > len)
+                               break;
+
+                       if (val == rdt)
+                               return i;
+
+                       i += PCI_VPD_LRDT_TAG_SIZE +
+                            pci_vpd_lrdt_size(&buf[i]);
+               } else {
+                       u8 tag = val & ~PCI_VPD_SRDT_LEN_MASK;
+
+                       if (tag == rdt)
+                               return i;
+
+                       if (tag == PCI_VPD_SRDT_END)
+                               break;
+
+                       i += PCI_VPD_SRDT_TAG_SIZE +
+                            pci_vpd_srdt_size(&buf[i]);
+               }
+       }
+
+       return -ENOENT;
+}
+EXPORT_SYMBOL_GPL(pci_vpd_find_tag);
+
+int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
+                             unsigned int len, const char *kw)
+{
+       int i;
+
+       for (i = off; i + PCI_VPD_INFO_FLD_HDR_SIZE <= off + len;) {
+               if (buf[i + 0] == kw[0] &&
+                   buf[i + 1] == kw[1])
+                       return i;
+
+               i += PCI_VPD_INFO_FLD_HDR_SIZE +
+                    pci_vpd_info_field_size(&buf[i]);
+       }
+
+       return -ENOENT;
+}
+EXPORT_SYMBOL_GPL(pci_vpd_find_info_keyword);
index 173fe5227de0e03380612a36e9874e7960279439..b36b441a2a825f6a94e6354374332620d1ee7c77 100644 (file)
@@ -7,11 +7,11 @@
 
 #include <linux/mmc/sdio_func.h>
 
-void init_compat_mmc_pm_flags(void);
+void backport_init_mmc_pm_flags(void);
 
 #else /* Kernels >= 2.6.34 */
 
-static inline void init_compat_mmc_pm_flags(void)
+static inline void backport_init_mmc_pm_flags(void)
 {
 }
 
index 242a903b850f112c05f0f0ef299ffa751eab372c..437d9bf6d4390beb3af3ddac7e651974ed85eb63 100644 (file)
@@ -18,7 +18,7 @@
  * hex_to_bin() converts one hex digit to its actual value or -1 in case of bad
  * input.
  */
-int compat_hex_to_bin(char ch)
+int hex_to_bin(char ch)
 {
        if ((ch >= '0') && (ch <= '9'))
                return ch - '0';
@@ -27,9 +27,8 @@ int compat_hex_to_bin(char ch)
                return ch - 'a' + 10;
        return -1;
 }
-EXPORT_SYMBOL_GPL(compat_hex_to_bin);
+EXPORT_SYMBOL_GPL(hex_to_bin);
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
 /**
  * noop_llseek - No Operation Performed llseek implementation
  * @file:      file structure to seek on
@@ -46,5 +45,3 @@ loff_t noop_llseek(struct file *file, loff_t offset, int origin)
        return file->f_pos;
 }
 EXPORT_SYMBOL_GPL(noop_llseek);
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
-
index 9190ecd8b0a1aa43c4bb90e03e07a63dc7b54787..7d9bf8a69e0e3fd6eeb1079de8e64d31e831650f 100644 (file)
@@ -9,91 +9,6 @@
  */
 
 #include <linux/compat.h>
-#include <linux/usb.h>
-
-#ifdef CONFIG_COMPAT_USB_URB_THREAD_FIX
-/* Callers must hold anchor->lock */
-static void __usb_unanchor_urb(struct urb *urb, struct usb_anchor *anchor)
-{
-       urb->anchor = NULL;
-       list_del(&urb->anchor_list);
-       usb_put_urb(urb);
-       if (list_empty(&anchor->urb_list))
-               wake_up(&anchor->wait);
-}
-
-/**
- * usb_unlink_anchored_urbs - asynchronously cancel transfer requests en masse
- * @anchor: anchor the requests are bound to
- *
- * this allows all outstanding URBs to be unlinked starting
- * from the back of the queue. This function is asynchronous.
- * The unlinking is just tiggered. It may happen after this
- * function has returned.
- *
- * This routine should not be called by a driver after its disconnect
- * method has returned.
- */
-void compat_usb_unlink_anchored_urbs(struct usb_anchor *anchor)
-{
-       struct urb *victim;
-
-       while ((victim = usb_get_from_anchor(anchor)) != NULL) {
-               usb_unlink_urb(victim);
-               usb_put_urb(victim);
-       }
-}
-EXPORT_SYMBOL_GPL(compat_usb_unlink_anchored_urbs);
-
-/**
- * usb_get_from_anchor - get an anchor's oldest urb
- * @anchor: the anchor whose urb you want
- *
- * this will take the oldest urb from an anchor,
- * unanchor and return it
- */
-struct urb *compat_usb_get_from_anchor(struct usb_anchor *anchor)
-{
-       struct urb *victim;
-       unsigned long flags;
-
-       spin_lock_irqsave(&anchor->lock, flags);
-       if (!list_empty(&anchor->urb_list)) {
-               victim = list_entry(anchor->urb_list.next, struct urb,
-                                   anchor_list);
-               usb_get_urb(victim);
-               __usb_unanchor_urb(victim, anchor);
-       } else {
-               victim = NULL;
-       }
-       spin_unlock_irqrestore(&anchor->lock, flags);
-
-       return victim;
-}
-EXPORT_SYMBOL_GPL(compat_usb_get_from_anchor);
-
-/**
- * usb_scuttle_anchored_urbs - unanchor all an anchor's urbs
- * @anchor: the anchor whose urbs you want to unanchor
- *
- * use this to get rid of all an anchor's urbs
- */
-void compat_usb_scuttle_anchored_urbs(struct usb_anchor *anchor)
-{
-       struct urb *victim;
-       unsigned long flags;
-
-       spin_lock_irqsave(&anchor->lock, flags);
-       while (!list_empty(&anchor->urb_list)) {
-               victim = list_entry(anchor->urb_list.prev, struct urb,
-                                   anchor_list);
-               __usb_unanchor_urb(victim, anchor);
-       }
-       spin_unlock_irqrestore(&anchor->lock, flags);
-}
-EXPORT_SYMBOL_GPL(compat_usb_scuttle_anchored_urbs);
-
-#endif /* CONFIG_COMPAT_USB_URB_THREAD_FIX */
 
 struct workqueue_struct *system_wq __read_mostly;
 struct workqueue_struct *system_long_wq __read_mostly;
@@ -102,13 +17,13 @@ EXPORT_SYMBOL_GPL(system_wq);
 EXPORT_SYMBOL_GPL(system_long_wq);
 EXPORT_SYMBOL_GPL(system_nrt_wq);
 
-int compat_schedule_work(struct work_struct *work)
+int schedule_work(struct work_struct *work)
 {
        return queue_work(system_wq, work);
 }
-EXPORT_SYMBOL_GPL(compat_schedule_work);
+EXPORT_SYMBOL_GPL(schedule_work);
 
-int compat_schedule_work_on(int cpu, struct work_struct *work)
+int schedule_work_on(int cpu, struct work_struct *work)
 {
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
        return queue_work_on(cpu, system_wq, work);
@@ -116,24 +31,24 @@ int compat_schedule_work_on(int cpu, struct work_struct *work)
        return queue_work(system_wq, work);
 #endif
 }
-EXPORT_SYMBOL_GPL(compat_schedule_work_on);
+EXPORT_SYMBOL_GPL(schedule_work_on);
 
-int compat_schedule_delayed_work(struct delayed_work *dwork,
+int schedule_delayed_work(struct delayed_work *dwork,
                                  unsigned long delay)
 {
        return queue_delayed_work(system_wq, dwork, delay);
 }
-EXPORT_SYMBOL_GPL(compat_schedule_delayed_work);
+EXPORT_SYMBOL_GPL(schedule_delayed_work);
 
-int compat_schedule_delayed_work_on(int cpu,
+int schedule_delayed_work_on(int cpu,
                                     struct delayed_work *dwork,
                                     unsigned long delay)
 {
        return queue_delayed_work_on(cpu, system_wq, dwork, delay);
 }
-EXPORT_SYMBOL_GPL(compat_schedule_delayed_work_on);
+EXPORT_SYMBOL_GPL(schedule_delayed_work_on);
 
-void compat_flush_scheduled_work(void)
+void flush_scheduled_work(void)
 {
        /*
         * It is debatable which one we should prioritize first, lets
@@ -143,7 +58,7 @@ void compat_flush_scheduled_work(void)
        flush_workqueue(system_wq);
        flush_scheduled_work();
 }
-EXPORT_SYMBOL_GPL(compat_flush_scheduled_work);
+EXPORT_SYMBOL_GPL(flush_scheduled_work);
 
 /**
  * work_busy - test whether a work is currently pending or running
@@ -169,17 +84,32 @@ unsigned int work_busy(struct work_struct *work)
 }
 EXPORT_SYMBOL_GPL(work_busy);
 
-void compat_system_workqueue_create()
+int backport_system_workqueue_create()
 {
        system_wq = alloc_workqueue("events", 0, 0);
+       if (!system_wq)
+               return -ENOMEM;
+
        system_long_wq = alloc_workqueue("events_long", 0, 0);
+       if (!system_long_wq)
+               goto err1;
+
        system_nrt_wq = create_singlethread_workqueue("events_nrt");
-       BUG_ON(!system_wq || !system_long_wq || !system_nrt_wq);
+       if (!system_nrt_wq)
+               goto err2;
+
+       return 0;
+
+err2:
+       destroy_workqueue(system_long_wq);
+err1:
+       destroy_workqueue(system_wq);
+       return -ENOMEM;
 }
 
-void compat_system_workqueue_destroy()
+void backport_system_workqueue_destroy()
 {
+       destroy_workqueue(system_nrt_wq);
        destroy_workqueue(system_wq);
        destroy_workqueue(system_long_wq);
-       destroy_workqueue(system_nrt_wq);
 }
index 24b267a5be5caa5afd097498bbe409e358bf27c9..f41cc5390d22797ab2e98baf99814f7a09dfd0fd 100644 (file)
@@ -13,6 +13,7 @@
 #include <net/sock.h>
 #include <linux/nsproxy.h>
 #include <linux/vmalloc.h>
+#include <linux/sunrpc/xprt.h>
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
 static const void *net_current_ns(void)
@@ -345,7 +346,7 @@ EXPORT_SYMBOL_GPL(compat_led_classdev_unregister);
  *     For tight control over page level allocator and protection flags
  *     use __vmalloc() instead.
  */
-void *compat_vzalloc(unsigned long size)
+void *vzalloc(unsigned long size)
 {
        void *buf;
        buf = vmalloc(size);
@@ -353,6 +354,55 @@ void *compat_vzalloc(unsigned long size)
                memset(buf, 0, size);
        return buf;
 }
-EXPORT_SYMBOL_GPL(compat_vzalloc);
+EXPORT_SYMBOL_GPL(vzalloc);
 
+/**
+ * vzalloc_node - allocate memory on a specific node with zero fill
+ * @size:       allocation size
+ * @node:       numa node
+ *
+ * Allocate enough pages to cover @size from the page level
+ * allocator and map them into contiguous kernel virtual space.
+ * The memory allocated is set to zero.
+ *
+ * For tight control over page level allocator and protection flags
+ * use __vmalloc() instead.
+ */
+void *vzalloc_node(unsigned long size, int node)
+{
+        return vzalloc(size);
+}
+EXPORT_SYMBOL(vzalloc_node);
+
+#endif
+
+#ifndef CONFIG_COMPAT_XPRTRDMA_NEEDED
+struct rpc_xprt *xprt_alloc(int size, int max_req)
+{
+       struct rpc_xprt *xprt;
+
+       xprt = kzalloc(size, GFP_KERNEL);
+       if (xprt == NULL)
+               goto out;
+
+       xprt->max_reqs = max_req;
+       xprt->slot = kcalloc(max_req, sizeof(struct rpc_rqst), GFP_KERNEL);
+       if (xprt->slot == NULL)
+               goto out_free;
+
+       return xprt;
+
+out_free:
+       kfree(xprt);
+out:
+       return NULL;
+}
+EXPORT_SYMBOL_GPL(xprt_alloc);
+
+void xprt_free(struct rpc_xprt *xprt)
+{
+       kfree(xprt->slot);
+       kfree(xprt);
+}
+EXPORT_SYMBOL_GPL(xprt_free);
 #endif
index 1e7a69ba65675f48b4a65305c3e1ac169fa70042..e0a772316126c1fd8d13bb36482a941cdd9b03a4 100644 (file)
@@ -9,8 +9,6 @@
  * Compatibility file for Linux wireless for kernels 3.0.
  */
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
-
 #include <linux/compat.h>
 #include <linux/if_ether.h>
 
@@ -38,6 +36,7 @@ int mac_pton(const char *s, u8 *mac)
 }
 EXPORT_SYMBOL_GPL(mac_pton);
 
+#ifndef CONFIG_COMPAT_IS_KSTRTOX
 #define kstrto_from_user(f, g, type)                                   \
 int f(const char __user *s, size_t count, unsigned int base, type *res)        \
 {                                                                      \
@@ -62,5 +61,4 @@ kstrto_from_user(kstrtou16_from_user, kstrtou16,      u16);
 kstrto_from_user(kstrtos16_from_user,  kstrtos16,      s16);
 kstrto_from_user(kstrtou8_from_user,   kstrtou8,       u8);
 kstrto_from_user(kstrtos8_from_user,   kstrtos8,       s8);
-
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
+#endif
index d83f766ebddb2d0d4fd712996a33e1e9f5e27f0c..0a962b77983cd27233987d1b0f74c0221d76f4f3 100644 (file)
@@ -50,8 +50,6 @@ int __ethtool_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 }
 EXPORT_SYMBOL(__ethtool_get_settings);
 
-#if (!defined(CONFIG_COMPAT_SLES_11_2) && !defined(CONFIG_COMPAT_SLES_11_3))
-#if !defined(RHEL_MINOR) || (RHEL_MINOR < 3)
 /**
  * llist_add_batch - add several linked entries in batch
  * @new_first: first entry in batch to be added
@@ -110,6 +108,3 @@ struct llist_node *llist_del_first(struct llist_head *head)
        return entry;
 }
 EXPORT_SYMBOL_GPL(llist_del_first);
-
-#endif /* (!defined(CONFIG_COMPAT_SLES_11_2) && !defined(CONFIG_COMPAT_SLES_11_3)) */
-#endif
index c4146c41d283915ab85817d0a657afca113765a1..4721fa2d1f46ac7cba5efa688f247e170c1725f8 100644 (file)
@@ -8,8 +8,6 @@
  * Compatibility file for Linux wireless for kernels 3.4.
  */
 
-#if (!defined(CONFIG_COMPAT_RHEL_6_4) && !defined(CONFIG_COMPAT_SLES_11_3))
-
 #include <linux/fs.h>
 #include <linux/module.h>
 
@@ -20,5 +18,3 @@ int simple_open(struct inode *inode, struct file *file)
        return 0;
 }
 EXPORT_SYMBOL_GPL(simple_open);
-
-#endif /* (!defined(CONFIG_COMPAT_RHEL_6_4) && !defined(CONFIG_COMPAT_SLES_11_3)) */
index 231df8270b81adae42bf50e7cc397c16fc6b1794..8a7a4097074131f77790e29913c394998689fa22 100644 (file)
@@ -7,10 +7,16 @@
  *
  * Compatibility file for Linux wireless for kernels 3.4.
  */
-#ifndef  CONFIG_COMPAT_RHEL_6_4
+
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/export.h>
+#include <linux/types.h>
 #include <linux/pkt_sched.h>
+
 #define ECN_OR_COST(class)     TC_PRIO_##class
 
+#ifndef CONFIG_COMPAT_IS_IP_TOS2PRIO
 const __u8 ip_tos2prio[16] = {
        TC_PRIO_BESTEFFORT,
        ECN_OR_COST(BESTEFFORT),
@@ -30,4 +36,65 @@ const __u8 ip_tos2prio[16] = {
        ECN_OR_COST(INTERACTIVE_BULK)
 };
 EXPORT_SYMBOL(ip_tos2prio);
-#endif  /* CONFIG_COMPAT_RHEL_6_4 */
+#endif
+
+int dev_uc_add_excl(struct net_device *dev, unsigned char *addr)
+{
+       struct netdev_hw_addr *ha;
+       int err;
+
+       netif_addr_lock_bh(dev);
+       netdev_for_each_uc_addr(ha, dev) {
+               if (!memcmp(ha->addr, addr, dev->addr_len) &&
+                   ha->type == NETDEV_HW_ADDR_T_UNICAST) {
+                       err = -EEXIST;
+                       goto out;
+               }
+       }
+       netif_addr_unlock_bh(dev);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+       return dev_uc_add(dev, addr);
+#else
+       return dev_unicast_add(dev, addr);
+#endif
+
+out:
+       netif_addr_unlock_bh(dev);
+       return err;
+}
+EXPORT_SYMBOL(dev_uc_add_excl);
+
+int dev_mc_add_excl(struct net_device *dev, unsigned char *addr)
+{
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+       struct netdev_hw_addr *ha;
+#else
+       struct dev_addr_list *ha;
+#endif
+       int err;
+
+       netif_addr_lock_bh(dev);
+       netdev_for_each_mc_addr(ha, dev) {
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+               if (!memcmp(ha->addr, addr, dev->addr_len)) {
+#else
+               if (!memcmp(ha->da_addr, addr, dev->addr_len)) {
+#endif
+                       err = -EEXIST;
+                       goto out;
+               }
+       }
+       netif_addr_lock_bh(dev);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
+       return dev_mc_add(dev, addr);
+#else
+       return dev_mc_add(dev, addr, ETH_ALEN, true);
+#endif
+
+out:
+       netif_addr_unlock_bh(dev);
+       return err;
+}
+EXPORT_SYMBOL(dev_mc_add_excl);
diff --git a/compat/compat-3.6.c b/compat/compat-3.6.c
new file mode 100644 (file)
index 0000000..50fc74d
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2012 Mellanox Technologies Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/cpu.h>
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/export.h>
+#include <linux/types.h>
+#include <linux/netdevice.h>
+
+/**
+ * netif_get_num_default_rss_queues - default number of RSS queues
+ *
+ * This routine should set an upper limit on the number of RSS queues
+ * used by default by multiqueue devices.
+ */
+int netif_get_num_default_rss_queues(void)
+{
+       return min_t(int, DEFAULT_MAX_NUM_RSS_QUEUES, num_online_cpus());
+}
+EXPORT_SYMBOL(netif_get_num_default_rss_queues);
diff --git a/compat/compat-3.7.c b/compat/compat-3.7.c
new file mode 100644 (file)
index 0000000..a28e830
--- /dev/null
@@ -0,0 +1,298 @@
+/*
+ * Copyright 2012  Luis R. Rodriguez <mcgrof@do-not-panic.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Compatibility file for Linux wireless for kernels 3.7.
+ */
+
+#include <linux/workqueue.h>
+#include <linux/export.h>
+#include <linux/file.h>
+
+#define mod_delayed_work LINUX_BACKPORT(mod_delayed_work)
+bool mod_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork,
+                     unsigned long delay)
+{
+       cancel_delayed_work(dwork);
+       queue_delayed_work(wq, dwork, delay);
+       return false;
+}
+EXPORT_SYMBOL_GPL(mod_delayed_work);
+
+/*
+ * Kernels >= 3.7 get their PCI-E Capabilities Register cached
+ * via the pci_dev->pcie_flags_reg so for older kernels we have
+ * no other option but to read this every single time we need
+ * it accessed. If we really cared to improve the efficiency
+ * of this we could try to find an unused u16 varible on the
+ * pci_dev but if we found it we likely would remove it from
+ * the kernel anyway right? Bite me.
+ */
+#define pcie_flags_reg LINUX_BACKPORT(pcie_flags_reg)
+static inline u16 pcie_flags_reg(struct pci_dev *dev)
+{
+       int pos;
+       u16 reg16;
+
+       pos = pci_find_capability(dev, PCI_CAP_ID_EXP);
+       if (!pos)
+               return 0;
+
+       pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &reg16);
+
+       return reg16;
+}
+
+#define pci_pcie_type LINUX_BACKPORT(pci_pcie_type)
+static inline int pci_pcie_type(struct pci_dev *dev)
+{
+       return (pcie_flags_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
+}
+
+#define pcie_cap_version LINUX_BACKPORT(pcie_cap_version)
+static inline int pcie_cap_version(struct pci_dev *dev)
+{
+       return pcie_flags_reg(dev) & PCI_EXP_FLAGS_VERS;
+}
+
+#define pcie_cap_has_devctl LINUX_BACKPORT(pcie_cap_has_devctl)
+static inline bool pcie_cap_has_devctl(const struct pci_dev *dev)
+{
+       return true;
+}
+
+#define pcie_cap_has_lnkctl LINUX_BACKPORT(pcie_cap_has_lnkctl)
+static inline bool pcie_cap_has_lnkctl(struct pci_dev *dev)
+{
+       int type = pci_pcie_type(dev);
+
+       return pcie_cap_version(dev) > 1 ||
+              type == PCI_EXP_TYPE_ROOT_PORT ||
+              type == PCI_EXP_TYPE_ENDPOINT ||
+              type == PCI_EXP_TYPE_LEG_END;
+}
+
+#define pcie_cap_has_sltctl LINUX_BACKPORT(pcie_cap_has_sltctl)
+static inline bool pcie_cap_has_sltctl(struct pci_dev *dev)
+{
+       int type = pci_pcie_type(dev);
+
+       return pcie_cap_version(dev) > 1 ||
+              type == PCI_EXP_TYPE_ROOT_PORT ||
+              (type == PCI_EXP_TYPE_DOWNSTREAM &&
+               pcie_flags_reg(dev) & PCI_EXP_FLAGS_SLOT);
+}
+
+#define pcie_cap_has_rtctl LINUX_BACKPORT(pcie_cap_has_rtctl)
+static inline bool pcie_cap_has_rtctl(struct pci_dev *dev)
+{
+       int type = pci_pcie_type(dev);
+
+       return pcie_cap_version(dev) > 1 ||
+              type == PCI_EXP_TYPE_ROOT_PORT ||
+              type == PCI_EXP_TYPE_RC_EC;
+}
+
+#define pcie_capability_reg_implemented LINUX_BACKPORT(pcie_capability_reg_implemented)
+static bool pcie_capability_reg_implemented(struct pci_dev *dev, int pos)
+{
+       if (!pci_is_pcie(dev))
+               return false;
+
+       switch (pos) {
+       case PCI_EXP_FLAGS_TYPE:
+               return true;
+       case PCI_EXP_DEVCAP:
+       case PCI_EXP_DEVCTL:
+       case PCI_EXP_DEVSTA:
+               return pcie_cap_has_devctl(dev);
+       case PCI_EXP_LNKCAP:
+       case PCI_EXP_LNKCTL:
+       case PCI_EXP_LNKSTA:
+               return pcie_cap_has_lnkctl(dev);
+       case PCI_EXP_SLTCAP:
+       case PCI_EXP_SLTCTL:
+       case PCI_EXP_SLTSTA:
+               return pcie_cap_has_sltctl(dev);
+       case PCI_EXP_RTCTL:
+       case PCI_EXP_RTCAP:
+       case PCI_EXP_RTSTA:
+               return pcie_cap_has_rtctl(dev);
+       case PCI_EXP_DEVCAP2:
+       case PCI_EXP_DEVCTL2:
+       case PCI_EXP_LNKCAP2:
+       case PCI_EXP_LNKCTL2:
+       case PCI_EXP_LNKSTA2:
+               return pcie_cap_version(dev) > 1;
+       default:
+               return false;
+       }
+}
+
+/*
+ * Note that these accessor functions are only for the "PCI Express
+ * Capability" (see PCIe spec r3.0, sec 7.8).  They do not apply to the
+ * other "PCI Express Extended Capabilities" (AER, VC, ACS, MFVC, etc.)
+ */
+#define pcie_capability_read_word LINUX_BACKPORT(pcie_capability_read_word)
+int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val)
+{
+       int ret;
+
+       *val = 0;
+       if (pos & 1)
+               return -EINVAL;
+
+       if (pcie_capability_reg_implemented(dev, pos)) {
+               ret = pci_read_config_word(dev, pci_pcie_cap(dev) + pos, val);
+               /*
+                * Reset *val to 0 if pci_read_config_word() fails, it may
+                * have been written as 0xFFFF if hardware error happens
+                * during pci_read_config_word().
+                */
+               if (ret)
+                       *val = 0;
+               return ret;
+       }
+
+       /*
+        * For Functions that do not implement the Slot Capabilities,
+        * Slot Status, and Slot Control registers, these spaces must
+        * be hardwired to 0b, with the exception of the Presence Detect
+        * State bit in the Slot Status register of Downstream Ports,
+        * which must be hardwired to 1b.  (PCIe Base Spec 3.0, sec 7.8)
+        */
+       if (pci_is_pcie(dev) && pos == PCI_EXP_SLTSTA &&
+                pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM) {
+               *val = PCI_EXP_SLTSTA_PDS;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL(pcie_capability_read_word);
+
+#define pcie_capability_read_dword LINUX_BACKPORT(pcie_capability_read_dword)
+int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val)
+{
+       int ret;
+
+       *val = 0;
+       if (pos & 3)
+               return -EINVAL;
+
+       if (pcie_capability_reg_implemented(dev, pos)) {
+               ret = pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, val);
+               /*
+                * Reset *val to 0 if pci_read_config_dword() fails, it may
+                * have been written as 0xFFFFFFFF if hardware error happens
+                * during pci_read_config_dword().
+                */
+               if (ret)
+                       *val = 0;
+               return ret;
+       }
+
+       if (pci_is_pcie(dev) && pos == PCI_EXP_SLTCTL &&
+                pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM) {
+               *val = PCI_EXP_SLTSTA_PDS;
+       }
+
+       return 0;
+}
+EXPORT_SYMBOL(pcie_capability_read_dword);
+
+#define pcie_capability_write_word LINUX_BACKPORT(pcie_capability_write_word)
+int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 val)
+{
+       if (pos & 1)
+               return -EINVAL;
+
+       if (!pcie_capability_reg_implemented(dev, pos))
+               return 0;
+
+       return pci_write_config_word(dev, pci_pcie_cap(dev) + pos, val);
+}
+EXPORT_SYMBOL(pcie_capability_write_word);
+
+#define pcie_capability_write_dword LINUX_BACKPORT(pcie_capability_write_dword)
+int pcie_capability_write_dword(struct pci_dev *dev, int pos, u32 val)
+{
+       if (pos & 3)
+               return -EINVAL;
+
+       if (!pcie_capability_reg_implemented(dev, pos))
+               return 0;
+
+       return pci_write_config_dword(dev, pci_pcie_cap(dev) + pos, val);
+}
+EXPORT_SYMBOL(pcie_capability_write_dword);
+
+#define pcie_capability_clear_and_set_word LINUX_BACKPORT(pcie_capability_clear_and_set_word)
+int pcie_capability_clear_and_set_word(struct pci_dev *dev, int pos,
+                                      u16 clear, u16 set)
+{
+       int ret;
+       u16 val;
+
+       ret = pcie_capability_read_word(dev, pos, &val);
+       if (!ret) {
+               val &= ~clear;
+               val |= set;
+               ret = pcie_capability_write_word(dev, pos, val);
+       }
+
+       return ret;
+}
+EXPORT_SYMBOL(pcie_capability_clear_and_set_word);
+
+#define pcie_capability_clear_and_set_dword LINUX_BACKPORT(pcie_capability_clear_and_set_dword)
+int pcie_capability_clear_and_set_dword(struct pci_dev *dev, int pos,
+                                       u32 clear, u32 set)
+{
+       int ret;
+       u32 val;
+
+       ret = pcie_capability_read_dword(dev, pos, &val);
+       if (!ret) {
+               val &= ~clear;
+               val |= set;
+               ret = pcie_capability_write_dword(dev, pos, val);
+       }
+
+       return ret;
+}
+EXPORT_SYMBOL(pcie_capability_clear_and_set_dword);
+
+/* Actually fget_light is defined in fs/file.c but only 3.7 exports it.
+ * Lets export it here.
+ */
+struct file *fget_light(unsigned int fd, int *fput_needed)
+{
+       struct file *file;
+       struct files_struct *files = current->files;
+
+       *fput_needed = 0;
+       if (atomic_read(&files->count) == 1) {
+               file = fcheck_files(files, fd);
+               if (file && (file->f_mode & FMODE_PATH))
+                       file = NULL;
+       } else {
+               rcu_read_lock();
+               file = fcheck_files(files, fd);
+               if (file) {
+                       if (!(file->f_mode & FMODE_PATH) &&
+                           atomic_long_inc_not_zero(&file->f_count))
+                               *fput_needed = 1;
+                       else
+                               /* Didn't get the reference, someone's freed */
+                               file = NULL;
+               }
+               rcu_read_unlock();
+       }
+
+       return file;
+}
+EXPORT_SYMBOL(fget_light);
index 69b442b7d20144638d10d72351ad60403863ce57..cc54ce564174b5d0487fa82e928497e80c935a96 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/firmware.h>
 #include <linux/slab.h>
 
-#define compat_firmware_to_dev(obj) container_of(obj, struct device, kobj)
+#define backport_firmware_to_dev(obj) container_of(obj, struct device, kobj)
 
 MODULE_AUTHOR("Manuel Estrada Sainz");
 MODULE_DESCRIPTION("Multi purpose firmware loading support");
@@ -324,7 +324,7 @@ static ssize_t firmware_data_read(struct kobject *kobj,
                                  char *buffer, loff_t offset, size_t count)
 #endif
 {
-       struct device *dev = compat_firmware_to_dev(kobj);
+       struct device *dev = backport_firmware_to_dev(kobj);
        struct firmware_priv *fw_priv = to_firmware_priv(dev);
        struct firmware *fw;
        ssize_t ret_count;
@@ -423,7 +423,7 @@ static ssize_t firmware_data_write(struct kobject *kobj,
                                   char *buffer, loff_t offset, size_t count)
 #endif
 {
-       struct device *dev = compat_firmware_to_dev(kobj);
+       struct device *dev = backport_firmware_to_dev(kobj);
        struct firmware_priv *fw_priv = to_firmware_priv(dev);
        struct firmware *fw;
        ssize_t retval;
@@ -635,7 +635,7 @@ out:
  *      firmware image for this or any other device.
  **/
 int
-compat_request_firmware(const struct firmware **firmware_p, const char *name,
+request_firmware(const struct firmware **firmware_p, const char *name,
                  struct device *device)
 {
         int uevent = 1;
@@ -646,7 +646,7 @@ compat_request_firmware(const struct firmware **firmware_p, const char *name,
  * release_firmware: - release the resource associated with a firmware image
  * @fw: firmware resource to release
  **/
-void compat_release_firmware(const struct firmware *fw)
+void release_firmware(const struct firmware *fw)
 {
        if (fw) {
                if (!fw_is_builtin_firmware(fw))
@@ -705,7 +705,7 @@ static int request_firmware_work_func(void *arg)
  *     in atomic contexts.
  **/
 int
-compat_request_firmware_nowait(
+backport_request_firmware_nowait(
        struct module *module, int uevent,
        const char *name, struct device *device, gfp_t gfp, void *context,
        void (*cont)(const struct firmware *fw, void *context))
@@ -756,4 +756,4 @@ module_exit(firmware_class_exit);
 
 EXPORT_SYMBOL_GPL(release_firmware);
 EXPORT_SYMBOL_GPL(request_firmware);
-EXPORT_SYMBOL_GPL(request_firmware_nowait);
+EXPORT_SYMBOL_GPL(backport_request_firmware_nowait);
index 96e1bdfd0e9202cc564f0b04ecf8e74b556efa8e..6b3c70581597f5c1ae3dba363ebea420d44d62c3 100644 (file)
@@ -563,7 +563,7 @@ unsigned int __kfifo_dma_in_prepare_r(struct __kfifo *fifo,
        struct scatterlist *sgl, int nents, unsigned int len, size_t recsize)
 {
        if (!nents)
-               BUG();
+               return -EINVAL;
 
        len = __kfifo_max_r(len, recsize);
 
@@ -587,7 +587,7 @@ unsigned int __kfifo_dma_out_prepare_r(struct __kfifo *fifo,
        struct scatterlist *sgl, int nents, unsigned int len, size_t recsize)
 {
        if (!nents)
-               BUG();
+               return -EINVAL;
 
        len = __kfifo_max_r(len, recsize);
 
index 540902d83f0a6f95252acbfc41e7566a375e18fd..ba97ac18e8c5365a4fc5a1a783524f3322cc32b1 100644 (file)
  * If -E is returned, result is not touched.
  */
 #include <linux/kernel.h>
+
+#ifndef CONFIG_COMPAT_IS_KSTRTOX
 /* 
  * kstrto* was included in kernel 2.6.38.4 and causes conflicts with the
  * version included in compat-wireless. We use strict_strtol to check if
  * kstrto* is already available.
  */
-#ifndef strict_strtol
+#ifndef strict_strtoll
 
 #include <linux/ctype.h>
 #include <linux/errno.h>
@@ -26,8 +28,6 @@
 #include <linux/module.h>
 #include <linux/types.h>
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
-
 static inline char _tolower(const char c)
 {
        return c | 0x20;
@@ -235,6 +235,5 @@ int kstrtos8(const char *s, unsigned int base, s8 *res)
        return 0;
 }
 EXPORT_SYMBOL_GPL(kstrtos8);
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
-
 #endif /* #ifndef strict_strtol */
+#endif /* #ifndef CONFIG_COMPAT_IS_KSTRTOX */
index 972c142d9e2cc9316cc80b2745fa789d198b4324..af3717c0e9091ffe450425564d4e8a5e2f4613f3 100644 (file)
@@ -1,7 +1,8 @@
 #include <linux/module.h>
+#include "compat-2.6.34.h"
 
 MODULE_AUTHOR("Luis R. Rodriguez");
-MODULE_DESCRIPTION("Kernel compatibility module");
+MODULE_DESCRIPTION("Kernel backport module");
 MODULE_LICENSE("GPL");
 
 #ifndef COMPAT_BASE
@@ -41,17 +42,23 @@ module_param(compat_version, charp, 0400);
 MODULE_PARM_DESC(compat_version,
                 "Version of the kernel compat backport work");
 
-void compat_dependency_symbol(void)
+void backport_dependency_symbol(void)
 {
 }
-EXPORT_SYMBOL_GPL(compat_dependency_symbol);
+EXPORT_SYMBOL_GPL(backport_dependency_symbol);
 
 
-static int __init compat_init(void)
+static int __init backport_init(void)
 {
-       compat_pm_qos_power_init();
-       compat_system_workqueue_create();
-       init_compat_mmc_pm_flags();
+       int err;
+
+       backport_pm_qos_power_init();
+       err = backport_system_workqueue_create();
+       if (err) {
+               pr_warn("backport_system_workqueue_create() failed\n");
+               return err;
+       }
+       backport_init_mmc_pm_flags();
 
        printk(KERN_INFO
               COMPAT_PROJECT " backport release: "
@@ -65,14 +72,14 @@ static int __init compat_init(void)
 
         return 0;
 }
-module_init(compat_init);
+module_init(backport_init);
 
-static void __exit compat_exit(void)
+static void __exit backport_exit(void)
 {
-       compat_pm_qos_power_deinit();
-       compat_system_workqueue_destroy();
+       backport_pm_qos_power_deinit();
+       backport_system_workqueue_destroy();
 
         return;
 }
-module_exit(compat_exit);
+module_exit(backport_exit);
 
index 833d98c5ddd1caef39ba41e044bb64d73a776311..42785ce134bea4065f54875b16e6fc8024d69c3f 100644 (file)
@@ -414,7 +414,7 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
 /*
  * This initializes pm-qos for older kernels.
  */
-int compat_pm_qos_power_init(void)
+int backport_pm_qos_power_init(void)
 {
        int ret = 0;
 
@@ -442,7 +442,7 @@ int compat_pm_qos_power_init(void)
        return ret;
 }
 
-int compat_pm_qos_power_deinit(void)
+int backport_pm_qos_power_deinit(void)
 {
        int ret = 0;
 
diff --git a/compat/scripts/compat_firmware_install b/compat/scripts/compat_firmware_install
new file mode 100755 (executable)
index 0000000..33e4fde
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+if [ -f /usr/bin/lsb_release ]; then
+       LSB_RED_ID=$(/usr/bin/lsb_release -i -s)
+else
+       LSB_RED_ID="Unknown"
+fi
+
+case $LSB_RED_ID in
+"Ubuntu")
+       mkdir -p /lib/udev/ /lib/udev/rules.d/
+       cp udev/ubuntu/compat_firmware.sh /lib/udev/
+       cp udev/ubuntu/50-compat_firmware.rules /lib/udev/rules.d/
+        ;;
+*)
+       mkdir -p /lib/udev/ /lib/udev/rules.d/
+       cp udev/compat_firmware.sh /lib/udev/
+       cp udev/50-compat_firmware.rules /lib/udev/rules.d/
+        ;;
+esac
+
diff --git a/compat/scripts/gen-compat-autoconf.sh b/compat/scripts/gen-compat-autoconf.sh
new file mode 100755 (executable)
index 0000000..e52cc5a
--- /dev/null
@@ -0,0 +1,105 @@
+#!/bin/bash
+#
+# Copyright 2012       Luis R. Rodriguez <mcgrof@frijolero.org>
+# Copyright 2011       Hauke Mehrtens <hauke@hauke-m.de>
+# Copyright 2011       John W. Linville <linville@tuxdriver.com>
+#
+# Use this to parse a small .config equivalent looking file to generate
+# our own autoconf.h. This file has defines for each config option
+# just like the kernels include/linux/autoconf.h
+#
+# XXX: consider using scripts/kconfig/confdata.c instead.
+# On the downside this would require the user to have libc though.
+
+# This indicates which is the oldest kernel we support
+# Update this if you are adding support for older kernels.
+OLDEST_KERNEL_SUPPORTED="2.6.24"
+
+if [ $# -ne 1 ]; then
+       echo "Usage $0 config-file"
+       exit
+fi
+
+COMPAT_CONFIG="$1"
+
+if [ ! -f $COMPAT_CONFIG ]; then
+       echo "File $1 is not a file"
+       exit
+fi
+
+# Defines a CONFIG_ option if not defined yet, this helps respect
+# linux/autoconf.h
+function define_config {
+       VAR=$1
+       VALUE=$2
+       case $VALUE in
+       n) # Try to undefine it
+               echo "#undef $VAR"
+               ;;
+       y)
+               echo "#ifndef $VAR"
+               echo "#define $VAR 1"
+               echo "#endif /* $VAR */"
+               ;;
+       m)
+               echo "#ifndef $VAR"
+               echo "#define $VAR 1"
+               echo "#endif /* $VAR */"
+               ;;
+       *) # Assume string
+               # XXX: add better checks to make sure what was on
+               # the right was indeed a string
+               echo "#ifndef $VAR"
+               echo "#define $VAR \"$VALUE\""
+               echo "#endif /* $VAR */"
+               ;;
+       esac
+}
+
+function kernel_version_req {
+       VERSION=$(echo $1 | sed -e 's/\./,/g')
+       echo "#if (LINUX_VERSION_CODE < KERNEL_VERSION($VERSION))"
+       echo "#error compat requirement: Linux >= $VERSION"
+       echo "#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION($VERSION) */"
+}
+
+cat <<EOF
+#ifndef COMPAT_AUTOCONF_INCLUDED
+#define COMPAT_AUTOCONF_INCLUDED
+/*
+ * Automatically generated C config: don't edit
+ */
+EOF
+
+# Checks user is compiling against a kernel we support
+kernel_version_req $OLDEST_KERNEL_SUPPORTED
+
+# For each CONFIG_FOO=x option
+for i in $(egrep '^CONFIG_|^ifdef CONFIG_|^ifndef CONFIG_|^endif #CONFIG_|^else #CONFIG_' $COMPAT_CONFIG | sed 's/ /+/'); do
+       case $i in
+       'ifdef+CONFIG_'* )
+               echo "#$i" | sed -e 's/+/ /' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(3,\2,0))/' -e 's/\(ifdef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,\2))/' -e 's/\(ifdef CONFIG_COMPAT_RHEL_\)\([0-9]*\)_\([0-9]*\)/if (defined(RHEL_MAJOR) \&\& RHEL_MAJOR == \2 \&\& RHEL_MINOR >= \3)/' -e 's/\(#ifdef \)\(CONFIG_[^:space:]*\)/#if defined(\2) || defined(\2_MODULE)/'
+               continue
+               ;;
+       'ifndef+CONFIG_'* )
+               echo "#$i" | sed -e 's/+/ /' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_3_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,\2,0))/' -e 's/\(ifndef CONFIG_COMPAT_KERNEL_2_6_\)\([0-9]*\)/if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,\2))/' -e 's/\(ifndef CONFIG_COMPAT_RHEL_\)\([0-9]*\)_\([0-9]*\)/if (!defined(RHEL_MAJOR) || RHEL_MAJOR != \2 || RHEL_MINOR < \3)/' -e 's/\(#ifndef \)\(CONFIG_[^:space:]*\)/#if !defined(\2) \&\& !defined(\2_MODULE)/'
+               continue
+               ;;
+       'else+#CONFIG_'* | 'endif+#CONFIG_'* )
+               echo "#$i */" |sed -e 's/+#/ \/* /g'
+               continue
+               ;;
+       CONFIG_* )
+               # Get the element on the left of the "="
+               VAR=$(echo $i | cut -d"=" -f 1)
+               # Get the element on the right of the "="
+               VALUE=$(echo $i | cut -d"=" -f 2)
+
+               # Any other module which can *definitely* be built as a module goes here
+               define_config $VAR $VALUE
+               continue
+               ;;
+       esac
+done
+
+echo "#endif /* COMPAT_AUTOCONF_INCLUDED */"
diff --git a/compat/scripts/gen-compat-config.sh b/compat/scripts/gen-compat-config.sh
new file mode 100755 (executable)
index 0000000..3eba34e
--- /dev/null
@@ -0,0 +1,77 @@
+#!/bin/bash
+# Copyright 2012        Luis R. Rodriguez <mcgrof@frijolero.org>
+# Copyright 2012        Hauke Mehrtens <hauke@hauke-m.de>
+#
+# This generates a bunch of CONFIG_COMPAT_KERNEL_2_6_22
+# CONFIG_COMPAT_KERNEL_3_0 .. etc for each kernel release you need an object
+# for.
+#
+# Note: this is part of the compat.git project, not compat-wireless.git,
+# send patches against compat.git.
+
+if [[ ! -f ${KLIB_BUILD}/Makefile ]]; then
+       exit
+fi
+
+# Actual kernel version
+KERNEL_VERSION=$(${MAKE} -C ${KLIB_BUILD} kernelversion | sed -n 's/^\([0-9]\)\..*/\1/p')
+
+# 3.0 kernel stuff
+COMPAT_LATEST_VERSION="5"
+KERNEL_SUBLEVEL="-1"
+
+# Note that this script will export all variables explicitly,
+# trying to export all with a blanket "export" statement at
+# the top of the generated file causes the build to slow down
+# by an order of magnitude.
+
+if [[ ${KERNEL_VERSION} -eq "3" ]]; then
+       KERNEL_SUBLEVEL=$(${MAKE} -C ${KLIB_BUILD} kernelversion | sed -n 's/^3\.\([0-9]\+\).*/\1/p')
+else
+       COMPAT_26LATEST_VERSION="39"
+       KERNEL_26SUBLEVEL=$(${MAKE} -C ${KLIB_BUILD} kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p')
+       let KERNEL_26SUBLEVEL=${KERNEL_26SUBLEVEL}+1
+
+       for i in $(seq ${KERNEL_26SUBLEVEL} ${COMPAT_26LATEST_VERSION}); do
+               eval CONFIG_COMPAT_KERNEL_2_6_${i}=y
+               echo "export CONFIG_COMPAT_KERNEL_2_6_${i}=y"
+       done
+fi
+
+let KERNEL_SUBLEVEL=${KERNEL_SUBLEVEL}+1
+for i in $(seq ${KERNEL_SUBLEVEL} ${COMPAT_LATEST_VERSION}); do
+       eval CONFIG_COMPAT_KERNEL_3_${i}=y
+       echo "export CONFIG_COMPAT_KERNEL_3_${i}=y"
+done
+
+# The purpose of these seem to be the inverse of the above other varibales.
+# The RHEL checks seem to annotate the existance of RHEL minor versions.
+RHEL_MAJOR=$(grep ^RHEL_MAJOR ${KLIB_BUILD}/Makefile | sed -n 's/.*= *\(.*\)/\1/p')
+if [[ ! -z ${RHEL_MAJOR} ]]; then
+       RHEL_MINOR=$(grep ^RHEL_MINOR $(KLIB_BUILD)/Makefile | sed -n 's/.*= *\(.*\)/\1/p')
+       for i in $(seq 0 ${RHEL_MINOR}); do
+               eval CONFIG_COMPAT_${RHEL_MAJOR}_${i}=y
+               echo "export CONFIG_COMPAT_${RHEL_MAJOR}_${i}=y"
+       done
+fi
+
+if [[ ${CONFIG_COMPAT_KERNEL_2_6_33} = "y" ]]; then
+       echo "export CONFIG_COMPAT_FIRMWARE_CLASS=m"
+fi
+
+if [[ ${CONFIG_COMPAT_KERNEL_2_6_36} = "y" ]]; then
+       echo "export CONFIG_COMPAT_KFIFO=y"
+fi
+
+if [[ ${CONFIG_COMPAT_KERNEL_3_5} = "y" ]]; then
+       # We don't have 2.6.24 backport support yet for Codel / FQ CoDel
+       # For those who want to try this is what is required that I can tell
+       # so far:
+       #  * struct Qdisc_ops
+       #       - init and change callback ops use a different argument dataype
+       #       - you need to parse data received from userspace differently
+       if [[ ${CONFIG_COMPAT_KERNEL_2_6_25} != "y" ]]; then
+               echo "export CONFIG_COMPAT_NET_SCH_CODEL=m"
+               echo "export CONFIG_COMPAT_NET_SCH_FQ_CODEL=m"
+       fi
+fi
diff --git a/compat/scripts/skip-colors b/compat/scripts/skip-colors
new file mode 100755 (executable)
index 0000000..121626f
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/bash
+perl -pe 's|(\e)\[(\d+)(;*)(\d*)(\w)||g'
index fbfb470d13bf451437266f42c430e6e53f80b061..37cbc22a6670315132eacc3577711db897edd1cc 100644 (file)
@@ -75,6 +75,8 @@ static inline void tcf_destroy_chain_compat(struct tcf_proto **fl)
 #define __dev_set_promiscuity dev_set_promiscuity
 
 /* Our own 2.6.22 port on compat.c */
+#define dev_mc_unsync LINUX_BACKPORT(dev_mc_unsync)
+#define dev_mc_sync LINUX_BACKPORT(dev_mc_sync)
 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);
 
@@ -113,6 +115,7 @@ struct genl_multicast_group
 
 
 /* Added as of 2.6.23 */
+#define pci_try_set_mwi LINUX_BACKPORT(pci_try_set_mwi)
 int pci_try_set_mwi(struct pci_dev *dev);
 
 /* Added as of 2.6.23 */
index 456dcb6c2ae908d40f4c9f8410ae4cf524f79fae..5448604cdbb21a8581c31dcd6ed1a7492cac36e0 100644 (file)
@@ -45,6 +45,7 @@ struct net {
 
 #ifdef CONFIG_NET
 /* Init's network namespace */
+#define init_net LINUX_BACKPORT(init_net)
 extern struct net init_net;
 #define INIT_NET_NS(net_ns) .net_ns = &init_net,
 #else
@@ -162,12 +163,16 @@ struct ssb_device_id {
 #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 eth_header LINUX_BACKPORT(eth_header)
 extern int             eth_header(struct sk_buff *skb, struct net_device *dev,
                                unsigned short type, void *daddr,
                                void *saddr, unsigned len);
+#define eth_rebuild_header LINUX_BACKPORT(eth_rebuild_header)
 extern int             eth_rebuild_header(struct sk_buff *skb);
+#define eth_header_cache_update LINUX_BACKPORT(eth_header_cache_update)
 extern void            eth_header_cache_update(struct hh_cache *hh, struct net_device *dev,
                                unsigned char * haddr);
+#define eth_header_cache LINUX_BACKPORT(eth_header_cache)
 extern int             eth_header_cache(struct neighbour *neigh,
                        struct hh_cache *hh);
 
index 563b65f79b5fd3ab7c4c7b5b0aefdd1af98c2990..a8e02445cb89124da11520a70518fefc0e730613 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/pci.h>
 
 /* Backports b718989da7 */
+#define pci_enable_device_mem LINUX_BACKPORT(pci_enable_device_mem)
 int __must_check pci_enable_device_mem(struct pci_dev *dev);
 
 /*
@@ -146,11 +147,11 @@ typedef u32 phys_addr_t;
  * This pm-qos implementation is copied verbatim from the kernel
  * written by mark gross mgross@linux.intel.com. You don't have
  * to do anythinig to use pm-qos except use the same exported
- * routines as used in newer kernels. The compat_pm_qos_power_init()
+ * routines as used in newer kernels. The backport_pm_qos_power_init()
  * defned below is used by the compat module to initialize pm-qos.
  */
-int compat_pm_qos_power_init(void);
-int compat_pm_qos_power_deinit(void);
+int backport_pm_qos_power_init(void);
+int backport_pm_qos_power_deinit(void);
 
 /*
  * 2.6.25 adds PM_EVENT_HIBERNATE as well here but
@@ -175,7 +176,9 @@ int compat_pm_qos_power_deinit(void);
 #define dev_crit(dev, format, arg...)           \
        dev_printk(KERN_CRIT , dev , format , ## arg)
 
+#define __dev_addr_sync LINUX_BACKPORT(__dev_addr_sync)
 extern int             __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
+#define __dev_addr_unsync LINUX_BACKPORT(__dev_addr_unsync)
 extern void            __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
 
 #define seq_file_net &init_net;
@@ -255,7 +258,9 @@ static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
  * The following things are out of ./include/linux/kernel.h
  * The new iwlwifi driver is using them.
  */
+#define strict_strtoul LINUX_BACKPORT(strict_strtoul)
 extern int strict_strtoul(const char *, unsigned int, unsigned long *);
+#define strict_strtol LINUX_BACKPORT(strict_strtol)
 extern int strict_strtol(const char *, unsigned int, long *);
 
 #else
@@ -263,12 +268,12 @@ extern int strict_strtol(const char *, unsigned int, long *);
  * Kernels >= 2.6.25 have pm-qos and its initialized as part of
  * the bootup process
  */
-static inline int compat_pm_qos_power_init(void)
+static inline int backport_pm_qos_power_init(void)
 {
        return 0;
 }
 
-static inline int compat_pm_qos_power_deinit(void)
+static inline int backport_pm_qos_power_deinit(void)
 {
        return 0;
 }
index 177792a3753e336501d0182b86b4cbd13ff29e7b..b8d9dc645377a129035159be02ac285b9aa2bfa2 100644 (file)
@@ -45,6 +45,7 @@
 #define SHORT_MAX       ((s16)(USHORT_MAX>>1))
 #define SHORT_MIN       (-SHORT_MAX - 1)
 
+#define dev_set_name LINUX_BACKPORT(dev_set_name)
 extern int dev_set_name(struct device *dev, const char *name, ...)
                        __attribute__((format(printf, 2, 3)));
 
index ece825de1437ae0140850ca675b0890bb0effb7e..400ca1f4fd0bb6f0cdf1984ed85fe6d8b8e77850 100644 (file)
@@ -87,6 +87,7 @@ static inline bool qdisc_all_tx_empty(const struct net_device *dev)
        return skb_queue_empty(&dev->qdisc->q);
 }
 
+#define pci_pme_capable LINUX_BACKPORT(pci_pme_capable)
 bool pci_pme_capable(struct pci_dev *dev, pci_power_t state);
 
 /*
@@ -207,7 +208,9 @@ static inline void list_splice_tail_init(struct list_head *list,
 }
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
+#define mmc_align_data_size LINUX_BACKPORT(mmc_align_data_size)
 extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
+#define sdio_align_size LINUX_BACKPORT(sdio_align_size)
 extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) */
 
@@ -251,6 +254,8 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
 
 #endif /* arm */
 
+#define debugfs_remove_recursive LINUX_BACKPORT(debugfs_remove_recursive)
+
 #if defined(CONFIG_DEBUG_FS)
 void debugfs_remove_recursive(struct dentry *dentry);
 #else
index 9b6b9580e87cadf10f7c6cb919f433a3d461de68..9c3e1ebfff3bd7ac8c28462881369620624937bc 100644 (file)
@@ -48,46 +48,7 @@ typedef u32 phys_addr_t;
 })
 #endif /* From include/asm-generic/bug.h */
 
-#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
-
-#include <pcmcia/cs_types.h>
-#include <pcmcia/cs.h>
-#include <pcmcia/cistpl.h>
-#ifdef pcmcia_parse_tuple
-#undef pcmcia_parse_tuple
-#define pcmcia_parse_tuple(tuple, parse) pccard_parse_tuple(tuple, parse)
-#endif
-
-/* From : include/pcmcia/ds.h */
-/* loop CIS entries for valid configuration */
-int pcmcia_loop_config(struct pcmcia_device *p_dev,
-                      int      (*conf_check)   (struct pcmcia_device *p_dev,
-                                                cistpl_cftable_entry_t *cfg,
-                                                cistpl_cftable_entry_t *dflt,
-                                                unsigned int vcc,
-                                                void *priv_data),
-                      void *priv_data);
-
-#endif /* CONFIG_PCMCIA */
-
-/* USB anchors were added as of 2.6.23 */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
-
-#if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
-#if 0
-extern void usb_poison_urb(struct urb *urb);
-#endif
-extern void usb_unpoison_urb(struct urb *urb);
-
-#if 0
-extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
-#endif
-
-extern int usb_anchor_empty(struct usb_anchor *anchor);
-#endif /* CONFIG_USB */
-#endif
-
-
+#define pci_ioremap_bar LINUX_BACKPORT(pci_ioremap_bar)
 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
 
 /**
@@ -243,11 +204,7 @@ static inline void skb_queue_splice_tail(const struct sk_buff_head *list,
 
 #endif
 
-/* openSuse includes round_jiffies_up in it's kernel 2.6.27.
- * This is needed to prevent conflicts with the openSuse definition.
- */
-#define round_jiffies_up backport_round_jiffies_up
-
+#define round_jiffies_up LINUX_BACKPORT(round_jiffies_up)
 unsigned long round_jiffies_up(unsigned long j);
 
 extern void v2_6_28_skb_add_rx_frag(struct sk_buff *skb, int i, struct page *page,
@@ -256,9 +213,11 @@ extern void v2_6_28_skb_add_rx_frag(struct sk_buff *skb, int i, struct page *pag
 #define wake_up_interruptible_poll(x, m)                       \
        __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m))
 
+#define n_tty_ioctl_helper LINUX_BACKPORT(n_tty_ioctl_helper)
 extern int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
                       unsigned int cmd, unsigned long arg);
 
+#define pci_wake_from_d3 LINUX_BACKPORT(pci_wake_from_d3)
 int pci_wake_from_d3(struct pci_dev *dev, bool enable);
 
 #define alloc_workqueue(name, flags, max_active) __create_workqueue(name, flags, max_active)
index 48b62e8a3912d4d3ba42508a0ee13f7ae7ac7bd5..b3833fe4fed73d8734b903fb808b255bf299b4bb 100644 (file)
@@ -236,6 +236,7 @@ static inline int ndo_do_ioctl(struct net_device *dev,
 }
 
 
+#define netdev_attach_ops LINUX_BACKPORT(netdev_attach_ops)
 void netdev_attach_ops(struct net_device *dev,
                       const struct net_device_ops *ops);
 
@@ -278,6 +279,7 @@ static inline struct net_device_stats *dev_get_stats(struct net_device *dev)
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
 #if defined(CONFIG_USB) || defined(CONFIG_USB_MODULE)
+#define usb_unpoison_anchored_urbs LINUX_BACKPORT(usb_unpoison_anchored_urbs)
 extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
 #endif /* CONFIG_USB */
 #endif
@@ -289,8 +291,11 @@ extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
 }                                                      \
 )
 
+#define eth_mac_addr LINUX_BACKPORT(eth_mac_addr)
 extern int eth_mac_addr(struct net_device *dev, void *p);
+#define eth_change_mtu LINUX_BACKPORT(eth_change_mtu)
 extern int eth_change_mtu(struct net_device *dev, int new_mtu);
+#define eth_validate_addr LINUX_BACKPORT(eth_validate_addr)
 extern int eth_validate_addr(struct net_device *dev);
 
 #ifdef CONFIG_NET_NS
@@ -318,6 +323,7 @@ static inline struct net *read_pnet(struct net * const *pnet)
 
 #endif
 
+#define init_dummy_netdev LINUX_BACKPORT(init_dummy_netdev)
 extern int             init_dummy_netdev(struct net_device *dev);
 
 #define compat_pci_suspend(fn)                                         \
index 25db973dff99bed4596b9b9e9578f8f9091195e8..19fe6eea504edbd2a990994f64b53f170c5f0d98 100644 (file)
 #include <net/genetlink.h>
 #include <linux/ethtool.h>
 
-/*
- * These macros allow us to backport rfkill without any
- * changes on cfg80211 through compat.diff. Note that this
- * file will be included by rfkill_backport.h so we must
- * not conflict with things there.
- */
-#define rfkill_get_led_trigger_name    backport_rfkill_get_led_trigger_name
-#define rfkill_set_led_trigger_name    backport_rfkill_set_led_trigger_name
-#define rfkill_set_hw_state    backport_rfkill_set_hw_state
-#define rfkill_set_sw_state    backport_rfkill_set_sw_state
-#define rfkill_init_sw_state   backport_rfkill_init_sw_state
-#define rfkill_set_states      backport_rfkill_set_states
-#define rfkill_pause_polling   backport_rfkill_pause_polling
-#define rfkill_resume_polling  backport_rfkill_resume_polling
-#define rfkill_blocked         backport_rfkill_blocked
-#define rfkill_alloc           backport_rfkill_alloc
-#define rfkill_register                backport_rfkill_register
-#define rfkill_unregister      backport_rfkill_unregister
-#define rfkill_destroy         backport_rfkill_destroy
+#define rfkill_get_led_trigger_name LINUX_BACKPORT(rfkill_get_led_trigger_name)
+#define rfkill_set_led_trigger_name LINUX_BACKPORT(rfkill_set_led_trigger_name)
+#define rfkill_set_hw_state LINUX_BACKPORT(rfkill_set_hw_state)
+#define rfkill_set_sw_state LINUX_BACKPORT(rfkill_set_sw_state)
+#define rfkill_init_sw_state LINUX_BACKPORT(rfkill_init_sw_state)
+#define rfkill_set_states LINUX_BACKPORT(rfkill_set_states)
+#define rfkill_pause_polling LINUX_BACKPORT(rfkill_pause_polling)
+#define rfkill_resume_polling LINUX_BACKPORT(rfkill_resume_polling)
+#define rfkill_blocked LINUX_BACKPORT(rfkill_blocked)
+#define rfkill_alloc LINUX_BACKPORT(rfkill_alloc)
+#define rfkill_register LINUX_BACKPORT(rfkill_register)
+#define rfkill_unregister LINUX_BACKPORT(rfkill_unregister)
+#define rfkill_destroy LINUX_BACKPORT(rfkill_destroy)
 
 #ifndef ERFKILL
 #if !defined(CONFIG_ALPHA) && !defined(CONFIG_MIPS) && !defined(CONFIG_PARISC) && !defined(CONFIG_SPARC)
@@ -208,7 +202,9 @@ typedef struct {
        long long counter;
 } atomic64_t;
 
+#define atomic64_read LINUX_BACKPORT(atomic64_read)
 extern long long atomic64_read(const atomic64_t *v);
+#define atomic64_add_return LINUX_BACKPORT(atomic64_add_return)
 extern long long atomic64_add_return(long long a, atomic64_t *v);
 
 #define atomic64_inc_return(v)          atomic64_add_return(1LL, (v))
index 9d41fc851ea9a3f68fad77735958af9668bc3f87..15b1a9a08993f3d886a89ef20338f34e59eda532 100644 (file)
@@ -179,6 +179,7 @@ struct tm {
        int tm_yday;
 };
 
+#define time_to_tm LINUX_BACKPORT(time_to_tm)
 void time_to_tm(time_t totalsecs, int offset, struct tm *result);
 
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) */
index d0d4db119c40f8abd5e66bc44e4fc9e376bc1742..f93f7bdec2cdc94ef0669cf61e01327b0c9d1de7 100644 (file)
 #include <linux/sched.h>
 
 #if defined(CONFIG_COMPAT_FIRMWARE_CLASS)
-#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
-#define release_firmware compat_release_firmware
-#define request_firmware compat_request_firmware
-#define request_firmware_nowait compat_request_firmware_nowait
-#endif
-#endif
+#define request_firmware_nowait LINUX_BACKPORT(request_firmware_nowait)
+#define request_firmware LINUX_BACKPORT(request_firmware)
+#define release_firmware LINUX_BACKPORT(release_firmware)
 
 #if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
-int compat_request_firmware(const struct firmware **fw, const char *name,
+int request_firmware(const struct firmware **fw, const char *name,
                     struct device *device);
-int compat_request_firmware_nowait(
+int request_firmware_nowait(
        struct module *module, int uevent,
        const char *name, struct device *device, gfp_t gfp, void *context,
        void (*cont)(const struct firmware *fw, void *context));
 
-void compat_release_firmware(const struct firmware *fw);
+void release_firmware(const struct firmware *fw);
 #else
-static inline int compat_request_firmware(const struct firmware **fw,
+static inline int request_firmware(const struct firmware **fw,
                                   const char *name,
                                   struct device *device)
 {
        return -EINVAL;
 }
-static inline int compat_request_firmware_nowait(
+static inline int request_firmware_nowait(
        struct module *module, int uevent,
        const char *name, struct device *device, gfp_t gfp, void *context,
        void (*cont)(const struct firmware *fw, void *context))
@@ -48,10 +45,11 @@ static inline int compat_request_firmware_nowait(
        return -EINVAL;
 }
 
-static inline void compat_release_firmware(const struct firmware *fw)
+static inline void release_firmware(const struct firmware *fw)
 {
 }
 #endif
+#endif
 
 /* mask KEY_RFKILL as RHEL6 backports this */
 #if !defined(KEY_RFKILL)
@@ -81,32 +79,6 @@ static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
        return skb;
 }
 
-#if defined(CONFIG_PCCARD) || defined(CONFIG_PCCARD_MODULE)
-
-#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
-
-#define pcmcia_request_window(a, b, c) pcmcia_request_window(&a, b, c)
-
-#define pcmcia_map_mem_page(a, b, c) pcmcia_map_mem_page(b, c)
-
-/* loop over CIS entries */
-int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code,
-                     int (*loop_tuple) (struct pcmcia_device *p_dev,
-                                        tuple_t *tuple,
-                                        void *priv_data),
-                     void *priv_data);
-
-#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 */
-
 /**
  * list_for_each_entry_continue_rcu - continue iteration over list of given type
  * @pos:       the type * to use as a loop cursor.
@@ -123,8 +95,7 @@ int pccard_loop_tuple(struct pcmcia_socket *s, unsigned int function,
 
 #define sock_recv_ts_and_drops(msg, sk, skb) sock_recv_timestamp(msg, sk, skb)
 
-/* mask pci_pcie_cap as debian squeeze also backports this */
-#define pci_pcie_cap(a) compat_pci_pcie_cap(a)
+#define pci_pcie_cap LINUX_BACKPORT(pci_pcie_cap)
 
 /**
  * pci_pcie_cap - get the saved PCIe capability offset
@@ -142,8 +113,7 @@ static inline int pci_pcie_cap(struct pci_dev *dev)
        return pci_find_capability(dev, PCI_CAP_ID_EXP);
 }
 
-/* mask pci_is_pcie as RHEL6 backports this */
-#define pci_is_pcie(a) compat_pci_is_pcie(a)
+#define pci_is_pcie LINUX_BACKPORT(pci_is_pcie)
 
 /**
  * pci_is_pcie - check if the PCI device is PCI Express capable
@@ -182,6 +152,30 @@ static inline long __must_check IS_ERR_OR_NULL(const void *ptr)
 
 #define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
 
+#ifndef CONFIG_COMPAT_IS_BITMAP
+
+extern void bitmap_set(unsigned long *map, int i, int len);
+extern void bitmap_clear(unsigned long *map, int start, int nr);
+extern unsigned long bitmap_find_next_zero_area(unsigned long *map,
+                                        unsigned long size,
+                                        unsigned long start,
+                                        unsigned int nr,
+                                        unsigned long align_mask);
+
+#endif /* CONFIG_COMPAT_IS_BITMAP */
+
+#ifdef CONFIG_PPC
+#ifndef NUMA_NO_NODE
+#define        NUMA_NO_NODE    (-1)
+#endif
+#endif /* CONFIG_PPC */
+
+#define strim LINUX_BACKPORT(strim)
+extern char *strim(char *);
+
+#define skip_spaces LINUX_BACKPORT(skip_spaces)
+extern char * __must_check skip_spaces(const char *);
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)) */
 
 #endif /* LINUX_26_33_COMPAT_H */
index dc1539d4e7ecefd7f203d92de5552fdda86f17e7..e6445625675c8d98f1bca424643db13b4332c616 100644 (file)
@@ -24,7 +24,10 @@ typedef unsigned int mmc_pm_flag_t;
 extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func);
 extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);
 
-void init_compat_mmc_pm_flags(void);
+#define netdev_uc_count(dev) ((dev)->uc.count)
+#define netdev_uc_empty(dev) ((dev)->uc.count == 0)
+#define netdev_for_each_uc_addr(ha, dev) \
+        list_for_each_entry(ha, &dev->uc.list, list)
 
 #define netdev_mc_count(dev) ((dev)->mc_count)
 #define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0)
@@ -177,6 +180,7 @@ do {                                                                \
 /* source: include/linux/netdevice.h */
 
 
+#define device_lock LINUX_BACKPORT(device_lock)
 static inline void device_lock(struct device *dev)
 {
 #if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP)
@@ -186,6 +190,7 @@ static inline void device_lock(struct device *dev)
 #endif
 }
 
+#define device_trylock LINUX_BACKPORT(device_trylock)
 static inline int device_trylock(struct device *dev)
 {
 #if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP)
@@ -195,6 +200,7 @@ static inline int device_trylock(struct device *dev)
 #endif
 }
 
+#define device_unlock LINUX_BACKPORT(device_unlock)
 static inline void device_unlock(struct device *dev)
 {
 #if defined(CONFIG_PREEMPT_RT) || defined(CONFIG_PREEMPT_DESKTOP)
@@ -213,26 +219,13 @@ static inline void device_unlock(struct device *dev)
 
 #define rcu_dereference_check(p, c) rcu_dereference(p)
 
+#ifndef sysfs_attr_init
 /**
  *     sysfs_attr_init - initialize a dynamically allocated sysfs attribute
  *     @attr: struct attribute to initialize
- *
- *     Initialize a dynamically allocated struct attribute so we can
- *     make lockdep happy.  This is a new requirement for attributes
- *     and initially this is only needed when lockdep is enabled.
- *     Lockdep gives a nice error when your attribute is added to
- *     sysfs if you don't have this.
  */
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
-#define sysfs_attr_init(attr)                          \
-do {                                                   \
-       static struct lock_class_key __key;             \
-                                                       \
-       (attr)->key = &__key;                           \
-} while(0)
-#else
 #define sysfs_attr_init(attr) do {} while(0)
-#endif
+#endif /* sysfs_attr_init */
 
 /**
  *     sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute
@@ -290,12 +283,10 @@ static inline int usb_disable_autosuspend(struct usb_device *udev)
 #ifndef rcu_dereference_protected
 #define rcu_dereference_protected(p, c) (p)
 #endif
-#ifndef rcu_access_pointer
+
 #define rcu_access_pointer(p)   ACCESS_ONCE(p)
-#endif
-#ifndef rcu_dereference_raw
+
 #define rcu_dereference_raw(p) rcu_dereference(p)
-#endif
 
 #define KEY_WPS_BUTTON         0x211   /* WiFi Protected Setup key */
 
@@ -309,11 +300,6 @@ static inline int usb_disable_autosuspend(struct usb_device *udev)
 #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
 #define round_down(x, y) ((x) & ~__round_mask(x, y))
 
-static inline int rcu_read_lock_held(void)
-{
-       return 1;
-}
-
 #ifdef CONFIG_PROVE_LOCKING
 /*
  * Obviously, this is wrong.  But the base kernel will have rtnl_mutex
@@ -326,10 +312,98 @@ static inline int lockdep_rtnl_is_held(void)
 }
 #endif /* #ifdef CONFIG_PROVE_LOCKING */
 
-#else /* Kernels >= 2.6.34 */
+#ifndef NETIF_F_NTUPLE
+#define NETIF_F_NTUPLE         (1 << 27) /* N-tuple filters supported */
+#endif
+
+
+#ifndef PCI_VPD_LRDT
+#define PCI_VPD_LRDT                   0x80    /* Large Resource Data Type */
+#define PCI_VPD_LRDT_ID(x)             (x | PCI_VPD_LRDT)
+
+/* Large Resource Data Type Tag Item Names */
+#define PCI_VPD_LTIN_ID_STRING         0x02    /* Identifier String */
+#define PCI_VPD_LTIN_RO_DATA           0x10    /* Read-Only Data */
+#define PCI_VPD_LTIN_RW_DATA           0x11    /* Read-Write Data */
+
+#define PCI_VPD_LRDT_ID_STRING         PCI_VPD_LRDT_ID(PCI_VPD_LTIN_ID_STRING)
+#define PCI_VPD_LRDT_RO_DATA           PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RO_DATA)
+#define PCI_VPD_LRDT_RW_DATA           PCI_VPD_LRDT_ID(PCI_VPD_LTIN_RW_DATA)
+#define PCI_VPD_LRDT_TAG_SIZE          3
+#define PCI_VPD_SRDT_TAG_SIZE          1
+
+#define PCI_VPD_INFO_FLD_HDR_SIZE      3
+
+/* Small Resource Data Type Tag Item Names */
+#define PCI_VPD_STIN_END               0x78    /* End */
+
+#define PCI_VPD_SRDT_END               PCI_VPD_STIN_END
+
+#define PCI_VPD_SRDT_TIN_MASK          0x78
+#define PCI_VPD_SRDT_LEN_MASK          0x07
+#endif /* PCI_VPD_LRDT */
+
+/**
+ * pci_vpd_info_field_size - Extracts the information field length
+ * @lrdt: Pointer to the beginning of an information field header
+ *
+ * Returns the extracted information field length.
+ */
+#define pci_vpd_info_field_size LINUX_BACKPORT(pci_vpd_info_field_size)
+static inline u8 pci_vpd_info_field_size(const u8 *info_field)
+{
+       return info_field[2];
+}
+
+/**
+ * pci_vpd_lrdt_size - Extracts the Large Resource Data Type length
+ * @lrdt: Pointer to the beginning of the Large Resource Data Type tag
+ *
+ * Returns the extracted Large Resource Data Type length.
+ */
+#define pci_vpd_lrdt_size LINUX_BACKPORT(pci_vpd_lrdt_size)
+static inline u16 pci_vpd_lrdt_size(const u8 *lrdt)
+{
+       return (u16)lrdt[1] + ((u16)lrdt[2] << 8);
+}
 
-static inline void init_compat_mmc_pm_flags(void)
+/**
+ * pci_vpd_find_info_keyword - Locates an information field keyword in the VPD
+ * @buf: Pointer to buffered vpd data
+ * @off: The offset into the buffer at which to begin the search
+ * @len: The length of the buffer area, relative to off, in which to search
+ * @kw: The keyword to search for
+ *
+ * Returns the index where the information field keyword was found or
+ * -ENOENT otherwise.
+ */
+#define pci_vpd_find_info_keyword LINUX_BACKPORT(pci_vpd_find_info_keyword)
+int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off,
+                             unsigned int len, const char *kw);
+
+/**
+ * pci_vpd_find_tag - Locates the Resource Data Type tag provided
+ * @buf: Pointer to buffered vpd data
+ * @off: The offset into the buffer at which to begin the search
+ * @len: The length of the vpd buffer
+ * @rdt: The Resource Data Type to search for
+ *
+ * Returns the index where the Resource Data Type was found or
+ * -ENOENT otherwise.
+ */
+#define pci_vpd_find_tag LINUX_BACKPORT(pci_vpd_find_tag)
+int pci_vpd_find_tag(const u8 *buf, unsigned int off, unsigned int len, u8 rdt);
+
+/**
+ * pci_vpd_srdt_size - Extracts the Small Resource Data Type length
+ * @lrdt: Pointer to the beginning of the Small Resource Data Type tag
+ *
+ * Returns the extracted Small Resource Data Type length.
+ */
+#define pci_vpd_srdt_size LINUX_BACKPORT(pci_vpd_srdt_size)
+static inline u8 pci_vpd_srdt_size(const u8 *srdt)
 {
+       return (*srdt) & PCI_VPD_SRDT_LEN_MASK;
 }
 
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) */
index 0bcc8f6e2f41b21bae9391c913113c96f02865cb..17af44cbe5cbc442091202c49ae6ea902db07c2c 100644 (file)
 #define  SDIO_BUS_ECSI         0x20    /* Enable continuous SPI interrupt */
 #define  SDIO_BUS_SCSI         0x40    /* Support continuous SPI interrupt */
 
+#ifndef  PCI_EXP_LNKSTA_CLS_2_5GB
+#define  PCI_EXP_LNKSTA_CLS_2_5GB 0x01 /* Current Link Speed 2.5GT/s */
+#endif
+
+#ifndef  PCI_EXP_LNKSTA_CLS_5_0GB
+#define  PCI_EXP_LNKSTA_CLS_5_0GB 0x02 /* Current Link Speed 5.0GT/s */
+#endif
+
 /*
  * We cannot backport this guy as the IRQ data structure
  * was modified in the kernel itself to support this. We
  * treat the system as uni-processor in this case.
  */
-#define irq_set_affinity_hint(a, b) compat_irq_set_affinity_hint(a, b)
+#define irq_set_affinity_hint LINUX_BACKPORT(irq_set_affinity_hint)
 
 static inline int irq_set_affinity_hint(unsigned int irq,
                                        const struct cpumask *m)
@@ -37,25 +45,18 @@ static inline wait_queue_head_t *sk_sleep(struct sock *sk)
 
 #define sdio_writeb_readb(func, write_byte, addr, err_ret) sdio_readb(func, addr, err_ret)
 
-/* mask hex_to_bin as RHEL6 backports this */
-#define hex_to_bin(a) compat_hex_to_bin(a)
-
+#define hex_to_bin LINUX_BACKPORT(hex_to_bin)
 int hex_to_bin(char ch);
 
+#define noop_llseek LINUX_BACKPORT(noop_llseek)
 extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
 
 #define pm_qos_request(_qos) pm_qos_requirement(_qos)
 
-/* mask hex_to_bin as RHEL6.3 backports this */
-#define usb_pipe_endpoint(a, b) compat_usb_pipe_endpoint(a, b)
-
-static inline struct usb_host_endpoint *
-usb_pipe_endpoint(struct usb_device *dev, unsigned int pipe)
-{
-       struct usb_host_endpoint **eps;
-       eps = usb_pipein(pipe) ? dev->ep_in : dev->ep_out;
-       return eps[usb_pipeendpoint(pipe)];
-}
+#ifndef __ALIGN_KERNEL
+#define __ALIGN_KERNEL(x, a)           __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
+#define __ALIGN_KERNEL_MASK(x, mask)   (((x) + (mask)) & ~(mask))
+#endif
 
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) */
 
index 84b110d7b613fb579e22d35e738e79b31ff56131..81afff4b462294f7207b2e4c60b7658defeec6c2 100644 (file)
@@ -5,16 +5,15 @@
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
 
-#include <linux/usb.h>
-#include <pcmcia/cistpl.h>
-#include <pcmcia/ds.h>
 #include <linux/pm_qos_params.h>
 #include <linux/smp_lock.h>
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
+#ifndef kparam_block_sysfs_write
 #define kparam_block_sysfs_write(a)
+#endif
+#ifndef kparam_unblock_sysfs_write
 #define kparam_unblock_sysfs_write(a)
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
+#endif
 
 /* mask va_format as RHEL6 backports this */
 #define va_format compat_va_format
@@ -26,45 +25,6 @@ struct va_format {
 
 #define device_rename(dev, new_name) device_rename(dev, (char *)new_name)
 
-#ifdef CONFIG_COMPAT_USB_URB_THREAD_FIX
-#define usb_scuttle_anchored_urbs(anchor)      compat_usb_scuttle_anchored_urbs(anchor)
-#define usb_get_from_anchor(anchor)    compat_usb_get_from_anchor(anchor)
-#define usb_unlink_anchored_urbs(anchor)       compat_usb_unlink_anchored_urbs(anchor)
-
-extern void compat_usb_unlink_anchored_urbs(struct usb_anchor *anchor);
-extern struct urb *compat_usb_get_from_anchor(struct usb_anchor *anchor);
-extern void compat_usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
-#endif
-
-#ifndef CONFIG_COMPAT_RHEL_6_4
-/**
- * pcmcia_read_config_byte() - read a byte from a card configuration register
- *
- * pcmcia_read_config_byte() reads a byte from a configuration register in
- * attribute memory.
- */
-static inline int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val)
-{
-        int ret;
-        conf_reg_t reg = { 0, CS_READ, where, 0 };
-        ret = pcmcia_access_configuration_register(p_dev, &reg);
-        *val = reg.Value;
-        return ret;
-}
-
-/**
- * pcmcia_write_config_byte() - write a byte to a card configuration register
- *
- * pcmcia_write_config_byte() writes a byte to a configuration register in
- * attribute memory.
- */
-static inline int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val)
-{
-       conf_reg_t reg = { 0, CS_WRITE, where, val };
-       return pcmcia_access_configuration_register(p_dev, &reg);
-}
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
-
 struct pm_qos_request_list {
        u32 qos;
        void *request;
@@ -139,11 +99,10 @@ static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
        return false;
 }
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
+#define skb_tx_timestamp LINUX_BACKPORT(skb_tx_timestamp)
 static inline void skb_tx_timestamp(struct sk_buff *skb)
 {
 }
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
 
 /*
  * System-wide workqueues which are always present.
@@ -160,45 +119,51 @@ static inline void skb_tx_timestamp(struct sk_buff *skb)
  * item is never executed in parallel by multiple CPUs.  Queue
  * flushing might take relatively long.
  */
+#define system_wq LINUX_BACKPORT(system_wq)
 extern struct workqueue_struct *system_wq;
+#define system_long_wq LINUX_BACKPORT(system_long_wq)
 extern struct workqueue_struct *system_long_wq;
+#define system_nrt_wq LINUX_BACKPORT(system_nrt_wq)
 extern struct workqueue_struct *system_nrt_wq;
 
-void compat_system_workqueue_create(void);
-void compat_system_workqueue_destroy(void);
-
-int compat_schedule_work(struct work_struct *work);
-int compat_schedule_work_on(int cpu, struct work_struct *work);
-int compat_schedule_delayed_work(struct delayed_work *dwork,
-                                unsigned long delay);
-int compat_schedule_delayed_work_on(int cpu,
-                                   struct delayed_work *dwork,
-                                   unsigned long delay);
-void compat_flush_scheduled_work(void);
-
+int backport_system_workqueue_create(void);
+void backport_system_workqueue_destroy(void);
+
+#define schedule_work LINUX_BACKPORT(schedule_work)
+int schedule_work(struct work_struct *work);
+#define schedule_work_on LINUX_BACKPORT(schedule_work_on)
+int schedule_work_on(int cpu, struct work_struct *work);
+#define schedule_delayed_work LINUX_BACKPORT(schedule_delayed_work)
+int schedule_delayed_work(struct delayed_work *dwork,
+                         unsigned long delay);
+#define schedule_delayed_work_on LINUX_BACKPORT(schedule_delayed_work_on)
+int schedule_delayed_work_on(int cpu,
+                            struct delayed_work *dwork,
+                            unsigned long delay);
+#define flush_scheduled_work LINUX_BACKPORT(flush_scheduled_work)
+void flush_scheduled_work(void);
+
+#ifndef CONFIG_COMPAT_IS_WORK_BUSY
 enum {
        /* bit mask for work_busy() return values */
        WORK_BUSY_PENDING       = 1 << 0,
        WORK_BUSY_RUNNING       = 1 << 1,
 };
+#endif
 
+#define work_busy LINUX_BACKPORT(work_busy)
 extern unsigned int work_busy(struct work_struct *work);
 
-#define schedule_work(work) compat_schedule_work(work)
-#define schedule_work_on(cpu, work) compat_schedule_work_on(cpu, work)
-#define schedule_delayed_work(dwork, delay) compat_schedule_delayed_work(dwork, delay)
-#define schedule_delayed_work_on(cpu, dwork, delay) compat_schedule_delayed_work_on(cpu, dwork, delay)
-#define flush_scheduled_work(a) compat_flush_scheduled_work(a)
-
 #define br_port_exists(dev)    (dev->br_port)
 
 #else
 
-static inline void compat_system_workqueue_create(void)
+static inline int backport_system_workqueue_create(void)
 {
+       return 0;
 }
 
-static inline void compat_system_workqueue_destroy(void)
+static inline void backport_system_workqueue_destroy(void)
 {
 }
 
@@ -215,6 +180,10 @@ static inline void compat_system_workqueue_destroy(void)
  */
 #define br_port_exists(dev)    (dev->priv_flags & IFF_BRIDGE_PORT)
 
+#ifndef __rcu
+#define __rcu
+#endif
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */
 
 #endif /* LINUX_26_36_COMPAT_H */
index 6c92b626ae7b24850a118389621fcad638d84a8b..bc1774b2b2b5628e1ce3ef928f068feec84d07c4 100644 (file)
@@ -8,6 +8,8 @@
 #include <linux/skbuff.h>
 #include <linux/leds.h>
 #include <linux/in.h>
+#include <linux/rcupdate.h>
+#include <linux/netdevice.h>
 #include <linux/errno.h>
 
 static inline int proto_ports_offset(int proto)
@@ -27,11 +29,30 @@ static inline int proto_ports_offset(int proto)
        }
 }
 
+/* supports eipoib flags, priv_flags is short till that version */
+#define CONFIG_COMPAT_IFF_EIPOIB_PIF 0x8000 /*== IFF_OVS_DATAPATH*/
+#define CONFIG_COMPAT_IFF_EIPOIB_VIF 0x4000 /*IFF_MACVLAN_PORT*/
+
+/* Definitions for tx_flags in struct skb_shared_info */
+enum {
+       /* generate hardware time stamp */
+       SKBTX_HW_TSTAMP = 1 << 0,
+
+       /* generate software time stamp */
+       SKBTX_SW_TSTAMP = 1 << 1,
+
+       /* device driver is going to provide hardware time stamp */
+       SKBTX_IN_PROGRESS = 1 << 2,
+
+       /* ensure the originating sk reference is available on driver level */
+       SKBTX_DRV_NEEDS_SK_REF = 1 << 3,
+};
+
+
 #define SDIO_CLASS_BT_AMP      0x09    /* Type-A Bluetooth AMP interface */
 
 #define VLAN_N_VID              4096
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
 /*
  *     netif_set_real_num_rx_queues - set actual number of RX queues used
  *     @dev: Network device
@@ -43,13 +64,15 @@ static inline int proto_ports_offset(int proto)
  *     possible. Hence adding this function to avoid changes in driver source
  *     code and making this function to always return success.
  */
+/* mask netif_set_real_num_rx_queues as RHEL6.4 backports this */
+#define netif_set_real_num_rx_queues(a, b) compat_netif_set_real_num_rx_queues(a, b)
 static inline int netif_set_real_num_rx_queues(struct net_device *dev,
         unsigned int rxq)
 {
     return 0;
 }
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
 
+#define net_ns_type_operations LINUX_BACKPORT(net_ns_type_operations)
 extern struct kobj_ns_type_operations net_ns_type_operations;
 
 /* mask skb_checksum_none_assert as RHEL6 backports this */
@@ -70,10 +93,6 @@ static inline void skb_checksum_none_assert(struct sk_buff *skb)
 #endif
 }
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
-#define pcmcia_enable_device(link)     pcmcia_request_configuration(link, &link->conf)
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
-
 #include <net/genetlink.h>
 
 struct compat_genl_info {
@@ -140,6 +159,7 @@ int genl_unregister_family(struct genl_family *family);
 #define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp)
 
 
+#define led_blink_set LINUX_BACKPORT(led_blink_set)
 extern void led_blink_set(struct led_classdev *led_cdev,
                          unsigned long *delay_on,
                          unsigned long *delay_off);
@@ -155,15 +175,26 @@ extern void compat_led_brightness_set(struct led_classdev *led_cdev,
 
 #define netdev_refcnt_read(a) atomic_read(&a->refcnt)
 
-/* mask vzalloc as RHEL6 backports this */
-#define vzalloc(a) compat_vzalloc(a)
+#define vzalloc LINUX_BACKPORT(vzalloc)
+#define vzalloc_node LINUX_BACKPORT(vzalloc_node)
 
 extern void *vzalloc(unsigned long size);
+extern void *vzalloc_node(unsigned long size, int node);
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
+#ifndef rtnl_dereference
 #define rtnl_dereference(p)                                     \
         rcu_dereference_protected(p, lockdep_rtnl_is_held())
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
+#endif
+
+#ifndef rcu_dereference_protected
+#define rcu_dereference_protected(p, c) \
+               rcu_dereference((p))
+#endif
+
+#ifndef rcu_dereference_bh
+#define rcu_dereference_bh(p) \
+               rcu_dereference((p))
+#endif
 
 /**
  * RCU_INIT_POINTER() - initialize an RCU protected pointer
@@ -174,6 +205,7 @@ extern void *vzalloc(unsigned long size);
 #define RCU_INIT_POINTER(p, v) \
                p = (typeof(*v) __force __rcu *)(v)
 
+#define skb_has_frag_list LINUX_BACKPORT(skb_has_frag_list)
 static inline bool skb_has_frag_list(const struct sk_buff *skb)
 {
        return skb_shinfo(skb)->frag_list != NULL;
@@ -195,6 +227,25 @@ enum additional_ethtool_flags {
     ETH_FLAG_RXVLAN         = (1 << 8),     /* RX VLAN offload enabled */
 };
 
+extern void             unregister_netdevice_queue(struct net_device *dev,
+                                                  struct list_head *head);
+
+#ifndef max3
+#define max3(x, y, z) ({                       \
+       typeof(x) _max1 = (x);                  \
+       typeof(y) _max2 = (y);                  \
+       typeof(z) _max3 = (z);                  \
+       (void) (&_max1 == &_max2);              \
+       (void) (&_max1 == &_max3);              \
+       _max1 > _max2 ? (_max1 > _max3 ? _max1 : _max3) : \
+               (_max2 > _max3 ? _max2 : _max3); })
+#endif
+
+#ifndef CONFIG_COMPAT_XPRTRDMA_NEEDED
+struct rpc_xprt *      xprt_alloc(int size, int max_req);
+void                   xprt_free(struct rpc_xprt *);
+#endif /* CONFIG_COMPAT_XPRTRDMA_NEEDED */
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */
 
 #endif /* LINUX_26_37_COMPAT_H */
index afef7b6fa42bb7064f40d52ce4c82c1ff3919290..3ac57fb498313883a2617ac06d142584b66c633a 100644 (file)
 #include <linux/etherdevice.h>
 #include <net/sch_generic.h>
 
+#define __DEFERRED_WORK_INITIALIZER(n, f) {                    \
+       .work = __WORK_INITIALIZER((n).work, (f)),              \
+       .timer = TIMER_DEFERRED_INITIALIZER(NULL, 0, 0),        \
+       }
+
+#define DECLARE_DEFERRED_WORK(n, f)                            \
+       struct delayed_work n = __DEFERRED_WORK_INITIALIZER(n, f)
+
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30))
 static inline void bstats_update(struct gnet_stats_basic_packed *bstats,
                                 const struct sk_buff *skb)
@@ -55,11 +63,14 @@ struct ewma {
        unsigned long weight;
 };
 
+#define ewma_init LINUX_BACKPORT(ewma_init)
 extern void ewma_init(struct ewma *avg, unsigned long factor,
                      unsigned long weight);
 
+#define ewma_add LINUX_BACKPORT(ewma_add)
 extern struct ewma *ewma_add(struct ewma *avg, unsigned long val);
 
+#define ewma_read LINUX_BACKPORT(ewma_read)
 /**
  * ewma_read() - Get average value
  * @avg: Average structure
@@ -72,15 +83,16 @@ static inline unsigned long ewma_read(const struct ewma *avg)
 }
 
 #define pr_warn pr_warning
-
-#ifndef CONFIG_COMPAT_RHEL_6_4
+#ifndef create_freezable_workqueue
 #define create_freezable_workqueue create_freezeable_workqueue
+#endif
 
+/* mask skb_checksum_start_offset as RHEL6.4 backports this */
+#define skb_checksum_start_offset(a) compat_skb_checksum_start_offset(a)
 static inline int skb_checksum_start_offset(const struct sk_buff *skb)
 {
        return skb->csum_start - skb_headroom(skb);
 }
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
 
 /* from include/linux/printk.h */ 
 #define pr_emerg_once(fmt, ...)                                        \
@@ -120,6 +132,7 @@ static inline int skb_checksum_start_offset(const struct sk_buff *skb)
  *
  * Return true if the address is a unicast address.
  */
+#define is_unicast_ether_addr LINUX_BACKPORT(is_unicast_ether_addr)
 static inline int is_unicast_ether_addr(const u8 *addr)
 {
        return !is_multicast_ether_addr(addr);
index 24f15363f23dd38c03ddb37525112d7b6d6f0d7b..56ebea44353a9d60cf730e4ac78dddfff71d594b 100644 (file)
 #define tiocmset(tty, set, clear) tiocmset(tty, NULL, set, clear)
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+#define tty_set_termios LINUX_BACKPORT(tty_set_termios)
 extern int tty_set_termios(struct tty_struct *tty, struct ktermios *kt);
 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)) */
 
+#define netif_is_bond_slave LINUX_BACKPORT(netif_is_bond_slave)
 static inline int netif_is_bond_slave(struct net_device *dev)
 {
        return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
 }
-
-#ifndef CONFIG_COMPAT_RHEL_6_4
 static inline int irq_set_irq_wake(unsigned int irq, unsigned int on)
 {
        return set_irq_wake(irq, on);
@@ -39,12 +39,12 @@ static inline int irq_set_chip_data(unsigned int irq, void *data)
 {
        return set_irq_chip_data(irq, data);
 }
+#ifndef irq_set_irq_type
 static inline int irq_set_irq_type(unsigned int irq, unsigned int type)
 {
        return set_irq_type(irq, type);
 }
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
-
+#endif
 static inline int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry)
 {
        return set_irq_msi(irq, entry);
@@ -106,13 +106,13 @@ static inline struct msi_desc *irq_desc_get_msi_desc(struct irq_desc *desc)
 }
 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) */
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
+#ifndef CONFIG_COMPAT_IS_KSTRTOX
 /* 
  * kstrto* was included in kernel 2.6.38.4 and causes conflicts with the
  * version included in compat-wireless. We use strict_strtol to check if
  * kstrto* is already available.
  */
-#ifndef strict_strtol
+#ifndef strict_strtoull
 /* Internal, do not use. */
 int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res);
 int __must_check _kstrtol(const char *s, unsigned int base, long *res);
@@ -173,7 +173,9 @@ int __must_check kstrtos16(const char *s, unsigned int base, s16 *res);
 int __must_check kstrtou8(const char *s, unsigned int base, u8 *res);
 int __must_check kstrtos8(const char *s, unsigned int base, s8 *res);
 #endif /* ifndef strict_strtol */
+#endif /* ifndef CONFIG_COMPAT_IS_KSTRTOX */
 
+#ifndef CONFIG_COMPAT_IS_BITOP
 static inline int test_bit_le(int nr, const void *addr)
 {
        return test_bit(nr ^ BITOP_LE_SWIZZLE, addr);
@@ -188,7 +190,31 @@ static inline void __clear_bit_le(int nr, void *addr)
 {
        __clear_bit(nr ^ BITOP_LE_SWIZZLE, addr);
 }
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
+#endif
+
+#ifndef __ASSEMBLY__
+#define PTR_RET LINUX_BACKPORT(PTR_RET)
+static inline int __must_check PTR_RET(const void *ptr)
+{
+       if (IS_ERR(ptr))
+               return PTR_ERR(ptr);
+       else
+               return 0;
+}
+#endif
+
+#ifndef IEEE_8021QAZ_TSA_STRICT
+#define IEEE_8021QAZ_TSA_STRICT         0
+#endif
+#ifndef IEEE_8021QAZ_TSA_CB_SHAPER
+#define IEEE_8021QAZ_TSA_CB_SHAPER      1
+#endif
+#ifndef IEEE_8021QAZ_TSA_ETS
+#define IEEE_8021QAZ_TSA_ETS            2
+#endif
+#ifndef IEEE_8021QAZ_TSA_VENDOR
+#define IEEE_8021QAZ_TSA_VENDOR         255
+#endif
 
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)) */
 
index 6d6624b0998fd764e22d27dcff60e5d84ce1453d..0608ce6f82d5c3d7f82f7d8797fa09007742cf46 100644 (file)
@@ -4,14 +4,19 @@
 #define LINUX_BACKPORT(__sym) backport_ ##__sym
 
 #include <linux/version.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0))
+#include <linux/kconfig.h>
+#include <linux/if.h>
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
 #include <linux/kconfig.h>
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,33))
 #include <generated/autoconf.h>
 #else
 #include <linux/autoconf.h>
 #endif
+#include <linux/compat_autoconf.h>
 #include <linux/init.h>
+#include <linux/uidgid.h>
 
 /*
  * The define overwriting module_init is based on the original module_init
  * To the call to the initfn we added the symbol dependency on compat
  * to make sure that compat.ko gets loaded for any compat modules.
  */
-void compat_dependency_symbol(void);
+void backport_dependency_symbol(void);
 
 #undef module_init
 #define module_init(initfn)                                            \
-       static int __init __init_compat(void)                           \
+       static int __init __init_backport(void)                         \
        {                                                               \
-               compat_dependency_symbol();                             \
+               backport_dependency_symbol();                           \
                return initfn();                                        \
        }                                                               \
-       int init_module(void) __attribute__((alias("__init_compat")));
+       int init_module(void) __attribute__((alias("__init_backport")));
 
 /*
  * Each compat file represents compatibility code for new kernel
@@ -67,7 +72,6 @@ void compat_dependency_symbol(void);
 #include <linux/compat-3.6.h>
 #include <linux/compat-3.7.h>
 #include <linux/compat-3.10.h>
-#include <linux/compat-3.11.h>
 #include <linux/compat-3.12.h>
 
 #endif /* LINUX_26_COMPAT_H */
index f3079748e7d67f2ecc12e4490a7bf6246d5b5c0d..c22cae694add4f21ac05f5981af3cee904e73e82 100644 (file)
@@ -48,9 +48,10 @@ struct bcma_device_id {
 #define BCMA_ANY_CLASS         0xFF
 #endif /* BCMA_CORE */
 
+#define mac_pton LINUX_BACKPORT(mac_pton)
 int mac_pton(const char *s, u8 *mac);
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
+#ifndef CONFIG_COMPAT_IS_KSTRTOX
 int __must_check kstrtoull_from_user(const char __user *s, size_t count, unsigned int base, unsigned long long *res);
 int __must_check kstrtoll_from_user(const char __user *s, size_t count, unsigned int base, long long *res);
 int __must_check kstrtoul_from_user(const char __user *s, size_t count, unsigned int base, unsigned long *res);
@@ -81,7 +82,7 @@ static inline int __must_check kstrtos32_from_user(const char __user *s, size_t
 {
        return kstrtoint_from_user(s, count, base, res);
 }
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
+#endif
 
 #ifndef kfree_rcu
 /* 
@@ -129,7 +130,7 @@ static inline int __must_check kstrtos32_from_user(const char __user *s, size_t
 
 #endif
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
+#ifndef CONFIG_COMPAT_IS_PHYS_ID_STATE
 /*
  * enum ethtool_phys_id_state - indicator state for physical identification
  * @ETHTOOL_ID_INACTIVE: Physical ID indicator should be deactivated
@@ -145,7 +146,11 @@ enum ethtool_phys_id_state {
     ETHTOOL_ID_ON,
     ETHTOOL_ID_OFF
 };
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
+#endif
+
+#ifndef NETLINK_RDMA
+#define NETLINK_RDMA           20
+#endif
 
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,0)) */
 
index a4b0734592a7ca76d510e25b957767d645d81581..0d22f7b2c1dd651b446ba71f266d8a0a760e0e5e 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/idr.h>
 #include <net/dst.h>
 
-#ifndef CONFIG_COMPAT_SLES_11_3
+#ifndef CONFIG_COMPAT_DST_NEIGHBOUR
 static inline struct neighbour *dst_get_neighbour(struct dst_entry *dst)
 {
        return dst->neighbour;
@@ -26,7 +26,7 @@ static inline struct neighbour *dst_get_neighbour_raw(struct dst_entry *dst)
 {
        return rcu_dereference_raw(dst->neighbour);
 }
-#endif /* CONFIG_COMPAT_SLES_11_3 */
+#endif /* CONFIG_COMPAT_DST_NEIGHBOUR */
 
 /* Backports 56f8a75c */
 static inline bool ip_is_fragment(const struct iphdr *iph)
@@ -47,7 +47,7 @@ static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev
        return skb;
 }
 
-#ifndef NEED_MIN_DUMP_ALLOC_ARG
+#if ! defined(CONFIG_COMPAT_MIN_DUMP_ALLOC_ARG) && ! defined(CONFIG_COMPAT_NETLINK_3_7)
 #include <linux/netlink.h>
 /* remove last arg */
 #define netlink_dump_start(a, b, c, d, e, f) netlink_dump_start(a, b, c, d, e)
index 719ab712fb049bf0c34f16825f4f579b05aefb02..528a53952cba49421cff21ac5300f71e5c0ea3ec 100644 (file)
@@ -4,13 +4,24 @@
 #include <linux/version.h>
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
+#include <linux/random.h>
 
-#include <linux/if_vlan.h>
-#define __vlan_hwaccel_put_tag(a, b, c) __vlan_hwaccel_put_tag(a, c)
-
-#include <linux/netdev_features.h>
+#ifndef NETIF_F_HW_VLAN_CTAG_RX
 #define NETIF_F_HW_VLAN_CTAG_RX NETIF_F_HW_VLAN_RX
+#endif
+
+#ifndef NETIF_F_HW_VLAN_CTAG_TX
+#define NETIF_F_HW_VLAN_CTAG_TX NETIF_F_HW_VLAN_TX
+#endif
+
+#ifndef NETIF_F_HW_VLAN_CTAG_FILTER
+#define NETIF_F_HW_VLAN_CTAG_FILTER NETIF_F_HW_VLAN_FILTER
+#endif
+
+#ifndef prandom_u32
+#define prandom_u32() random32()
+#endif
 
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)) */
 
 #endif /* LINUX_3_10_COMPAT_H */
index 4890819114eed19f8474cd6eb6a48b4e6f5daef3..a9ff4b59b3103bd40857a24a8bc5fb587724b9eb 100644 (file)
@@ -5,14 +5,10 @@
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0))
 
-#define PTR_ERR_OR_ZERO LINUX_BACKPORT(PTR_ERR_OR_ZERO)
-static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr)
-{
-       if (IS_ERR(ptr))
-               return PTR_ERR(ptr);
-       else
-               return 0;
-}
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0) */
+#ifndef PTR_ERR_OR_ZERO
+#define PTR_ERR_OR_ZERO(p) PTR_RET(p)
+#endif
+
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)) */
 
 #endif /* LINUX_3_12_COMPAT_H */
index e9bd8115b65829c1c63a6a2989c738c66a95274d..3f04cb460f3699a4cf7a96db135d8fc3f8c27889 100644 (file)
 extern int __ethtool_get_settings(struct net_device *dev,
                                  struct ethtool_cmd *cmd);
 
-#ifndef CONFIG_COMPAT_SLES_11_3
-#ifdef CONFIG_COMPAT_SKB_FRAG_NEEDED
-
 /**
  * skb_frag_page - retrieve the page refered to by a paged fragment
  * @frag: the paged fragment
  *
  * Returns the &struct page associated with @frag.
  */
+#define skb_frag_page LINUX_BACKPORT(skb_frag_page)
 static inline struct page *skb_frag_page(const skb_frag_t *frag)
 {
        return frag->page;
@@ -39,6 +37,7 @@ static inline struct page *skb_frag_page(const skb_frag_t *frag)
  *
  * Sets the fragment @frag to contain @page.
  */
+#define __skb_frag_set_page LINUX_BACKPORT(__skb_frag_set_page)
 static inline void __skb_frag_set_page(skb_frag_t *frag, struct page *page)
 {
        frag->page = page;
@@ -52,6 +51,7 @@ static inline void __skb_frag_set_page(skb_frag_t *frag, struct page *page)
  *
  * Sets the @f'th fragment of @skb to contain @page.
  */
+#define skb_frag_set_page LINUX_BACKPORT(skb_frag_set_page)
 static inline void skb_frag_set_page(struct sk_buff *skb, int f,
                                     struct page *page)
 {
@@ -65,6 +65,7 @@ static inline void skb_frag_set_page(struct sk_buff *skb, int f,
  * Returns the address of the data within @frag. Checks that the page
  * is mapped and returns %NULL otherwise.
  */
+#define skb_frag_address_safe LINUX_BACKPORT(skb_frag_address_safe)
 static inline void *skb_frag_address_safe(const skb_frag_t *frag)
 {
        void *ptr = page_address(skb_frag_page(frag));
@@ -85,6 +86,7 @@ static inline void *skb_frag_address_safe(const skb_frag_t *frag)
  *
  * Maps the page associated with @frag to @device.
  */
+#define skb_frag_dma_map LINUX_BACKPORT(skb_frag_dma_map)
 static inline dma_addr_t skb_frag_dma_map(struct device *dev,
                                          const skb_frag_t *frag,
                                          size_t offset, size_t size,
@@ -94,48 +96,51 @@ static inline dma_addr_t skb_frag_dma_map(struct device *dev,
                            frag->page_offset + offset, size, dir);
 }
 
+/**
+ * __skb_frag_unref - release a reference on a paged fragment.
+ * @frag: the paged fragment
+ *
+ * Releases a reference on the paged fragment @frag.
+ */
+#define __skb_frag_unref LINUX_BACKPORT(__skb_frag_unref)
+static inline void __skb_frag_unref(skb_frag_t *frag)
+{
+       put_page(skb_frag_page(frag));
+}
+
 #define ETH_P_TDLS     0x890D          /* TDLS */
 
+#define skb_frag_size LINUX_BACKPORT(skb_frag_size)
 static inline unsigned int skb_frag_size(const skb_frag_t *frag)
 {
        return frag->size;
 }
 
+#define skb_frag_size_set LINUX_BACKPORT(skb_frag_size_set)
 static inline void skb_frag_size_set(skb_frag_t *frag, unsigned int size)
 {
        frag->size = size;
 }
 
+#define skb_frag_size_add LINUX_BACKPORT(skb_frag_size_add)
 static inline void skb_frag_size_add(skb_frag_t *frag, int delta)
 {
        frag->size += delta;
 }
 
+#define skb_frag_size_sub LINUX_BACKPORT(skb_frag_size_sub)
 static inline void skb_frag_size_sub(skb_frag_t *frag, int delta)
 {
        frag->size -= delta;
 }
 
-/**
- * __skb_frag_unref - release a reference on a paged fragment.
- * @frag: the paged fragment
- *
- * Releases a reference on the paged fragment @frag.
- */
-static inline void __skb_frag_unref(skb_frag_t *frag)
-{
-       put_page(skb_frag_page(frag));
-}
-
-#endif /* CONFIG_COMPAT_SKB_FRAG_NEEDED */
-
+#define hex_byte_pack LINUX_BACKPORT(hex_byte_pack)
 static inline char *hex_byte_pack(char *buf, u8 byte)
 {
        *buf++ = hex_asc_hi(byte);
        *buf++ = hex_asc_lo(byte);
        return buf;
 }
-#endif /* CONFIG_COMPAT_SLES_11_3 */
 
 /* module_platform_driver() - Helper macro for drivers that don't do
  * anything special in module init/exit.  This eliminates a lot of
@@ -146,7 +151,7 @@ static inline char *hex_byte_pack(char *buf, u8 byte)
         module_driver(__platform_driver, platform_driver_register, \
                         platform_driver_unregister)
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
+#define dma_zalloc_coherent LINUX_BACKPORT(dma_zalloc_coherent)
 static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
                                        dma_addr_t *dma_handle, gfp_t flag)
 {
@@ -155,8 +160,8 @@ static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
                memset(ret, 0, size);
        return ret;
 }
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
 
+#define __netdev_printk LINUX_BACKPORT(__netdev_printk)
 extern int __netdev_printk(const char *level, const struct net_device *dev,
                           struct va_format *vaf);
 
index e3c6336b3e7dee7036f69a81a7100e292e06dcf6..8c21bc9eabcee550e1cffd0ec687bdf18b0e0199 100644 (file)
@@ -30,18 +30,13 @@ static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz)
 extern struct sk_buff *__pskb_copy(struct sk_buff *skb,
                                   int headroom, gfp_t gfp_mask);
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
-static inline void skb_complete_wifi_ack(struct sk_buff *skb, bool acked)
-{
-       WARN_ON(1);
-}
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
-
 #define NL80211_FEATURE_SK_TX_STATUS 0
 
+#ifndef CONFIG_COMPAT_NETDEV_FEATURES
 typedef u32 netdev_features_t;
+#endif /* CONFIG_COMPAT_NETDEV_FEATURES */
 
-#ifndef CONFIG_COMPAT_SLES_11_3
+#ifndef module_driver
 /* source include/linux/device.h */
 /**
  * module_driver() - Helper macro for drivers that don't do anything
@@ -63,6 +58,7 @@ static void __exit __driver##_exit(void) \
        __unregister(&(__driver)); \
 } \
 module_exit(__driver##_exit);
+#endif
 
 /* source include/linux/usb.h */
 /**
@@ -99,7 +95,10 @@ static inline void netdev_tx_reset_queue(struct netdev_queue *q)
 }
 
 #define NETIF_F_LOOPBACK       (1 << 31) /* Enable loopback */
-#endif /* CONFIG_COMPAT_SLES_11_3 */
+
+#ifndef NETIF_F_RXCSUM
+#define NETIF_F_RXCSUM         (1 << 29)
+#endif
 
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)) */
 
index 0a42086f7cce5c1ed3e6f13b26fc867cd9e7ce6b..a16e216763e8d3258eea735269f6a7170d1fb628 100644 (file)
@@ -8,10 +8,17 @@
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 
-#ifndef CONFIG_COMPAT_SLES_11_3
-extern int simple_open(struct inode *inode, struct file *file);
+#ifndef VM_NODUMP
+#define VM_NODUMP      0x04000000      /* Do not include in the core dump */
+#endif
+
+#ifndef EPROBE_DEFER
+#define EPROBE_DEFER    517     /* Driver requests probe retry */
 #endif
 
+#define simple_open LINUX_BACKPORT(simple_open)
+extern int simple_open(struct inode *inode, struct file *file);
+
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28))
 #define skb_add_rx_frag(skb, i, page, off, size, truesize) \
        v2_6_28_skb_add_rx_frag(skb, i, page, off, size)
@@ -28,6 +35,7 @@ extern int simple_open(struct inode *inode, struct file *file);
 #endif
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12))
+#define eth_hw_addr_random LINUX_BACKPORT(eth_hw_addr_random)
 static inline void eth_hw_addr_random(struct net_device *dev)
 {
 #error eth_hw_addr_random() needs to be implemented for < 2.6.12
@@ -35,6 +43,7 @@ static inline void eth_hw_addr_random(struct net_device *dev)
 #else  /* kernels >= 2.6.12 */
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31))
+#define eth_hw_addr_random LINUX_BACKPORT(eth_hw_addr_random)
 static inline void eth_hw_addr_random(struct net_device *dev)
 {
        get_random_bytes(dev->dev_addr, ETH_ALEN);
@@ -51,21 +60,31 @@ static inline void eth_hw_addr_random(struct net_device *dev)
 #define NET_ADDR_RANDOM                1       /* address is generated randomly */
 #define NET_ADDR_STOLEN                2       /* address is stolen from other device */
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
+#ifndef CONFIG_COMPAT_ETH_HW_ADDR_RANDOM
+#ifndef CONFIG_COMPAT_DEV_HW_ADDR_RANDOM
+#define eth_hw_addr_random LINUX_BACKPORT(eth_hw_addr_random)
 static inline void eth_hw_addr_random(struct net_device *dev)
 {
        random_ether_addr(dev->dev_addr);
 }
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
+#else
+#define eth_hw_addr_random LINUX_BACKPORT(eth_hw_addr_random)
+static inline void eth_hw_addr_random(struct net_device *dev)
+{
+       dev_hw_addr_random(dev, dev->dev_addr);
+}
+#endif
+#endif
 
-#else /* 2.6.36 and on */
-#ifndef CONFIG_COMPAT_SLES_11_3
+#elif (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+#ifndef CONFIG_COMPAT_ETH_HW_ADDR_RANDOM
+#define eth_hw_addr_random LINUX_BACKPORT(eth_hw_addr_random)
 static inline void eth_hw_addr_random(struct net_device *dev)
 {
        dev_hw_addr_random(dev, dev->dev_addr);
 }
-#endif /* CONFIG_COMPAT_SLES_11_3 */
-#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */
+#endif
+#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36)) */
 
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) */
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)) */
index 72f414bbbb25b27dd65bbea4e00b4ad3ee244d95..b20116ff03d246eb5851d5da11a6d08f9616e1f7 100644 (file)
@@ -8,97 +8,6 @@
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0))
 
-/*
- * This backports:
- *
- * commit f56f821feb7b36223f309e0ec05986bb137ce418
- * Author: Daniel Vetter <daniel.vetter@ffwll.ch>
- * Date:   Sun Mar 25 19:47:41 2012 +0200
- *
- *     mm: extend prefault helpers to fault in more than PAGE_SIZE
- *
- * The new functions are used by drm/i915 driver.
- *
- */
-
-#if (!defined(CONFIG_COMPAT_RHEL_6_4) && !defined(CONFIG_COMPAT_SLES_11_3))
-static inline int fault_in_multipages_writeable(char __user *uaddr, int size)
-{
-        int ret = 0;
-        char __user *end = uaddr + size - 1;
-
-        if (unlikely(size == 0))
-                return ret;
-
-        /*
-         * Writing zeroes into userspace here is OK, because we know that if
-         * the zero gets there, we'll be overwriting it.
-         */
-        while (uaddr <= end) {
-                ret = __put_user(0, uaddr);
-                if (ret != 0)
-                        return ret;
-                uaddr += PAGE_SIZE;
-        }
-
-        /* Check whether the range spilled into the next page. */
-        if (((unsigned long)uaddr & PAGE_MASK) ==
-                        ((unsigned long)end & PAGE_MASK))
-                ret = __put_user(0, end);
-
-        return ret;
-}
-
-static inline int fault_in_multipages_readable(const char __user *uaddr,
-                                               int size)
-{
-        volatile char c;
-        int ret = 0;
-        const char __user *end = uaddr + size - 1;
-
-        if (unlikely(size == 0))
-                return ret;
-
-        while (uaddr <= end) {
-                ret = __get_user(c, uaddr);
-                if (ret != 0)
-                        return ret;
-                uaddr += PAGE_SIZE;
-        }
-
-        /* Check whether the range spilled into the next page. */
-        if (((unsigned long)uaddr & PAGE_MASK) ==
-                        ((unsigned long)end & PAGE_MASK)) {
-                ret = __get_user(c, end);
-                (void)c;
-        }
-
-        return ret;
-}
-#endif /* (!defined(CONFIG_COMPAT_RHEL_6_4) && !defined(CONFIG_COMPAT_SLES_11_3)) */
-
-/* switcheroo is available on >= 2.6.34 */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
-#ifndef CONFIG_COMPAT_SLES_11_3
-#include <linux/vga_switcheroo.h>
-/*
- * This backports:
- *
- *   From 26ec685ff9d9c16525d8ec4c97e52fcdb187b302 Mon Sep 17 00:00:00 2001
- *   From: Takashi Iwai <tiwai@suse.de>
- *   Date: Fri, 11 May 2012 07:51:17 +0200
- *   Subject: [PATCH] vga_switcheroo: Introduce struct vga_switcheroo_client_ops
- *
- */
-
-struct vga_switcheroo_client_ops {
-    void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state);
-    void (*reprobe)(struct pci_dev *dev);
-    bool (*can_switch)(struct pci_dev *dev);
-};
-#endif /* CONFIG_COMPAT_SLES_11_3 */
-#endif
-
 /*
  * This backports:
  *
@@ -210,19 +119,20 @@ struct tc_fq_codel_xstats {
        };
 };
 
+#ifndef CONFIG_COMPAT_IS_MAXRATE
+#ifndef IEEE_8021QAZ_MAX_TCS
+#define IEEE_8021QAZ_MAX_TCS 8
+#endif
+
+struct ieee_maxrate {
+       u64 tc_maxrate[IEEE_8021QAZ_MAX_TCS];
+};
+#endif
 
 /* Backports tty_lock: Localise the lock */
 #define tty_lock(__tty) tty_lock()
 #define tty_unlock(__tty) tty_unlock()
 
-#ifndef CONFIG_COMPAT_RHEL_6_4
-/* Backport ether_addr_equal */
-static inline bool ether_addr_equal(const u8 *addr1, const u8 *addr2)
-{
-    return !compare_ether_addr(addr1, addr2);
-}
-#endif /* CONFIG_COMPAT_RHEL_6_4 */
-
 #define net_ratelimited_function(function, ...)                        \
 do {                                                           \
        if (net_ratelimit())                                    \
@@ -253,7 +163,24 @@ static inline struct ctl_table_header *register_net_sysctl(struct net *net,
        return NULL;
 }
 
+#ifndef CONFIG_COMPAT_IS_IP_TOS2PRIO
 extern const __u8 ip_tos2prio[16];
+#endif
+
+#define dev_uc_add_excl LINUX_BACKPORT(dev_uc_add_excl)
+extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr);
+
+#define dev_mc_add_excl LINUX_BACKPORT(dev_mc_add_excl)
+extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr);
+
+#define SK_CAN_REUSE 1
+
+#define ether_addr_equal_64bits LINUX_BACKPORT(ether_addr_equal_64bits)
+static inline bool ether_addr_equal_64bits(const u8 addr1[6+2],
+                                          const u8 addr2[6+2])
+{
+       return !compare_ether_addr_64bits(addr1, addr2);
+}
 
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0)) */
 
index 3d18be4801d89e4d4c913fa674a851e7fe0a7b65..1afd0de3f84cb591412e0c0251ae9680e8422ae2 100644 (file)
@@ -50,11 +50,13 @@ int sg_alloc_table_from_pages(struct sg_table *sgt,
  *     Signed-off-by: Dave Airlie <airlied@redhat.com>
  */
 
+#ifndef  PCI_EXP_LNKCAP2
 #define  PCI_EXP_LNKCAP2               44      /* Link Capability 2 */
 #define  PCI_EXP_LNKCAP2_SLS_2_5GB     0x01    /* Current Link Speed 2.5GT/s */
 #define  PCI_EXP_LNKCAP2_SLS_5_0GB     0x02    /* Current Link Speed 5.0GT/s */
 #define  PCI_EXP_LNKCAP2_SLS_8_0GB     0x04    /* Current Link Speed 8.0GT/s */
 #define  PCI_EXP_LNKCAP2_CROSSLINK     0x100 /* Crosslink supported */
+#endif
 
 #include <net/genetlink.h>
 #include <linux/etherdevice.h>
@@ -65,6 +67,7 @@ int sg_alloc_table_from_pages(struct sg_table *sgt,
  *
  * Assign the broadcast address to the given address array.
  */
+#define eth_broadcast_addr LINUX_BACKPORT(eth_broadcast_addr)
 static inline void eth_broadcast_addr(u8 *addr)
 {
        memset(addr, 0xff, ETH_ALEN);
index 8772d5d365148550c42042a02529a2874321cd18..7b99aae748ef4a137440ecffdaae3cd5fa7f9ba6 100644 (file)
 
 #define VM_DONTDUMP    VM_NODUMP
 
+#ifndef INIT_DEFERRABLE_WORK
+#define INIT_DEFERRABLE_WORK(_work, _func) INIT_DELAYED_WORK_DEFERRABLE(_work, _func)
+#endif
+
+#ifndef DECLARE_DEFERRABLE_WORK
+#define DECLARE_DEFERRABLE_WORK(n, f) DECLARE_DEFERRED_WORK(n, f)
+#endif
+
 #ifdef CONFIG_USER_NS
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38))
@@ -105,7 +113,7 @@ static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos,
 #define MAX_IDR_MASK (MAX_IDR_BIT - 1)
 
 /* IPoIB section */
-
+#ifndef IFLA_IPOIB_MAX
 enum {
        IFLA_IPOIB_UNSPEC,
        IFLA_IPOIB_PKEY,
@@ -120,6 +128,7 @@ enum {
 };
 
 #define IFLA_IPOIB_MAX (__IFLA_IPOIB_MAX - 1)
+#endif
 
 #define FMODE_PATH             ((__force fmode_t)0x4000)
 
index d49d57e6f8d7bda468f572bd4874e74ec70d52a2..08638dc97ca5c536e072843ce1e65b28dc82389c 100644 (file)
@@ -4,9 +4,11 @@
 
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
 #include_next <linux/llist.h>
+#define llist_add_batch LINUX_BACKPORT(llist_add_batch)
 extern bool llist_add_batch(struct llist_node *new_first,
                            struct llist_node *new_last,
                            struct llist_head *head);
+#define llist_del_first LINUX_BACKPORT(llist_del_first)
 extern struct llist_node *llist_del_first(struct llist_head *head);
 #else
 
@@ -90,6 +92,7 @@ struct llist_node {
  * init_llist_head - initialize lock-less list head
  * @head:      the head for your lock-less list
  */
+#define init_llist_head LINUX_BACKPORT(init_llist_head)
 static inline void init_llist_head(struct llist_head *list)
 {
        list->first = NULL;
@@ -101,8 +104,10 @@ static inline void init_llist_head(struct llist_head *list)
  * @type:      the type of the struct this is embedded in.
  * @member:    the name of the llist_node within the struct.
  */
+#ifndef llist_entry
 #define llist_entry(ptr, type, member)         \
        container_of(ptr, type, member)
+#endif
 
 /**
  * llist_for_each - iterate over some deleted entries of a lock-less list
@@ -118,8 +123,10 @@ static inline void init_llist_head(struct llist_head *list)
  * you want to traverse from the oldest to the newest, you must
  * reverse the order by yourself before traversing.
  */
+#ifndef llist_for_each
 #define llist_for_each(pos, node)                      \
        for ((pos) = (node); pos; (pos) = (pos)->next)
+#endif
 
 /**
  * llist_for_each_entry - iterate over some deleted entries of lock-less list of given type
@@ -136,10 +143,12 @@ static inline void init_llist_head(struct llist_head *list)
  * you want to traverse from the oldest to the newest, you must
  * reverse the order by yourself before traversing.
  */
+#ifndef llist_for_each_entry
 #define llist_for_each_entry(pos, node, member)                                \
        for ((pos) = llist_entry((node), typeof(*(pos)), member);       \
             &(pos)->member != NULL;                                    \
             (pos) = llist_entry((pos)->member.next, typeof(*(pos)), member))
+#endif
 
 /**
  * llist_empty - tests whether a lock-less list is empty
@@ -149,11 +158,13 @@ static inline void init_llist_head(struct llist_head *list)
  * test whether the list is empty without deleting something from the
  * list.
  */
+#define llist_empty LINUX_BACKPORT(llist_empty)
 static inline bool llist_empty(const struct llist_head *head)
 {
        return ACCESS_ONCE(head->first) == NULL;
 }
 
+#define llist_next LINUX_BACKPORT(llist_next)
 static inline struct llist_node *llist_next(struct llist_node *node)
 {
        return node->next;
@@ -166,6 +177,7 @@ static inline struct llist_node *llist_next(struct llist_node *node)
  *
  * Returns true if the list was empty prior to adding this entry.
  */
+#define llist_add LINUX_BACKPORT(llist_add)
 static inline bool llist_add(struct llist_node *new, struct llist_head *head)
 {
        struct llist_node *entry, *old_entry;
@@ -190,15 +202,18 @@ static inline bool llist_add(struct llist_node *new, struct llist_head *head)
  * return the pointer to the first entry.  The order of entries
  * deleted is from the newest to the oldest added one.
  */
+#define llist_del_all LINUX_BACKPORT(llist_del_all)
 static inline struct llist_node *llist_del_all(struct llist_head *head)
 {
        return xchg(&head->first, NULL);
 }
 
+#define llist_add_batch LINUX_BACKPORT(llist_add_batch)
 extern bool llist_add_batch(struct llist_node *new_first,
                            struct llist_node *new_last,
                            struct llist_head *head);
 
+#define llist_del_first LINUX_BACKPORT(llist_del_first)
 extern struct llist_node *llist_del_first(struct llist_head *head);
 
 #endif /* (defined(CONFIG_COMPAT_SLES_11_2) || defined(CONFIG_COMPAT_SLES_11_3)) */
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h
new file mode 100644 (file)
index 0000000..ae1ed80
--- /dev/null
@@ -0,0 +1,221 @@
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+#include_next <linux/uidgid.h>
+#else
+
+#ifndef _LINUX_UIDGID_H
+#define _LINUX_UIDGID_H
+
+/*
+ * A set of types for the internal kernel types representing uids and gids.
+ *
+ * The types defined in this header allow distinguishing which uids and gids in
+ * the kernel are values used by userspace and which uid and gid values are
+ * the internal kernel values.  With the addition of user namespaces the values
+ * can be different.  Using the type system makes it possible for the compiler
+ * to detect when we overlook these differences.
+ *
+ */
+#include <linux/types.h>
+#include <linux/highuid.h>
+
+struct user_namespace;
+extern struct user_namespace init_user_ns;
+
+#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
+
+typedef struct {
+       uid_t val;
+} kuid_t;
+
+
+typedef struct {
+       gid_t val;
+} kgid_t;
+
+#define KUIDT_INIT(value) (kuid_t){ value }
+#define KGIDT_INIT(value) (kgid_t){ value }
+
+static inline uid_t __kuid_val(kuid_t uid)
+{
+       return uid.val;
+}
+
+static inline gid_t __kgid_val(kgid_t gid)
+{
+       return gid.val;
+}
+
+#else
+
+typedef uid_t kuid_t;
+typedef gid_t kgid_t;
+
+static inline uid_t __kuid_val(kuid_t uid)
+{
+       return uid;
+}
+
+static inline gid_t __kgid_val(kgid_t gid)
+{
+       return gid;
+}
+
+#define KUIDT_INIT(value) ((kuid_t) value )
+#define KGIDT_INIT(value) ((kgid_t) value )
+
+#endif
+
+#define GLOBAL_ROOT_UID KUIDT_INIT(0)
+#define GLOBAL_ROOT_GID KGIDT_INIT(0)
+
+#define INVALID_UID KUIDT_INIT(-1)
+#define INVALID_GID KGIDT_INIT(-1)
+
+static inline bool uid_eq(kuid_t left, kuid_t right)
+{
+       return __kuid_val(left) == __kuid_val(right);
+}
+
+static inline bool gid_eq(kgid_t left, kgid_t right)
+{
+       return __kgid_val(left) == __kgid_val(right);
+}
+
+static inline bool uid_gt(kuid_t left, kuid_t right)
+{
+       return __kuid_val(left) > __kuid_val(right);
+}
+
+static inline bool gid_gt(kgid_t left, kgid_t right)
+{
+       return __kgid_val(left) > __kgid_val(right);
+}
+
+static inline bool uid_gte(kuid_t left, kuid_t right)
+{
+       return __kuid_val(left) >= __kuid_val(right);
+}
+
+static inline bool gid_gte(kgid_t left, kgid_t right)
+{
+       return __kgid_val(left) >= __kgid_val(right);
+}
+
+static inline bool uid_lt(kuid_t left, kuid_t right)
+{
+       return __kuid_val(left) < __kuid_val(right);
+}
+
+static inline bool gid_lt(kgid_t left, kgid_t right)
+{
+       return __kgid_val(left) < __kgid_val(right);
+}
+
+static inline bool uid_lte(kuid_t left, kuid_t right)
+{
+       return __kuid_val(left) <= __kuid_val(right);
+}
+
+static inline bool gid_lte(kgid_t left, kgid_t right)
+{
+       return __kgid_val(left) <= __kgid_val(right);
+}
+
+static inline bool uid_valid(kuid_t uid)
+{
+       return !uid_eq(uid, INVALID_UID);
+}
+
+static inline bool gid_valid(kgid_t gid)
+{
+       return !gid_eq(gid, INVALID_GID);
+}
+
+#ifdef CONFIG_USER_NS
+
+#define make_kuid LINUX_BACKPORT(make_kuid)
+extern kuid_t make_kuid(struct user_namespace *from, uid_t uid);
+#define make_kgid LINUX_BACKPORT(make_kgid)
+extern kgid_t make_kgid(struct user_namespace *from, gid_t gid);
+
+#define from_kuid LINUX_BACKPORT(from_kuid)
+extern uid_t from_kuid(struct user_namespace *to, kuid_t uid);
+#define from_kgid LINUX_BACKPORT(from_kgid)
+extern gid_t from_kgid(struct user_namespace *to, kgid_t gid);
+#define from_kuid_munged LINUX_BACKPORT(from_kuid_munged)
+extern uid_t from_kuid_munged(struct user_namespace *to, kuid_t uid);
+#define from_kgid_munged LINUX_BACKPORT(from_kgid_munged)
+extern gid_t from_kgid_munged(struct user_namespace *to, kgid_t gid);
+
+#define kuid_has_mapping LINUX_BACKPORT(kuid_has_mapping)
+static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid)
+{
+       return from_kuid(ns, uid) != (uid_t) -1;
+}
+
+#define kgid_has_mapping LINUX_BACKPORT(kgid_has_mapping)
+static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid)
+{
+       return from_kgid(ns, gid) != (gid_t) -1;
+}
+
+#else
+
+#define make_kuid LINUX_BACKPORT(make_kuid)
+static inline kuid_t make_kuid(struct user_namespace *from, uid_t uid)
+{
+       return KUIDT_INIT(uid);
+}
+
+#define make_kgid LINUX_BACKPORT(make_kgid)
+static inline kgid_t make_kgid(struct user_namespace *from, gid_t gid)
+{
+       return KGIDT_INIT(gid);
+}
+
+#define from_kuid LINUX_BACKPORT(from_kuid)
+static inline uid_t from_kuid(struct user_namespace *to, kuid_t kuid)
+{
+       return __kuid_val(kuid);
+}
+
+#define from_kgid LINUX_BACKPORT(from_kgid)
+static inline gid_t from_kgid(struct user_namespace *to, kgid_t kgid)
+{
+       return __kgid_val(kgid);
+}
+
+#define from_kuid_munged LINUX_BACKPORT(from_kuid_munged)
+static inline uid_t from_kuid_munged(struct user_namespace *to, kuid_t kuid)
+{
+       uid_t uid = from_kuid(to, kuid);
+       if (uid == (uid_t)-1)
+               uid = overflowuid;
+       return uid;
+}
+
+#define from_kgid_munged LINUX_BACKPORT(from_kgid_munged)
+static inline gid_t from_kgid_munged(struct user_namespace *to, kgid_t kgid)
+{
+       gid_t gid = from_kgid(to, kgid);
+       if (gid == (gid_t)-1)
+               gid = overflowgid;
+       return gid;
+}
+
+#define kuid_has_mapping LINUX_BACKPORT(kuid_has_mapping)
+static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid)
+{
+       return true;
+}
+
+#define kgid_has_mapping LINUX_BACKPORT(kgid_has_mapping)
+static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid)
+{
+       return true;
+}
+
+#endif /* CONFIG_USER_NS */
+
+#endif /* _LINUX_UIDGID_H */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) */