aboutsummaryrefslogtreecommitdiff
path: root/compat.h
blob: 77dcc292b40b13714db46eaacd59a3a033bdee4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * Compatibility code for older Linux kernels
 *
 * Copyright (c) 2007 Pavel Roskin <proski@gnu.org>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 */

#include <linux/version.h>

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
#define skb_mac_header(_skb) ((_skb)->mac.raw)
#define skb_reset_mac_header(_skb) \
	do { (_skb)->mac.raw = (_skb)->data; } while(0)
#define skb_set_mac_header(_skb, _offset) \
	do { (_skb)->mac.raw = (_skb)->data + (_offset); } while(0)
#define skb_end_pointer(_skb) ((_skb)->end)
#define skb_tail_pointer(_skb) ((_skb)->tail)
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#undef INIT_WORK
#define INIT_WORK(_work, _func)						\
	do {								\
		INIT_LIST_HEAD(&(_work)->entry);			\
		(_work)->pending = 0;					\
		PREPARE_WORK((_work), (void (*)(void *))(_func),	\
			     (void *)(_work));				\
		init_timer(&(_work)->timer);				\
	} while (0)
#endif