]> rtime.felk.cvut.cz Git - lisovros/linux_canprio.git/blob - net/can/compat.h
Added socketcan from SVN r903
[lisovros/linux_canprio.git] / 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,20)
41 #define round_jiffies(j) (j)
42 #endif
43
44 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
45 #define   dev_get_by_index(ns, ifindex)   dev_get_by_index(ifindex)
46 #define __dev_get_by_index(ns, ifindex) __dev_get_by_index(ifindex)
47 #endif
48
49 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
50 #include <linux/hrtimer.h>
51 static inline int hrtimer_callback_running(struct hrtimer *timer)
52 {
53         return timer->state & HRTIMER_STATE_CALLBACK;
54 }
55 #endif
56 #endif