summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/list.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libglusterfs/src/list.h b/libglusterfs/src/list.h
index 7f3712b51..794586e35 100644
--- a/libglusterfs/src/list.h
+++ b/libglusterfs/src/list.h
@@ -46,6 +46,21 @@ list_add_tail (struct list_head *new, struct list_head *head)
static inline void
+list_add_order (struct list_head *new, struct list_head *head,
+ int (*compare)(struct list_head *, struct list_head *))
+{
+ struct list_head *pos = head->next;
+
+ while ( pos != head ) {
+ if (compare(new, pos) <= 0)
+ break;
+ pos = pos->next;
+ }
+
+ list_add_tail(new, pos);
+}
+
+static inline void
list_del (struct list_head *old)
{
old->prev->next = old->next;