netatalk
4.4.3
Free and Open Source Apple Filing Protocol (AFP) Server
Toggle main menu visibility
Loading...
Searching...
No Matches
include/atalk/list.h
Go to the documentation of this file.
1
/* This code has been stolen from Linux kernel :) */
2
/* distributed under GNU GPL version 2. */
3
4
#ifndef _ATALK_LIST_H
5
#define _ATALK_LIST_H
6
17
18
struct
list_head
{
19
struct
list_head
*
next
, *
prev
;
20
};
21
22
#define ATALK_LIST_HEAD_INIT(name) { &(name), &(name) }
23
24
#define ATALK_LIST_HEAD(name) \
25
struct list_head name = ATALK_LIST_HEAD_INIT(name)
26
27
#define ATALK_INIT_LIST_HEAD(ptr) do { \
28
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
29
} while (0)
30
31
#ifdef USE_LIST
38
static
inline
void
__list_add(
struct
list_head
*
new
,
39
struct
list_head
*
prev
,
40
struct
list_head
*
next
)
41
{
42
next
->prev =
new
;
43
new
->next =
next
;
44
new
->prev =
prev
;
45
prev
->
next
=
new
;
46
}
47
56
static
inline
void
list_add(
struct
list_head
*
new
,
struct
list_head
*head)
57
{
58
__list_add(
new
, head, head->
next
);
59
}
60
69
static
inline
void
list_add_tail(
struct
list_head
*
new
,
struct
list_head
*head)
70
{
71
__list_add(
new
, head->
prev
, head);
72
}
73
81
static
inline
void
__list_del(
struct
list_head
*
prev
,
82
struct
list_head
*
next
)
83
{
84
next
->prev =
prev
;
85
prev
->
next
=
next
;
86
}
87
93
static
inline
void
list_del(
struct
list_head
*
entry
)
94
{
95
__list_del(
entry
->prev,
entry
->next);
96
}
97
102
static
inline
void
list_del_init(
struct
list_head
*
entry
)
103
{
104
__list_del(
entry
->prev,
entry
->next);
105
ATALK_INIT_LIST_HEAD
(
entry
);
106
}
107
112
static
inline
int
list_empty(
struct
list_head
*head)
113
{
114
return
head->
next
== head;
115
}
116
122
static
inline
void
list_splice(
struct
list_head
*
list
,
struct
list_head
*head)
123
{
124
struct
list_head
*
first
=
list
->next;
125
126
if
(
first
!=
list
) {
127
struct
list_head
*last =
list
->prev;
128
struct
list_head
*at = head->
next
;
129
first
->prev = head;
130
head->
next
=
first
;
131
last->
next
= at;
132
at->
prev
= last;
133
}
134
}
135
136
#endif
143
#define list_entry(ptr, type, member) \
144
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
145
151
#define list_for_each(pos, head) \
152
for (pos = (head)->next; pos != (head); \
153
pos = pos->next)
154
160
#define list_for_each_prev(pos, head) \
161
for (pos = (head)->prev; pos != (head); \
162
pos = pos->prev)
163
#endif
next
#define next
Definition
hash.c:35
ATALK_INIT_LIST_HEAD
#define ATALK_INIT_LIST_HEAD(ptr)
Definition
include/atalk/list.h:27
first
static int first
Definition
nad_ls.c:54
entry
Definition
ad_open.c:97
list_head
Definition
include/atalk/list.h:18
list_head::prev
struct list_head * prev
Definition
include/atalk/list.h:19
list_head::next
struct list_head * next
Definition
include/atalk/list.h:19
list
Definition
etc/atalkd/list.h:6
include
atalk
list.h
Generated by
1.17.0