2 * Copyright 2004-2008, François Revol, <revol@free.fr>.
3 * Distributed under the terms of the MIT License.
5 /* good old single linked list stuff */
11 typedef struct _slist_entry
{
12 struct _slist_entry
*next
;
16 typedef int (*slist_compare_func
)(struct _slist_entry
*item
, void *id
);
18 extern void slist_init(struct _slist_entry
*item
);
19 extern void slist_uninit(struct _slist_entry
*item
);
20 extern struct _slist_entry
*slist_find(struct _slist_entry
*head
, slist_compare_func func
, void *id
);
21 extern status_t
slist_insert_head(struct _slist_entry
**head
, struct _slist_entry
*item
);
22 extern struct _slist_entry
*slist_dequeue_tail(struct _slist_entry
**head
);
23 extern status_t
slist_remove(struct _slist_entry
**head
, struct _slist_entry
*item
);
24 extern struct _slist_entry
*slist_next(struct _slist_entry
*item
);
26 #define LENT_TO_OBJ(_obtype, _sle, _moff) ((_obtype *)(((char *)(_sle)) - offsetof(_obtype, _moff)))
27 #define OBJ_TO_LENT(_obj, _member) (&((_obj)->_member))