1list_create(9F)          Kernel Functions for Drivers          list_create(9F)
2
3
4

NAME

6       list_create,   list_destroy,   list_insert_after,   list_insert_before,
7       list_insert_head,  list_insert_tail,   list_remove,   list_remove_head,
8       list_remove_tail,    list_head,    list_tail,   list_next,   list_prev,
9       list_is_empty,   list_link_init,   list_link_active,    list_move_tail,
10       list_link_replace - list functions
11

SYNOPSIS

13       #include <sys/list.h>
14
15       void list_create(list_t * list, size_t size, size_t offset);
16
17
18       void list_destroy(list_t * list);
19
20
21       void list_insert_after(list_t * list, void *reference_item,
22            void *new_item);
23
24
25       void list_insert_before(list_t * list, void *reference_item,
26            void *new_item);
27
28
29       void list_insert_head(list_t * list*, void *new_item);
30
31
32       void list_insert_tail(list_t * list, void *new_item);
33
34
35       void list_remove(list_t * list, void *item);
36
37
38       void *list_remove_head(list_t * list);
39
40
41       void *list_remove_tail(list_t * list);
42
43
44       void *list_head(list_t * list);
45
46
47       void *list_tail(list_t * list);
48
49
50       void *list_next(list_t * list, void *reference_item);
51
52
53       void *list_prev(list_t * list, void *reference_item);
54
55
56       int list_is_empty(list_t * list);
57
58
59       void list_link_init(list_node_t *node);
60
61
62       int list_link_active(list_node_t *node);
63
64
65       void list_move_tail(list_t *dst, list_t *src);
66
67
68       void list_link_replace(list_node_t *node1, list_node_t *node2);
69
70

DESCRIPTION

72       The  list_create() function initializes a new list. The driver supplies
73       the storage for the list handle, the size of an individual element, and
74       the  offset of a list_node_t within the element to use for the links of
75       the list.
76
77
78       The list_destroy() function destroys the list handle, including freeing
79       any resources that may have been internally allocated for the list. The
80       list must be empty when this function is called.
81
82
83       The  list_insert_after()  and  list_insert_before()  functions   insert
84       new_item  into the linked list at a location after or before the refer‐
85       ence item, which must already be on the list.
86
87
88       The list_insert_head()  and  list_insert_tail()  functions  insert  the
89       new_item on the list at either the head or tail of the list.  (The head
90       is the first item, the tail is the last item).
91
92
93       The list_remove() function removes the item from the list.
94
95
96       The list_remove_head() and list_remove_tail() functions remove the head
97       (first) or tail (last) item from the list. The item removed is returned
98       to the caller. If the list is empty when these  functions  are  called,
99       then no change is made and NULL is returned to the caller.
100
101
102       The  list_head()  and  list_tail()  functions  simply  return  the head
103       (first) or tail (last) item on the list.  NULL is returned if the  list
104       is empty.
105
106
107       The  list_next()  and list_prev() functions return the next or previous
108       item in the list, relative to the named reference item  which  must  be
109       linked on the list.
110
111
112       The  list_is_empty() function returns 0 if the list has items in it, or
113       non-zero otherwise.
114
115
116       The list_link_init() function initializes the list_node_t. It is  func‐
117       tionally equivalent to bzero(node, sizeof(*node));
118
119
120       The  list_link_active()  function returns non-zero if the node is on an
121       active list.
122
123
124       The list_move_tail() function is used to append the items  on  the  src
125       list  to  the  end  of the dst list. It is mandatory that the two lists
126       were initialized using identical size and offset parameters. Upon  com‐
127       pletion, the src list will be empty.
128
129
130       The  list_link_replace() function swaps two items on a list.  Note that
131       the items need not be on the same list, but extreme care must  be  used
132       to  ensure  that  both lists are protected from concurrent accesses and
133       that the lists were initialized with identical size and offset  parame‐
134       ters.
135

ATTRIBUTES

137       See attributes(5) for descriptions of the following attributes:
138
139
140
141
142       ┌─────────────────────────────┬─────────────────────────────┐
143       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
144       ├─────────────────────────────┼─────────────────────────────┤
145       │Interface Stability          │Committed                    │
146       └─────────────────────────────┴─────────────────────────────┘
147

SEE ALSO

149       attributes(5)
150
151
152
153SunOS 5.11                        17 Sep 2009                  list_create(9F)
Impressum