1
/*********************************************************
2
* Copyright (C) 2006 VMware, Inc. All rights reserved.
4
* This program is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License as published by the
6
* Free Software Foundation version 2 and no later version.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13
* You should have received a copy of the GNU General Public License along
14
* with this program; if not, write to the Free Software Foundation, Inc.,
15
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
*********************************************************/
19
#ifndef __COMPAT_LIST_H__
20
# define __COMPAT_LIST_H__
22
#include <linux/list.h>
25
* list_add_tail is with us since 2.4.0, or something like that.
27
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
28
#define list_add_tail(newe, head) do { \
29
struct list_head *__h = (head); \
30
__list_add((newe), __h->prev, __h); \
35
* list_for_each_safe() showed up in 2.4.10, but it may be backported so we
36
* just check for its existence.
38
#ifndef list_for_each_safe
39
# define list_for_each_safe(pos, n, head) \
40
for (pos = (head)->next, n = pos->next; pos != (head); \
41
pos = n, n = pos->next)
45
* list_for_each_entry() showed up in 2.4.20, but it may be backported so we
46
* just check for its existence.
48
#ifndef list_for_each_entry
49
# define list_for_each_entry(pos, head, member) \
50
for (pos = list_entry((head)->next, typeof(*pos), member); \
51
&pos->member != (head); \
52
pos = list_entry(pos->member.next, typeof(*pos), member))
55
#endif /* __COMPAT_LIST_H__ */