2 * include/asm-s390/queue.h
5 * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
8 * A little set of queue utilies.
12 #include <linux/stddef.h>
27 static __inline__
void init_queue(qheader
*qhead
)
29 memset(qhead
,0,sizeof(*qhead
));
32 static __inline__
void enqueue_tail(qheader
*qhead
,queue
*member
)
36 queue
*tail
=qhead
->tail
;
48 static __inline__ queue
*dequeue_head(qheader
*qhead
)
50 queue
*head
=qhead
->head
,*next_head
;
55 qhead
->head
=next_head
;
62 static __inline__
void init_list(list
**lhead
)
67 static __inline__
void add_to_list(list
**lhead
,list
*member
)
73 static __inline__ list
*remove_listhead(list
**lhead
)
78 *lhead
=(*lhead
)->next
;
82 static __inline__
void add_to_list_tail(list
**lhead
,list
*member
)
90 for(curr
=(*lhead
)->next
;curr
!=NULL
;curr
=curr
->next
)
95 static __inline__
void add_to_list_tail_null(list
**lhead
,list
*member
)
98 add_to_list_tail_null(lhead
,member
);
102 static __inline__
int is_in_list(list
*lhead
,list
*member
)
106 for(curr
=lhead
;curr
!=NULL
;curr
=curr
->next
)
112 static __inline__
int get_prev(list
*lhead
,list
*member
,list
**prev
)
117 for(curr
=lhead
;curr
!=NULL
;curr
=curr
->next
)
129 static __inline__
int remove_from_list(list
**lhead
,list
*member
)
133 if(get_prev(*lhead
,member
,&prev
))
137 prev
->next
=member
->next
;
145 static __inline__
int remove_from_queue(qheader
*qhead
,queue
*member
)
149 if(get_prev(qhead
->head
,(list
*)member
,(list
**)&prev
))
154 prev
->next
=member
->next
;
160 if(qhead
->head
==qhead
->tail
)
162 qhead
->head
=member
->next
;
169 #endif /* __ASM_QUEUE_H */