]> rtime.felk.cvut.cz Git - socketcan-devel.git/blob - kernel/2.6/net/can/compat.h
merged branches/netlink in rev. 1037 back to trunk.
[socketcan-devel.git] / kernel / 2.6 / net / can / compat.h
1 /*
2  * $Id$
3  */
4
5 #ifndef CAN_COMPAT_H
6 #define CAN_COMPAT_H
7
8 #ifndef PF_CAN
9 #define PF_CAN 29
10 #endif
11
12 #ifndef AF_CAN
13 #define AF_CAN PF_CAN
14 #endif
15
16 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
17 static inline void *kzalloc(size_t size, unsigned int __nocast flags)
18 {
19         void *ret = kmalloc(size, flags);
20         if (ret)
21                 memset(ret, 0, size);
22         return ret;
23 }
24
25 static inline void skb_get_timestamp(const struct sk_buff *skb,
26                                      struct timeval *stamp)
27 {
28         stamp->tv_sec  = skb->stamp.tv_sec;
29         stamp->tv_usec = skb->stamp.tv_usec;
30 }
31
32 static inline void skb_set_timestamp(struct sk_buff *skb,
33                                      const struct timeval *stamp)
34 {
35         skb->stamp.tv_sec  = stamp->tv_sec;
36         skb->stamp.tv_usec = stamp->tv_usec;
37 }
38 #endif
39
40 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
41 static inline void setup_timer(struct timer_list * timer,
42                                 void (*function)(unsigned long),
43                                 unsigned long data)
44 {
45         timer->function = function;
46         timer->data = data;
47         init_timer(timer);
48 }
49 #endif
50
51 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
52 #define round_jiffies(j) (j)
53 #endif
54
55 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
56 #define   dev_get_by_index(ns, ifindex)   dev_get_by_index(ifindex)
57 #define __dev_get_by_index(ns, ifindex) __dev_get_by_index(ifindex)
58 #endif
59
60 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
61 #include <linux/hrtimer.h>
62 static inline int hrtimer_callback_running(struct hrtimer *timer)
63 {
64         return timer->state & HRTIMER_STATE_CALLBACK;
65 }
66 #endif
67 #endif