[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5c49b0ed0608031915g2c1fc44ch623a7657b994bf9c@mail.gmail.com>
Date: Thu, 3 Aug 2006 19:15:15 -0700
From: "Nate Diller" <nate.diller@...il.com>
To: "Andrew Morton" <akpm@...l.org>, "Jens Axboe" <axboe@...e.de>
Cc: "Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>
Subject: [PATCH -mm] [2/3] add list_merge to list.h
list_merge behaves like list_splice, except it can be used with
headless lists. that is, the resulting list will have @head
immediately preceeding @list.
This is used by the contig list feature in the Elevator I/O scheduler
Signed-off-by: Nate Diller <nate.diller@...il.com>
---
list.h | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
---
diff -urpN -X dontdiff linux-2.6.18-rc1-mm2/include/linux/list.h
linux-dput/include/linux/list.h
--- linux-2.6.18-rc1-mm2/include/linux/list.h 2006-07-18
15:00:53.000000000 -0700
+++ linux-dput/include/linux/list.h 2006-08-03 18:42:00.000000000 -0700
@@ -357,6 +357,27 @@ static inline void list_splice_init(stru
}
}
+/**
+ * list_merge - merge two headless lists
+ * @list: the new list to merge.
+ * @head: the place to add it in the first list.
+ *
+ * This is similar to list_splice(), except it merges every item onto @list,
+ * not excluding @head itself. It is a noop if @head already immediately
+ * preceeds @list.
+ */
+static inline void list_merge(struct list_head *list, struct list_head *head)
+{
+ struct list_head *last = list->prev;
+ struct list_head *at = head->next;
+
+ list->prev = head;
+ head->next = list;
+
+ last->next = at;
+ at->prev = last;
+}
+
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists