aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/list.h')
-rw-r--r--include/linux/list.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/include/linux/list.h b/include/linux/list.h
index dac16f99c701..08cf4f651889 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -1,8 +1,6 @@
1#ifndef _LINUX_LIST_H 1#ifndef _LINUX_LIST_H
2#define _LINUX_LIST_H 2#define _LINUX_LIST_H
3 3
4#ifdef __KERNEL__
5
6#include <linux/stddef.h> 4#include <linux/stddef.h>
7#include <linux/poison.h> 5#include <linux/poison.h>
8#include <linux/prefetch.h> 6#include <linux/prefetch.h>
@@ -319,7 +317,16 @@ static inline int list_empty_careful(const struct list_head *head)
319 return (next == head) && (next == head->prev); 317 return (next == head) && (next == head->prev);
320} 318}
321 319
322static inline void __list_splice(struct list_head *list, 320/**
321 * list_is_singular - tests whether a list has just one entry.
322 * @head: the list to test.
323 */
324static inline int list_is_singular(const struct list_head *head)
325{
326 return !list_empty(head) && (head->next == head->prev);
327}
328
329static inline void __list_splice(const struct list_head *list,
323 struct list_head *head) 330 struct list_head *head)
324{ 331{
325 struct list_head *first = list->next; 332 struct list_head *first = list->next;
@@ -338,7 +345,8 @@ static inline void __list_splice(struct list_head *list,
338 * @list: the new list to add. 345 * @list: the new list to add.
339 * @head: the place to add it in the first list. 346 * @head: the place to add it in the first list.
340 */ 347 */
341static inline void list_splice(struct list_head *list, struct list_head *head) 348static inline void list_splice(const struct list_head *list,
349 struct list_head *head)
342{ 350{
343 if (!list_empty(list)) 351 if (!list_empty(list))
344 __list_splice(list, head); 352 __list_splice(list, head);
@@ -973,7 +981,4 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
973 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 981 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
974 pos = rcu_dereference(pos->next)) 982 pos = rcu_dereference(pos->next))
975 983
976#else
977#warning "don't include kernel headers in userspace"
978#endif /* __KERNEL__ */
979#endif 984#endif