diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2014-02-11 14:02:43 +0000 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2014-02-11 14:02:43 +0000 |
commit | 0d92798e88c5444fb2cc23663b4ea9a345887756 (patch) | |
tree | a71f336115753242e8690547f403405a3373ddf1 /libglusterfs/src/list.h | |
parent | 33939dcde38389373e7ed8b12c6e9916b39411d0 (diff) | |
parent | 408d50a64b7b3a9d6a4899060baa423ff126cc5f (diff) |
Merge remote-tracking branch 'upstream/master'
Conflicts:
xlators/mgmt/glusterd/src/Makefile.am
Change-Id: Ida5ec4aecc358cb2268bdfdb1a8c9bab750f9575
Diffstat (limited to 'libglusterfs/src/list.h')
-rw-r--r-- | libglusterfs/src/list.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libglusterfs/src/list.h b/libglusterfs/src/list.h index 6fcf17f35..c9a2fb070 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; |