提交 5908cdc8 编写于 作者: F Frederic Weisbecker

list: Introduce list_rotate_left()

Bring a new list_rotate_left() helper that rotates a list to
the left. This is useful for codes that need to round roubin
elements which queue priority increases from tail to head.
Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
Acked-by: NPeter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
上级 889ff015
...@@ -205,6 +205,20 @@ static inline int list_empty_careful(const struct list_head *head) ...@@ -205,6 +205,20 @@ static inline int list_empty_careful(const struct list_head *head)
return (next == head) && (next == head->prev); return (next == head) && (next == head->prev);
} }
/**
* list_rotate_left - rotate the list to the left
* @head: the head of the list
*/
static inline void list_rotate_left(struct list_head *head)
{
struct list_head *first;
if (!list_empty(head)) {
first = head->next;
list_move_tail(first, head);
}
}
/** /**
* list_is_singular - tests whether a list has just one entry. * list_is_singular - tests whether a list has just one entry.
* @head: the list to test. * @head: the list to test.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册