summaryrefslogtreecommitdiff
path: root/accel-pppd/triton/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pppd/triton/list.h')
-rw-r--r--accel-pppd/triton/list.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/accel-pppd/triton/list.h b/accel-pppd/triton/list.h
index a650037f..20b917d4 100644
--- a/accel-pppd/triton/list.h
+++ b/accel-pppd/triton/list.h
@@ -99,6 +99,29 @@ static inline void list_del(struct list_head *entry)
}
/**
+ * list_replace - replace old entry by new one
+ * @old : the element to be replaced
+ * @new : the new element to insert
+ *
+ * If @old was empty, it will be overwritten.
+ */
+static inline void list_replace(struct list_head *old,
+ struct list_head *new)
+{
+ new->next = old->next;
+ new->next->prev = new;
+ new->prev = old->prev;
+ new->prev->next = new;
+}
+
+static inline void list_replace_init(struct list_head *old,
+ struct list_head *new)
+{
+ list_replace(old, new);
+ INIT_LIST_HEAD(old);
+}
+
+/**
* list_del_init - deletes entry from list and reinitialize it.
* @entry: the element to delete from the list.
*/