summaryrefslogtreecommitdiff
path: root/kern/queue.h
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2015-07-10 11:09:09 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-07-26 12:14:40 +0200
commit271d59feaee8770a54a77967417d58ccca163060 (patch)
tree37aac28938638aab34f34c71634d2b70bc65db43 /kern/queue.h
parent5d39c22c32805567989e08f84d74d80fef25126a (diff)
YYY kern: implement queue_replace
* kern/queue.h (queue_replace): New macro.
Diffstat (limited to 'kern/queue.h')
-rw-r--r--kern/queue.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/kern/queue.h b/kern/queue.h
index f0b4002..0080e78 100644
--- a/kern/queue.h
+++ b/kern/queue.h
@@ -321,6 +321,21 @@ void insque(queue_entry_t, queue_entry_t);
}
/*
+ * Macro: queue_replace
+ */
+#define queue_replace(head, to, from, type, field) \
+ { \
+ if ((head) == (from)->field.prev) \
+ (head)->next = (to); \
+ else \
+ ((type)((from)->field.prev))->field.next = (to); \
+ if ((head) == (from)->field.next) \
+ (head)->prev = (to); \
+ else \
+ ((type)((from)->field.next))->field.prev = (to); \
+}
+
+/*
* Macro: queue_assign
*/
#define queue_assign(to, from, type, field) \