Subversion Repositories Kolibri OS

Rev

Rev 6934 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6934 Rev 6936
Line 22... Line 22...
22
#define LIST_HEAD(name) \
22
#define LIST_HEAD(name) \
23
	struct list_head name = LIST_HEAD_INIT(name)
23
	struct list_head name = LIST_HEAD_INIT(name)
Line 24... Line 24...
24
 
24
 
25
static inline void INIT_LIST_HEAD(struct list_head *list)
25
static inline void INIT_LIST_HEAD(struct list_head *list)
26
{
26
{
27
	list->next = list;
27
	WRITE_ONCE(list->next, list);
28
	list->prev = list;
28
	list->prev = list;
Line 29... Line 29...
29
}
29
}
30
 
30
 
Line 40... Line 40...
40
			      struct list_head *next)
40
			      struct list_head *next)
41
{
41
{
42
	next->prev = new;
42
	next->prev = new;
43
	new->next = next;
43
	new->next = next;
44
	new->prev = prev;
44
	new->prev = prev;
45
	prev->next = new;
45
	WRITE_ONCE(prev->next, new);
46
}
46
}
47
#else
47
#else
48
extern void __list_add(struct list_head *new,
48
extern void __list_add(struct list_head *new,
49
			      struct list_head *prev,
49
			      struct list_head *prev,
50
			      struct list_head *next);
50
			      struct list_head *next);
Line 184... Line 184...
184
 * list_empty - tests whether a list is empty
184
 * list_empty - tests whether a list is empty
185
 * @head: the list to test.
185
 * @head: the list to test.
186
 */
186
 */
187
static inline int list_empty(const struct list_head *head)
187
static inline int list_empty(const struct list_head *head)
188
{
188
{
189
	return head->next == head;
189
	return READ_ONCE(head->next) == head;
190
}
190
}
Line 191... Line 191...
191
 
191
 
192
/**
192
/**
193
 * list_empty_careful - tests whether a list is empty and not being modified
193
 * list_empty_careful - tests whether a list is empty and not being modified
Line 606... Line 606...
606
	return !h->pprev;
606
	return !h->pprev;
607
}
607
}
Line 608... Line 608...
608
 
608
 
609
static inline int hlist_empty(const struct hlist_head *h)
609
static inline int hlist_empty(const struct hlist_head *h)
610
{
610
{
611
	return !h->first;
611
	return !READ_ONCE(h->first);
Line 612... Line 612...
612
}
612
}
613
 
613
 
614
static inline void __hlist_del(struct hlist_node *n)
614
static inline void __hlist_del(struct hlist_node *n)
Line 640... Line 640...
640
{
640
{
641
	struct hlist_node *first = h->first;
641
	struct hlist_node *first = h->first;
642
	n->next = first;
642
	n->next = first;
643
	if (first)
643
	if (first)
644
		first->pprev = &n->next;
644
		first->pprev = &n->next;
645
	h->first = n;
645
	WRITE_ONCE(h->first, n);
646
	n->pprev = &h->first;
646
	n->pprev = &h->first;
647
}
647
}
Line 648... Line 648...
648
 
648
 
649
/* next must be != NULL */
649
/* next must be != NULL */
650
static inline void hlist_add_before(struct hlist_node *n,
650
static inline void hlist_add_before(struct hlist_node *n,
651
					struct hlist_node *next)
651
					struct hlist_node *next)
652
{
652
{
653
	n->pprev = next->pprev;
653
	n->pprev = next->pprev;
654
	n->next = next;
654
	n->next = next;
655
	next->pprev = &n->next;
655
	next->pprev = &n->next;
656
	*(n->pprev) = n;
656
	WRITE_ONCE(*(n->pprev), n);
Line 657... Line 657...
657
}
657
}
658
 
658
 
659
static inline void hlist_add_behind(struct hlist_node *n,
659
static inline void hlist_add_behind(struct hlist_node *n,
660
				    struct hlist_node *prev)
660
				    struct hlist_node *prev)
661
{
661
{
662
	n->next = prev->next;
662
	n->next = prev->next;
Line 663... Line 663...
663
	prev->next = n;
663
	WRITE_ONCE(prev->next, n);
664
	n->pprev = &prev->next;
664
	n->pprev = &prev->next;
665
 
665