]>
git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - lib/list_debug.c
2 * Copyright 2006, Red Hat, Inc., Dave Jones
3 * Released under the General Public License (GPL).
5 * This file contains the linked list implementations for
9 #include <linux/export.h>
10 #include <linux/list.h>
11 #include <linux/kernel.h>
14 * Insert a new entry between two known consecutive entries.
16 * This is only for internal list manipulation where we know
17 * the prev/next entries already!
20 void __list_add(struct list_head
*new,
21 struct list_head
*prev
,
22 struct list_head
*next
)
24 WARN(next
->prev
!= prev
,
25 "list_add corruption. next->prev should be "
26 "prev (%p), but was %p. (next=%p).\n",
27 prev
, next
->prev
, next
);
28 WARN(prev
->next
!= next
,
29 "list_add corruption. prev->next should be "
30 "next (%p), but was %p. (prev=%p).\n",
31 next
, prev
->next
, prev
);
37 EXPORT_SYMBOL(__list_add
);
39 void __list_del_entry(struct list_head
*entry
)
41 struct list_head
*prev
, *next
;
46 if (WARN(next
== LIST_POISON1
,
47 "list_del corruption, %p->next is LIST_POISON1 (%p)\n",
48 entry
, LIST_POISON1
) ||
49 WARN(prev
== LIST_POISON2
,
50 "list_del corruption, %p->prev is LIST_POISON2 (%p)\n",
51 entry
, LIST_POISON2
) ||
52 WARN(prev
->next
!= entry
,
53 "list_del corruption. prev->next should be %p, "
54 "but was %p\n", entry
, prev
->next
) ||
55 WARN(next
->prev
!= entry
,
56 "list_del corruption. next->prev should be %p, "
57 "but was %p\n", entry
, next
->prev
))
60 __list_del(prev
, next
);
62 EXPORT_SYMBOL(__list_del_entry
);
65 * list_del - deletes entry from list.
66 * @entry: the element to delete from the list.
67 * Note: list_empty on entry does not return true after this, the entry is
68 * in an undefined state.
70 void list_del(struct list_head
*entry
)
72 __list_del_entry(entry
);
73 entry
->next
= LIST_POISON1
;
74 entry
->prev
= LIST_POISON2
;
76 EXPORT_SYMBOL(list_del
);