Add compatibility call for kmem_cache_destroy()
[~emulex/for-vlad/old/compat.git] / compat-2.6.28.h
1 #ifndef LINUX_26_28_COMPAT_H
2 #define LINUX_26_28_COMPAT_H
3
4 #include <linux/autoconf.h>
5 #include <linux/version.h>
6
7 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28))
8
9 #include <linux/skbuff.h>
10 #include <linux/if_ether.h>
11 #include <linux/usb.h>
12
13 #ifndef ETH_P_PAE
14 #define ETH_P_PAE 0x888E      /* Port Access Entity (IEEE 802.1X) */
15 #endif
16
17 #include <linux/pci.h>
18
19 #ifndef WARN_ONCE
20 #define WARN_ONCE(condition, format...) ({                      \
21         static int __warned;                                    \
22         int __ret_warn_once = !!(condition);                    \
23                                                                 \
24         if (unlikely(__ret_warn_once))                          \
25                 if (WARN(!__warned, format))                    \
26                         __warned = 1;                           \
27         unlikely(__ret_warn_once);                              \
28 })
29 #endif /* From include/asm-generic/bug.h */
30
31 #include <pcmcia/cs_types.h>
32 #include <pcmcia/cs.h>
33 #include <pcmcia/cistpl.h>
34 #ifdef pcmcia_parse_tuple
35 #undef pcmcia_parse_tuple
36 #define pcmcia_parse_tuple(tuple, parse) pccard_parse_tuple(tuple, parse)
37 #endif
38
39 #if 0
40 extern void usb_poison_urb(struct urb *urb);
41 #endif
42 extern void usb_unpoison_urb(struct urb *urb);
43
44 #if 0
45 extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
46 #endif
47
48 extern struct urb *usb_get_from_anchor(struct usb_anchor *anchor);
49 extern void usb_scuttle_anchored_urbs(struct usb_anchor *anchor);
50 extern int usb_anchor_empty(struct usb_anchor *anchor);
51
52
53 void __iomem *pci_ioremap_bar(struct pci_dev *pdev, int bar);
54
55 /**
56  *      skb_queue_is_last - check if skb is the last entry in the queue
57  *      @list: queue head
58  *      @skb: buffer
59  *
60  *      Returns true if @skb is the last buffer on the list.
61  */
62 static inline bool skb_queue_is_last(const struct sk_buff_head *list,
63                                      const struct sk_buff *skb)
64 {
65         return (skb->next == (struct sk_buff *) list);
66 }
67
68 /**
69  *      skb_queue_next - return the next packet in the queue
70  *      @list: queue head
71  *      @skb: current buffer
72  *
73  *      Return the next packet in @list after @skb.  It is only valid to
74  *      call this if skb_queue_is_last() evaluates to false.
75  */
76 static inline struct sk_buff *skb_queue_next(const struct sk_buff_head *list,
77                                              const struct sk_buff *skb)
78 {
79         /* This BUG_ON may seem severe, but if we just return then we
80          * are going to dereference garbage.
81          */
82         BUG_ON(skb_queue_is_last(list, skb));
83         return skb->next;
84 }
85
86 /**
87  *      __skb_queue_head_init - initialize non-spinlock portions of sk_buff_head
88  *      @list: queue to initialize
89  *
90  *      This initializes only the list and queue length aspects of
91  *      an sk_buff_head object.  This allows to initialize the list
92  *      aspects of an sk_buff_head without reinitializing things like
93  *      the spinlock.  It can also be used for on-stack sk_buff_head
94  *      objects where the spinlock is known to not be used.
95  */
96 static inline void __skb_queue_head_init(struct sk_buff_head *list)
97 {
98         list->prev = list->next = (struct sk_buff *)list;
99         list->qlen = 0;
100 }
101
102 static inline void __skb_queue_splice(const struct sk_buff_head *list,
103                                       struct sk_buff *prev,
104                                       struct sk_buff *next)
105 {
106         struct sk_buff *first = list->next;
107         struct sk_buff *last = list->prev;
108
109         first->prev = prev;
110         prev->next = first;
111
112         last->next = next;
113         next->prev = last;
114 }
115
116 /**
117  *      skb_queue_splice - join two skb lists, this is designed for stacks
118  *      @list: the new list to add
119  *      @head: the place to add it in the first list
120  */
121 static inline void skb_queue_splice(const struct sk_buff_head *list,
122                                     struct sk_buff_head *head)
123 {
124         if (!skb_queue_empty(list)) {
125                 __skb_queue_splice(list, (struct sk_buff *) head, head->next);
126                 head->qlen += list->qlen;
127         }
128 }
129
130 /**
131  *      skb_queue_splice_tail - join two skb lists and reinitialise the emptied list
132  *      @list: the new list to add
133  *      @head: the place to add it in the first list
134  *
135  *      Each of the lists is a queue.
136  *      The list at @list is reinitialised
137  */
138 static inline void skb_queue_splice_tail_init(struct sk_buff_head *list,
139                                               struct sk_buff_head *head)
140 {
141         if (!skb_queue_empty(list)) {
142                 __skb_queue_splice(list, head->prev, (struct sk_buff *) head);
143                 head->qlen += list->qlen;
144                 __skb_queue_head_init(list);
145         }
146 } /* From include/linux/skbuff.h */
147
148 #ifndef DECLARE_TRACE
149
150 #define TP_PROTO(args...)       args
151 #define TP_ARGS(args...)                args
152
153 #define DECLARE_TRACE(name, proto, args)                                \
154         static inline void _do_trace_##name(struct tracepoint *tp, proto) \
155         { }                                                             \
156         static inline void trace_##name(proto)                          \
157         { }                                                             \
158         static inline int register_trace_##name(void (*probe)(proto))   \
159         {                                                               \
160                 return -ENOSYS;                                         \
161         }                                                               \
162         static inline int unregister_trace_##name(void (*probe)(proto)) \
163         {                                                               \
164                 return -ENOSYS;                                         \
165         }
166
167 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
168 #define EXPORT_TRACEPOINT_SYMBOL(name)
169
170
171 #endif
172
173 /* openSuse includes round_jiffies_up in it's kernel 2.6.27.
174  * This is needed to prevent conflicts with the openSuse definition.
175  */
176 #define round_jiffies_up backport_round_jiffies_up
177
178 unsigned long round_jiffies_up(unsigned long j);
179
180 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) */
181
182 #endif /* LINUX_26_28_COMPAT_H */