From 16aa9ee87cf4364921c36025359be01390338d87 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Thu, 18 Nov 2010 15:48:01 -0500 Subject: [PATCH] Rename all data structure with prefix cds_ This is the third and last patch of the namespace refactoring. The prefix cds_ stands for Concurrent Data Structure and is use for queue, list, hlist and stack. For RCU protected data strucutre, the prefix is also added but the suffix _rcu is appended. This suffix indicate and RCU protection. Signed-off-by: David Goulet Signed-off-by: Mathieu Desnoyers --- rculfqueue.c | 18 +- rculfstack.c | 16 +- tests/api_gcc.h | 398 +++++++++++++++++++-------------------- tests/api_ppc.h | 398 +++++++++++++++++++-------------------- tests/api_x86.h | 398 +++++++++++++++++++-------------------- tests/test_urcu_lfq.c | 22 +-- tests/test_urcu_lfs.c | 18 +- tests/test_urcu_wfq.c | 18 +- tests/test_urcu_wfs.c | 18 +- urcu-bp-static.h | 2 +- urcu-bp.c | 18 +- urcu-defer-static.h | 2 +- urcu-defer.c | 20 +- urcu-qsbr-static.h | 2 +- urcu-qsbr.c | 22 +-- urcu-static.h | 2 +- urcu.c | 28 +-- urcu/hlist.h | 34 ++-- urcu/list.h | 70 +++---- urcu/rcuhlist.h | 14 +- urcu/rculfqueue-static.h | 18 +- urcu/rculfqueue.h | 30 +-- urcu/rculfstack-static.h | 20 +- urcu/rculfstack.h | 26 +-- urcu/rculist.h | 14 +- urcu/wfqueue-static.h | 30 +-- urcu/wfqueue.h | 32 ++-- urcu/wfstack-static.h | 36 ++-- urcu/wfstack.h | 30 +-- wfqueue.c | 20 +- wfstack.c | 20 +- 31 files changed, 897 insertions(+), 897 deletions(-) diff --git a/rculfqueue.c b/rculfqueue.c index 85c7b88..508e05c 100644 --- a/rculfqueue.c +++ b/rculfqueue.c @@ -30,23 +30,23 @@ * library wrappers to be used by non-LGPL compatible source code. */ -void rcu_lfq_node_init(struct rcu_lfq_node *node) +void cds_lfq_node_init_rcu(struct cds_lfq_node_rcu *node) { - _rcu_lfq_node_init(node); + _cds_lfq_node_init_rcu(node); } -void rcu_lfq_init(struct rcu_lfq_queue *q) +void cds_lfq_init_rcu(struct cds_lfq_queue_rcu *q) { - _rcu_lfq_init(q); + _cds_lfq_init_rcu(q); } -void rcu_lfq_enqueue(struct rcu_lfq_queue *q, struct rcu_lfq_node *node) +void cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q, struct cds_lfq_node_rcu *node) { - _rcu_lfq_enqueue(q, node); + _cds_lfq_enqueue_rcu(q, node); } -struct rcu_lfq_node * -rcu_lfq_dequeue(struct rcu_lfq_queue *q, void (*release)(struct urcu_ref *)) +struct cds_lfq_node_rcu * +cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu *q, void (*release)(struct urcu_ref *)) { - return _rcu_lfq_dequeue(q, release); + return _cds_lfq_dequeue_rcu(q, release); } diff --git a/rculfstack.c b/rculfstack.c index 01d549b..2c26046 100644 --- a/rculfstack.c +++ b/rculfstack.c @@ -31,22 +31,22 @@ */ -void rcu_lfs_node_init(struct rcu_lfs_node *node) +void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node) { - _rcu_lfs_node_init(node); + _cds_lfs_node_init_rcu(node); } -void rcu_lfs_init(struct rcu_lfs_stack *s) +void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s) { - _rcu_lfs_init(s); + _cds_lfs_init_rcu(s); } -void rcu_lfs_push(struct rcu_lfs_stack *s, struct rcu_lfs_node *node) +void cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, struct cds_lfs_node_rcu *node) { - _rcu_lfs_push(s, node); + _cds_lfs_push_rcu(s, node); } -struct rcu_lfs_node *rcu_lfs_pop(struct rcu_lfs_stack *s) +struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s) { - return _rcu_lfs_pop(s); + return _cds_lfs_pop_rcu(s); } diff --git a/tests/api_gcc.h b/tests/api_gcc.h index 632bdd5..2db1ef2 100644 --- a/tests/api_gcc.h +++ b/tests/api_gcc.h @@ -656,16 +656,16 @@ static void smp_init(void) * using the generic single-entry routines. */ -struct list_head { - struct list_head *next, *prev; +struct cds_list_head { + struct cds_list_head *next, *prev; }; -#define LIST_HEAD_INIT(name) { &(name), &(name) } +#define CDS_LIST_HEAD_INIT(name) { &(name), &(name) } -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) +#define CDS_LIST_HEAD(name) \ + struct cds_list_head name = CDS_LIST_HEAD_INIT(name) -static inline void INIT_LIST_HEAD(struct list_head *list) +static inline void CDS_INIT_LIST_HEAD(struct cds_list_head *list) { list->next = list; list->prev = list; @@ -678,9 +678,9 @@ static inline void INIT_LIST_HEAD(struct list_head *list) * the prev/next entries already! */ #ifndef CONFIG_DEBUG_LIST -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) +static inline void __cds_list_add(struct cds_list_head *new, + struct cds_list_head *prev, + struct cds_list_head *next) { next->prev = new; new->next = next; @@ -688,36 +688,36 @@ static inline void __list_add(struct list_head *new, prev->next = new; } #else -extern void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next); +extern void __cds_list_add(struct cds_list_head *new, + struct cds_list_head *prev, + struct cds_list_head *next); #endif /** - * list_add - add a new entry + * cds_list_add - add a new entry * @new: new entry to be added * @head: list head to add it after * * Insert a new entry after the specified head. * This is good for implementing stacks. */ -static inline void list_add(struct list_head *new, struct list_head *head) +static inline void cds_list_add(struct cds_list_head *new, struct cds_list_head *head) { - __list_add(new, head, head->next); + __cds_list_add(new, head, head->next); } /** - * list_add_tail - add a new entry + * cds_list_add_tail - add a new entry * @new: new entry to be added * @head: list head to add it before * * Insert a new entry before the specified head. * This is useful for implementing queues. */ -static inline void list_add_tail(struct list_head *new, struct list_head *head) +static inline void cds_list_add_tail(struct cds_list_head *new, struct cds_list_head *head) { - __list_add(new, head->prev, head); + __cds_list_add(new, head->prev, head); } /* @@ -727,38 +727,38 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head) * This is only for internal list manipulation where we know * the prev/next entries already! */ -static inline void __list_del(struct list_head * prev, struct list_head * next) +static inline void __cds_list_del(struct cds_list_head * prev, struct cds_list_head * next) { next->prev = prev; prev->next = next; } /** - * list_del - deletes entry from list. + * cds_list_del - deletes entry from list. * @entry: the element to delete from the list. - * Note: list_empty() on entry does not return true after this, the entry is + * Note: cds_list_empty() on entry does not return true after this, the entry is * in an undefined state. */ #ifndef CONFIG_DEBUG_LIST -static inline void list_del(struct list_head *entry) +static inline void cds_list_del(struct cds_list_head *entry) { - __list_del(entry->prev, entry->next); + __cds_list_del(entry->prev, entry->next); entry->next = LIST_POISON1; entry->prev = LIST_POISON2; } #else -extern void list_del(struct list_head *entry); +extern void cds_list_del(struct cds_list_head *entry); #endif /** - * list_replace - replace old entry by new one + * cds_list_replace - replace old entry by new one * @old : the element to be replaced * @new : the new element to insert * * If @old was empty, it will be overwritten. */ -static inline void list_replace(struct list_head *old, - struct list_head *new) +static inline void cds_list_replace(struct cds_list_head *old, + struct cds_list_head *new) { new->next = old->next; new->next->prev = new; @@ -766,44 +766,44 @@ static inline void list_replace(struct list_head *old, new->prev->next = new; } -static inline void list_replace_init(struct list_head *old, - struct list_head *new) +static inline void cds_list_replace_init(struct cds_list_head *old, + struct cds_list_head *new) { - list_replace(old, new); - INIT_LIST_HEAD(old); + cds_list_replace(old, new); + CDS_INIT_LIST_HEAD(old); } /** - * list_del_init - deletes entry from list and reinitialize it. + * cds_list_del_init - deletes entry from list and reinitialize it. * @entry: the element to delete from the list. */ -static inline void list_del_init(struct list_head *entry) +static inline void cds_list_del_init(struct cds_list_head *entry) { - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); + __cds_list_del(entry->prev, entry->next); + CDS_INIT_LIST_HEAD(entry); } /** - * list_move - delete from one list and add as another's head + * cds_list_move - delete from one list and add as another's head * @list: the entry to move * @head: the head that will precede our entry */ -static inline void list_move(struct list_head *list, struct list_head *head) +static inline void cds_list_move(struct cds_list_head *list, struct cds_list_head *head) { - __list_del(list->prev, list->next); - list_add(list, head); + __cds_list_del(list->prev, list->next); + cds_list_add(list, head); } /** - * list_move_tail - delete from one list and add as another's tail + * cds_list_move_tail - delete from one list and add as another's tail * @list: the entry to move * @head: the head that will follow our entry */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) +static inline void cds_list_move_tail(struct cds_list_head *list, + struct cds_list_head *head) { - __list_del(list->prev, list->next); - list_add_tail(list, head); + __cds_list_del(list->prev, list->next); + cds_list_add_tail(list, head); } /** @@ -811,37 +811,37 @@ static inline void list_move_tail(struct list_head *list, * @list: the entry to test * @head: the head of the list */ -static inline int list_is_last(const struct list_head *list, - const struct list_head *head) +static inline int list_is_last(const struct cds_list_head *list, + const struct cds_list_head *head) { return list->next == head; } /** - * list_empty - tests whether a list is empty + * cds_list_empty - tests whether a list is empty * @head: the list to test. */ -static inline int list_empty(const struct list_head *head) +static inline int cds_list_empty(const struct cds_list_head *head) { return head->next == head; } /** - * list_empty_careful - tests whether a list is empty and not being modified + * cds_list_empty_careful - tests whether a list is empty and not being modified * @head: the list to test * * Description: * tests whether a list is empty _and_ checks that no other CPU might be * in the process of modifying either member (next or prev) * - * NOTE: using list_empty_careful() without synchronization + * NOTE: using cds_list_empty_careful() without synchronization * can only be safe if the only activity that can happen - * to the list entry is list_del_init(). Eg. it cannot be used + * to the list entry is cds_list_del_init(). Eg. it cannot be used * if another CPU could re-list_add() it. */ -static inline int list_empty_careful(const struct list_head *head) +static inline int cds_list_empty_careful(const struct cds_list_head *head) { - struct list_head *next = head->next; + struct cds_list_head *next = head->next; return (next == head) && (next == head->prev); } @@ -849,15 +849,15 @@ static inline int list_empty_careful(const struct list_head *head) * list_is_singular - tests whether a list has just one entry. * @head: the list to test. */ -static inline int list_is_singular(const struct list_head *head) +static inline int list_is_singular(const struct cds_list_head *head) { return !list_empty(head) && (head->next == head->prev); } -static inline void __list_cut_position(struct list_head *list, - struct list_head *head, struct list_head *entry) +static inline void __list_cut_position(struct cds_list_head *list, + struct cds_list_head *head, struct cds_list_head *entry) { - struct list_head *new_first = entry->next; + struct cds_list_head *new_first = entry->next; list->next = head->next; list->next->prev = list; list->prev = entry; @@ -880,26 +880,26 @@ static inline void __list_cut_position(struct list_head *list, * losing its data. * */ -static inline void list_cut_position(struct list_head *list, - struct list_head *head, struct list_head *entry) +static inline void list_cut_position(struct cds_list_head *list, + struct cds_list_head *head, struct cds_list_head *entry) { - if (list_empty(head)) + if (cds_list_empty(head)) return; if (list_is_singular(head) && (head->next != entry && head != entry)) return; if (entry == head) - INIT_LIST_HEAD(list); + CDS_INIT_LIST_HEAD(list); else __list_cut_position(list, head, entry); } -static inline void __list_splice(const struct list_head *list, - struct list_head *prev, - struct list_head *next) +static inline void __cds_list_splice(const struct cds_list_head *list, + struct cds_list_head *prev, + struct cds_list_head *next) { - struct list_head *first = list->next; - struct list_head *last = list->prev; + struct cds_list_head *first = list->next; + struct cds_list_head *last = list->prev; first->prev = prev; prev->next = first; @@ -909,69 +909,69 @@ static inline void __list_splice(const struct list_head *list, } /** - * list_splice - join two lists, this is designed for stacks + * cds_list_splice - join two lists, this is designed for stacks * @list: the new list to add. * @head: the place to add it in the first list. */ -static inline void list_splice(const struct list_head *list, - struct list_head *head) +static inline void cds_list_splice(const struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) - __list_splice(list, head, head->next); + if (!cds_list_empty(list)) + __cds_list_splice(list, head, head->next); } /** - * list_splice_tail - join two lists, each list being a queue + * cds_list_splice_tail - join two lists, each list being a queue * @list: the new list to add. * @head: the place to add it in the first list. */ -static inline void list_splice_tail(struct list_head *list, - struct list_head *head) +static inline void cds_list_splice_tail(struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) - __list_splice(list, head->prev, head); + if (!cds_list_empty(list)) + __cds_list_splice(list, head->prev, head); } /** - * list_splice_init - join two lists and reinitialise the emptied list. + * cds_list_splice_init - join two lists and reinitialise the emptied list. * @list: the new list to add. * @head: the place to add it in the first list. * * The list at @list is reinitialised */ -static inline void list_splice_init(struct list_head *list, - struct list_head *head) +static inline void cds_list_splice_init(struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) { - __list_splice(list, head, head->next); - INIT_LIST_HEAD(list); + if (!cds_list_empty(list)) { + __cds_list_splice(list, head, head->next); + CDS_INIT_LIST_HEAD(list); } } /** - * list_splice_tail_init - join two lists and reinitialise the emptied list + * cds_list_splice_tail_init - join two lists and reinitialise the emptied list * @list: the new list to add. * @head: the place to add it in the first list. * * Each of the lists is a queue. * The list at @list is reinitialised */ -static inline void list_splice_tail_init(struct list_head *list, - struct list_head *head) +static inline void cds_list_splice_tail_init(struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) { - __list_splice(list, head->prev, head); - INIT_LIST_HEAD(list); + if (!cds_list_empty(list)) { + __cds_list_splice(list, head->prev, head); + CDS_INIT_LIST_HEAD(list); } } /** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. + * cds_list_entry - get the struct for this entry + * @ptr: the &struct cds_list_head pointer. * @type: the type of the struct this is embedded in. * @member: the name of the list_struct within the struct. */ -#define list_entry(ptr, type, member) \ +#define cds_list_entry(ptr, type, member) \ caa_container_of(ptr, type, member) /** @@ -983,95 +983,95 @@ static inline void list_splice_tail_init(struct list_head *list, * Note, that list is expected to be not empty. */ #define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) + cds_list_entry((ptr)->next, type, member) /** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop cursor. + * cds_list_for_each - iterate over a list + * @pos: the &struct cds_list_head to use as a loop cursor. * @head: the head for your list. */ -#define list_for_each(pos, head) \ +#define cds_list_for_each(pos, head) \ for (pos = (head)->next; prefetch(pos->next), pos != (head); \ pos = pos->next) /** - * __list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop cursor. + * __cds_list_for_each - iterate over a list + * @pos: the &struct cds_list_head to use as a loop cursor. * @head: the head for your list. * - * This variant differs from list_for_each() in that it's the + * This variant differs from cds_list_for_each() in that it's the * simplest possible list iteration code, no prefetching is done. * Use this for code that knows the list to be very short (empty * or 1 entry) most of the time. */ -#define __list_for_each(pos, head) \ +#define __cds_list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) /** - * list_for_each_prev - iterate over a list backwards - * @pos: the &struct list_head to use as a loop cursor. + * cds_list_for_each_prev - iterate over a list backwards + * @pos: the &struct cds_list_head to use as a loop cursor. * @head: the head for your list. */ -#define list_for_each_prev(pos, head) \ +#define cds_list_for_each_prev(pos, head) \ for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \ pos = pos->prev) /** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop cursor. - * @n: another &struct list_head to use as temporary storage + * cds_list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct cds_list_head to use as a loop cursor. + * @n: another &struct cds_list_head to use as temporary storage * @head: the head for your list. */ -#define list_for_each_safe(pos, n, head) \ +#define cds_list_for_each_safe(pos, n, head) \ for (pos = (head)->next, n = pos->next; pos != (head); \ pos = n, n = pos->next) /** - * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry - * @pos: the &struct list_head to use as a loop cursor. - * @n: another &struct list_head to use as temporary storage + * cds_list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry + * @pos: the &struct cds_list_head to use as a loop cursor. + * @n: another &struct cds_list_head to use as temporary storage * @head: the head for your list. */ -#define list_for_each_prev_safe(pos, n, head) \ +#define cds_list_for_each_prev_safe(pos, n, head) \ for (pos = (head)->prev, n = pos->prev; \ prefetch(pos->prev), pos != (head); \ pos = n, n = pos->prev) /** - * list_for_each_entry - iterate over list of given type + * cds_list_for_each_entry - iterate over list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ +#define cds_list_for_each_entry(pos, head, member) \ + for (pos = cds_list_entry((head)->next, typeof(*pos), member); \ prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + pos = cds_list_entry(pos->member.next, typeof(*pos), member)) /** - * list_for_each_entry_reverse - iterate backwards over list of given type. + * cds_list_for_each_entry_reverse - iterate backwards over list of given type. * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. */ -#define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member); \ +#define cds_list_for_each_entry_reverse(pos, head, member) \ + for (pos = cds_list_entry((head)->prev, typeof(*pos), member); \ prefetch(pos->member.prev), &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) + pos = cds_list_entry(pos->member.prev, typeof(*pos), member)) /** - * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() + * list_prepare_entry - prepare a pos entry for use in cds_list_for_each_entry_continue() * @pos: the type * to use as a start point * @head: the head of the list * @member: the name of the list_struct within the struct. * - * Prepares a pos entry for use as a start point in list_for_each_entry_continue(). + * Prepares a pos entry for use as a start point in cds_list_for_each_entry_continue(). */ #define list_prepare_entry(pos, head, member) \ - ((pos) ? : list_entry(head, typeof(*pos), member)) + ((pos) ? : cds_list_entry(head, typeof(*pos), member)) /** - * list_for_each_entry_continue - continue iteration over list of given type + * cds_list_for_each_entry_continue - continue iteration over list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. @@ -1079,13 +1079,13 @@ static inline void list_splice_tail_init(struct list_head *list, * Continue to iterate over list of given type, continuing after * the current position. */ -#define list_for_each_entry_continue(pos, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_continue(pos, head, member) \ + for (pos = cds_list_entry(pos->member.next, typeof(*pos), member); \ prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + pos = cds_list_entry(pos->member.next, typeof(*pos), member)) /** - * list_for_each_entry_continue_reverse - iterate backwards from the given point + * cds_list_for_each_entry_continue_reverse - iterate backwards from the given point * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. @@ -1093,38 +1093,38 @@ static inline void list_splice_tail_init(struct list_head *list, * Start to iterate over list of given type backwards, continuing after * the current position. */ -#define list_for_each_entry_continue_reverse(pos, head, member) \ - for (pos = list_entry(pos->member.prev, typeof(*pos), member); \ +#define cds_list_for_each_entry_continue_reverse(pos, head, member) \ + for (pos = cds_list_entry(pos->member.prev, typeof(*pos), member); \ prefetch(pos->member.prev), &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) + pos = cds_list_entry(pos->member.prev, typeof(*pos), member)) /** - * list_for_each_entry_from - iterate over list of given type from the current point + * cds_list_for_each_entry_from - iterate over list of given type from the current point * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. * * Iterate over list of given type, continuing from current position. */ -#define list_for_each_entry_from(pos, head, member) \ +#define cds_list_for_each_entry_from(pos, head, member) \ for (; prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + pos = cds_list_entry(pos->member.next, typeof(*pos), member)) /** - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * cds_list_for_each_entry_safe - iterate over list of given type safe against removal of list entry * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. * @member: the name of the list_struct within the struct. */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe(pos, n, head, member) \ + for (pos = cds_list_entry((head)->next, typeof(*pos), member), \ + n = cds_list_entry(pos->member.next, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.next, typeof(*n), member)) /** - * list_for_each_entry_safe_continue + * cds_list_for_each_entry_safe_continue * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. @@ -1133,14 +1133,14 @@ static inline void list_splice_tail_init(struct list_head *list, * Iterate over list of given type, continuing after current point, * safe against removal of list entry. */ -#define list_for_each_entry_safe_continue(pos, n, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe_continue(pos, n, head, member) \ + for (pos = cds_list_entry(pos->member.next, typeof(*pos), member), \ + n = cds_list_entry(pos->member.next, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.next, typeof(*n), member)) /** - * list_for_each_entry_safe_from + * cds_list_for_each_entry_safe_from * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. @@ -1149,13 +1149,13 @@ static inline void list_splice_tail_init(struct list_head *list, * Iterate over list of given type from current point, safe against * removal of list entry. */ -#define list_for_each_entry_safe_from(pos, n, head, member) \ - for (n = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe_from(pos, n, head, member) \ + for (n = cds_list_entry(pos->member.next, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.next, typeof(*n), member)) /** - * list_for_each_entry_safe_reverse + * cds_list_for_each_entry_safe_reverse * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. @@ -1164,11 +1164,11 @@ static inline void list_splice_tail_init(struct list_head *list, * Iterate backwards over list of given type, safe against removal * of list entry. */ -#define list_for_each_entry_safe_reverse(pos, n, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member), \ - n = list_entry(pos->member.prev, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe_reverse(pos, n, head, member) \ + for (pos = cds_list_entry((head)->prev, typeof(*pos), member), \ + n = cds_list_entry(pos->member.prev, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.prev, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.prev, typeof(*n), member)) #endif //0 @@ -1179,60 +1179,60 @@ static inline void list_splice_tail_init(struct list_head *list, * You lose the ability to access the tail in O(1). */ -struct hlist_head { - struct hlist_node *first; +struct cds_hlist_head { + struct cds_hlist_node *first; }; -struct hlist_node { - struct hlist_node *next, **pprev; +struct cds_hlist_node { + struct cds_hlist_node *next, **pprev; }; #define HLIST_HEAD_INIT { .first = NULL } -#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } -#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) -static inline void INIT_HLIST_NODE(struct hlist_node *h) +#define HLIST_HEAD(name) struct cds_hlist_head name = { .first = NULL } +#define CDS_INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) +static inline void INIT_HLIST_NODE(struct cds_hlist_node *h) { h->next = NULL; h->pprev = NULL; } -static inline int hlist_unhashed(const struct hlist_node *h) +static inline int hlist_unhashed(const struct cds_hlist_node *h) { return !h->pprev; } -static inline int hlist_empty(const struct hlist_head *h) +static inline int hlist_empty(const struct cds_hlist_head *h) { return !h->first; } -static inline void __hlist_del(struct hlist_node *n) +static inline void __cds_hlist_del(struct cds_hlist_node *n) { - struct hlist_node *next = n->next; - struct hlist_node **pprev = n->pprev; + struct cds_hlist_node *next = n->next; + struct cds_hlist_node **pprev = n->pprev; *pprev = next; if (next) next->pprev = pprev; } -static inline void hlist_del(struct hlist_node *n) +static inline void cds_hlist_del(struct cds_hlist_node *n) { - __hlist_del(n); + __cds_hlist_del(n); n->next = LIST_POISON1; n->pprev = LIST_POISON2; } -static inline void hlist_del_init(struct hlist_node *n) +static inline void cds_hlist_del_init(struct cds_hlist_node *n) { if (!hlist_unhashed(n)) { - __hlist_del(n); + __cds_hlist_del(n); INIT_HLIST_NODE(n); } } -static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) +static inline void cds_hlist_add_head(struct cds_hlist_node *n, struct cds_hlist_head *h) { - struct hlist_node *first = h->first; + struct cds_hlist_node *first = h->first; n->next = first; if (first) first->pprev = &n->next; @@ -1241,8 +1241,8 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) } /* next must be != NULL */ -static inline void hlist_add_before(struct hlist_node *n, - struct hlist_node *next) +static inline void hlist_add_before(struct cds_hlist_node *n, + struct cds_hlist_node *next) { n->pprev = next->pprev; n->next = next; @@ -1250,8 +1250,8 @@ static inline void hlist_add_before(struct hlist_node *n, *(n->pprev) = n; } -static inline void hlist_add_after(struct hlist_node *n, - struct hlist_node *next) +static inline void hlist_add_after(struct cds_hlist_node *n, + struct cds_hlist_node *next) { next->next = n->next; n->next = next; @@ -1265,8 +1265,8 @@ static inline void hlist_add_after(struct hlist_node *n, * Move a list from one list head to another. Fixup the pprev * reference of the first entry if it exists. */ -static inline void hlist_move_list(struct hlist_head *old, - struct hlist_head *new) +static inline void hlist_move_list(struct cds_hlist_head *old, + struct cds_hlist_head *new) { new->first = old->first; if (new->first) @@ -1274,64 +1274,64 @@ static inline void hlist_move_list(struct hlist_head *old, old->first = NULL; } -#define hlist_entry(ptr, type, member) caa_container_of(ptr,type,member) +#define cds_hlist_entry(ptr, type, member) caa_container_of(ptr,type,member) -#define hlist_for_each(pos, head) \ +#define cds_hlist_for_each(pos, head) \ for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \ pos = pos->next) -#define hlist_for_each_safe(pos, n, head) \ +#define cds_hlist_for_each_safe(pos, n, head) \ for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ pos = n) /** - * hlist_for_each_entry - iterate over list of given type + * cds_hlist_for_each_entry - iterate over list of given type * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. + * @pos: the &struct cds_hlist_node to use as a loop cursor. * @head: the head for your list. - * @member: the name of the hlist_node within the struct. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry(tpos, pos, head, member) \ +#define cds_hlist_for_each_entry(tpos, pos, head, member) \ for (pos = (head)->first; \ pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = pos->next) /** - * hlist_for_each_entry_continue - iterate over a hlist continuing after current point + * cds_hlist_for_each_entry_continue - iterate over a hlist continuing after current point * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. - * @member: the name of the hlist_node within the struct. + * @pos: the &struct cds_hlist_node to use as a loop cursor. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry_continue(tpos, pos, member) \ +#define cds_hlist_for_each_entry_continue(tpos, pos, member) \ for (pos = (pos)->next; \ pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = pos->next) /** - * hlist_for_each_entry_from - iterate over a hlist continuing from current point + * cds_hlist_for_each_entry_from - iterate over a hlist continuing from current point * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. - * @member: the name of the hlist_node within the struct. + * @pos: the &struct cds_hlist_node to use as a loop cursor. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry_from(tpos, pos, member) \ +#define cds_hlist_for_each_entry_from(tpos, pos, member) \ for (; pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = pos->next) /** - * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * cds_hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. - * @n: another &struct hlist_node to use as temporary storage + * @pos: the &struct cds_hlist_node to use as a loop cursor. + * @n: another &struct cds_hlist_node to use as temporary storage * @head: the head for your list. - * @member: the name of the hlist_node within the struct. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ +#define cds_hlist_for_each_entry_safe(tpos, pos, n, head, member) \ for (pos = (head)->first; \ pos && ({ n = pos->next; 1; }) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = n) #endif diff --git a/tests/api_ppc.h b/tests/api_ppc.h index 5c5f6e9..038c9cb 100644 --- a/tests/api_ppc.h +++ b/tests/api_ppc.h @@ -1015,16 +1015,16 @@ static void smp_init(void) * using the generic single-entry routines. */ -struct list_head { - struct list_head *next, *prev; +struct cds_list_head { + struct cds_list_head *next, *prev; }; -#define LIST_HEAD_INIT(name) { &(name), &(name) } +#define CDS_LIST_HEAD_INIT(name) { &(name), &(name) } -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) +#define CDS_LIST_HEAD(name) \ + struct cds_list_head name = CDS_LIST_HEAD_INIT(name) -static inline void INIT_LIST_HEAD(struct list_head *list) +static inline void CDS_INIT_LIST_HEAD(struct cds_list_head *list) { list->next = list; list->prev = list; @@ -1037,9 +1037,9 @@ static inline void INIT_LIST_HEAD(struct list_head *list) * the prev/next entries already! */ #ifndef CONFIG_DEBUG_LIST -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) +static inline void __cds_list_add(struct cds_list_head *new, + struct cds_list_head *prev, + struct cds_list_head *next) { next->prev = new; new->next = next; @@ -1047,36 +1047,36 @@ static inline void __list_add(struct list_head *new, prev->next = new; } #else -extern void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next); +extern void __cds_list_add(struct cds_list_head *new, + struct cds_list_head *prev, + struct cds_list_head *next); #endif /** - * list_add - add a new entry + * cds_list_add - add a new entry * @new: new entry to be added * @head: list head to add it after * * Insert a new entry after the specified head. * This is good for implementing stacks. */ -static inline void list_add(struct list_head *new, struct list_head *head) +static inline void cds_list_add(struct cds_list_head *new, struct cds_list_head *head) { - __list_add(new, head, head->next); + __cds_list_add(new, head, head->next); } /** - * list_add_tail - add a new entry + * cds_list_add_tail - add a new entry * @new: new entry to be added * @head: list head to add it before * * Insert a new entry before the specified head. * This is useful for implementing queues. */ -static inline void list_add_tail(struct list_head *new, struct list_head *head) +static inline void cds_list_add_tail(struct cds_list_head *new, struct cds_list_head *head) { - __list_add(new, head->prev, head); + __cds_list_add(new, head->prev, head); } /* @@ -1086,38 +1086,38 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head) * This is only for internal list manipulation where we know * the prev/next entries already! */ -static inline void __list_del(struct list_head * prev, struct list_head * next) +static inline void __cds_list_del(struct cds_list_head * prev, struct cds_list_head * next) { next->prev = prev; prev->next = next; } /** - * list_del - deletes entry from list. + * cds_list_del - deletes entry from list. * @entry: the element to delete from the list. - * Note: list_empty() on entry does not return true after this, the entry is + * Note: cds_list_empty() on entry does not return true after this, the entry is * in an undefined state. */ #ifndef CONFIG_DEBUG_LIST -static inline void list_del(struct list_head *entry) +static inline void cds_list_del(struct cds_list_head *entry) { - __list_del(entry->prev, entry->next); + __cds_list_del(entry->prev, entry->next); entry->next = LIST_POISON1; entry->prev = LIST_POISON2; } #else -extern void list_del(struct list_head *entry); +extern void cds_list_del(struct cds_list_head *entry); #endif /** - * list_replace - replace old entry by new one + * cds_list_replace - replace old entry by new one * @old : the element to be replaced * @new : the new element to insert * * If @old was empty, it will be overwritten. */ -static inline void list_replace(struct list_head *old, - struct list_head *new) +static inline void cds_list_replace(struct cds_list_head *old, + struct cds_list_head *new) { new->next = old->next; new->next->prev = new; @@ -1125,44 +1125,44 @@ static inline void list_replace(struct list_head *old, new->prev->next = new; } -static inline void list_replace_init(struct list_head *old, - struct list_head *new) +static inline void cds_list_replace_init(struct cds_list_head *old, + struct cds_list_head *new) { - list_replace(old, new); - INIT_LIST_HEAD(old); + cds_list_replace(old, new); + CDS_INIT_LIST_HEAD(old); } /** - * list_del_init - deletes entry from list and reinitialize it. + * cds_list_del_init - deletes entry from list and reinitialize it. * @entry: the element to delete from the list. */ -static inline void list_del_init(struct list_head *entry) +static inline void cds_list_del_init(struct cds_list_head *entry) { - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); + __cds_list_del(entry->prev, entry->next); + CDS_INIT_LIST_HEAD(entry); } /** - * list_move - delete from one list and add as another's head + * cds_list_move - delete from one list and add as another's head * @list: the entry to move * @head: the head that will precede our entry */ -static inline void list_move(struct list_head *list, struct list_head *head) +static inline void cds_list_move(struct cds_list_head *list, struct cds_list_head *head) { - __list_del(list->prev, list->next); - list_add(list, head); + __cds_list_del(list->prev, list->next); + cds_list_add(list, head); } /** - * list_move_tail - delete from one list and add as another's tail + * cds_list_move_tail - delete from one list and add as another's tail * @list: the entry to move * @head: the head that will follow our entry */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) +static inline void cds_list_move_tail(struct cds_list_head *list, + struct cds_list_head *head) { - __list_del(list->prev, list->next); - list_add_tail(list, head); + __cds_list_del(list->prev, list->next); + cds_list_add_tail(list, head); } /** @@ -1170,37 +1170,37 @@ static inline void list_move_tail(struct list_head *list, * @list: the entry to test * @head: the head of the list */ -static inline int list_is_last(const struct list_head *list, - const struct list_head *head) +static inline int list_is_last(const struct cds_list_head *list, + const struct cds_list_head *head) { return list->next == head; } /** - * list_empty - tests whether a list is empty + * cds_list_empty - tests whether a list is empty * @head: the list to test. */ -static inline int list_empty(const struct list_head *head) +static inline int cds_list_empty(const struct cds_list_head *head) { return head->next == head; } /** - * list_empty_careful - tests whether a list is empty and not being modified + * cds_list_empty_careful - tests whether a list is empty and not being modified * @head: the list to test * * Description: * tests whether a list is empty _and_ checks that no other CPU might be * in the process of modifying either member (next or prev) * - * NOTE: using list_empty_careful() without synchronization + * NOTE: using cds_list_empty_careful() without synchronization * can only be safe if the only activity that can happen - * to the list entry is list_del_init(). Eg. it cannot be used + * to the list entry is cds_list_del_init(). Eg. it cannot be used * if another CPU could re-list_add() it. */ -static inline int list_empty_careful(const struct list_head *head) +static inline int cds_list_empty_careful(const struct cds_list_head *head) { - struct list_head *next = head->next; + struct cds_list_head *next = head->next; return (next == head) && (next == head->prev); } @@ -1208,15 +1208,15 @@ static inline int list_empty_careful(const struct list_head *head) * list_is_singular - tests whether a list has just one entry. * @head: the list to test. */ -static inline int list_is_singular(const struct list_head *head) +static inline int list_is_singular(const struct cds_list_head *head) { return !list_empty(head) && (head->next == head->prev); } -static inline void __list_cut_position(struct list_head *list, - struct list_head *head, struct list_head *entry) +static inline void __list_cut_position(struct cds_list_head *list, + struct cds_list_head *head, struct cds_list_head *entry) { - struct list_head *new_first = entry->next; + struct cds_list_head *new_first = entry->next; list->next = head->next; list->next->prev = list; list->prev = entry; @@ -1239,26 +1239,26 @@ static inline void __list_cut_position(struct list_head *list, * losing its data. * */ -static inline void list_cut_position(struct list_head *list, - struct list_head *head, struct list_head *entry) +static inline void list_cut_position(struct cds_list_head *list, + struct cds_list_head *head, struct cds_list_head *entry) { - if (list_empty(head)) + if (cds_list_empty(head)) return; if (list_is_singular(head) && (head->next != entry && head != entry)) return; if (entry == head) - INIT_LIST_HEAD(list); + CDS_INIT_LIST_HEAD(list); else __list_cut_position(list, head, entry); } -static inline void __list_splice(const struct list_head *list, - struct list_head *prev, - struct list_head *next) +static inline void __cds_list_splice(const struct cds_list_head *list, + struct cds_list_head *prev, + struct cds_list_head *next) { - struct list_head *first = list->next; - struct list_head *last = list->prev; + struct cds_list_head *first = list->next; + struct cds_list_head *last = list->prev; first->prev = prev; prev->next = first; @@ -1268,69 +1268,69 @@ static inline void __list_splice(const struct list_head *list, } /** - * list_splice - join two lists, this is designed for stacks + * cds_list_splice - join two lists, this is designed for stacks * @list: the new list to add. * @head: the place to add it in the first list. */ -static inline void list_splice(const struct list_head *list, - struct list_head *head) +static inline void cds_list_splice(const struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) - __list_splice(list, head, head->next); + if (!cds_list_empty(list)) + __cds_list_splice(list, head, head->next); } /** - * list_splice_tail - join two lists, each list being a queue + * cds_list_splice_tail - join two lists, each list being a queue * @list: the new list to add. * @head: the place to add it in the first list. */ -static inline void list_splice_tail(struct list_head *list, - struct list_head *head) +static inline void cds_list_splice_tail(struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) - __list_splice(list, head->prev, head); + if (!cds_list_empty(list)) + __cds_list_splice(list, head->prev, head); } /** - * list_splice_init - join two lists and reinitialise the emptied list. + * cds_list_splice_init - join two lists and reinitialise the emptied list. * @list: the new list to add. * @head: the place to add it in the first list. * * The list at @list is reinitialised */ -static inline void list_splice_init(struct list_head *list, - struct list_head *head) +static inline void cds_list_splice_init(struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) { - __list_splice(list, head, head->next); - INIT_LIST_HEAD(list); + if (!cds_list_empty(list)) { + __cds_list_splice(list, head, head->next); + CDS_INIT_LIST_HEAD(list); } } /** - * list_splice_tail_init - join two lists and reinitialise the emptied list + * cds_list_splice_tail_init - join two lists and reinitialise the emptied list * @list: the new list to add. * @head: the place to add it in the first list. * * Each of the lists is a queue. * The list at @list is reinitialised */ -static inline void list_splice_tail_init(struct list_head *list, - struct list_head *head) +static inline void cds_list_splice_tail_init(struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) { - __list_splice(list, head->prev, head); - INIT_LIST_HEAD(list); + if (!cds_list_empty(list)) { + __cds_list_splice(list, head->prev, head); + CDS_INIT_LIST_HEAD(list); } } /** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. + * cds_list_entry - get the struct for this entry + * @ptr: the &struct cds_list_head pointer. * @type: the type of the struct this is embedded in. * @member: the name of the list_struct within the struct. */ -#define list_entry(ptr, type, member) \ +#define cds_list_entry(ptr, type, member) \ caa_container_of(ptr, type, member) /** @@ -1342,95 +1342,95 @@ static inline void list_splice_tail_init(struct list_head *list, * Note, that list is expected to be not empty. */ #define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) + cds_list_entry((ptr)->next, type, member) /** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop cursor. + * cds_list_for_each - iterate over a list + * @pos: the &struct cds_list_head to use as a loop cursor. * @head: the head for your list. */ -#define list_for_each(pos, head) \ +#define cds_list_for_each(pos, head) \ for (pos = (head)->next; prefetch(pos->next), pos != (head); \ pos = pos->next) /** - * __list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop cursor. + * __cds_list_for_each - iterate over a list + * @pos: the &struct cds_list_head to use as a loop cursor. * @head: the head for your list. * - * This variant differs from list_for_each() in that it's the + * This variant differs from cds_list_for_each() in that it's the * simplest possible list iteration code, no prefetching is done. * Use this for code that knows the list to be very short (empty * or 1 entry) most of the time. */ -#define __list_for_each(pos, head) \ +#define __cds_list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) /** - * list_for_each_prev - iterate over a list backwards - * @pos: the &struct list_head to use as a loop cursor. + * cds_list_for_each_prev - iterate over a list backwards + * @pos: the &struct cds_list_head to use as a loop cursor. * @head: the head for your list. */ -#define list_for_each_prev(pos, head) \ +#define cds_list_for_each_prev(pos, head) \ for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \ pos = pos->prev) /** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop cursor. - * @n: another &struct list_head to use as temporary storage + * cds_list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct cds_list_head to use as a loop cursor. + * @n: another &struct cds_list_head to use as temporary storage * @head: the head for your list. */ -#define list_for_each_safe(pos, n, head) \ +#define cds_list_for_each_safe(pos, n, head) \ for (pos = (head)->next, n = pos->next; pos != (head); \ pos = n, n = pos->next) /** - * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry - * @pos: the &struct list_head to use as a loop cursor. - * @n: another &struct list_head to use as temporary storage + * cds_list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry + * @pos: the &struct cds_list_head to use as a loop cursor. + * @n: another &struct cds_list_head to use as temporary storage * @head: the head for your list. */ -#define list_for_each_prev_safe(pos, n, head) \ +#define cds_list_for_each_prev_safe(pos, n, head) \ for (pos = (head)->prev, n = pos->prev; \ prefetch(pos->prev), pos != (head); \ pos = n, n = pos->prev) /** - * list_for_each_entry - iterate over list of given type + * cds_list_for_each_entry - iterate over list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ +#define cds_list_for_each_entry(pos, head, member) \ + for (pos = cds_list_entry((head)->next, typeof(*pos), member); \ prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + pos = cds_list_entry(pos->member.next, typeof(*pos), member)) /** - * list_for_each_entry_reverse - iterate backwards over list of given type. + * cds_list_for_each_entry_reverse - iterate backwards over list of given type. * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. */ -#define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member); \ +#define cds_list_for_each_entry_reverse(pos, head, member) \ + for (pos = cds_list_entry((head)->prev, typeof(*pos), member); \ prefetch(pos->member.prev), &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) + pos = cds_list_entry(pos->member.prev, typeof(*pos), member)) /** - * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() + * list_prepare_entry - prepare a pos entry for use in cds_list_for_each_entry_continue() * @pos: the type * to use as a start point * @head: the head of the list * @member: the name of the list_struct within the struct. * - * Prepares a pos entry for use as a start point in list_for_each_entry_continue(). + * Prepares a pos entry for use as a start point in cds_list_for_each_entry_continue(). */ #define list_prepare_entry(pos, head, member) \ - ((pos) ? : list_entry(head, typeof(*pos), member)) + ((pos) ? : cds_list_entry(head, typeof(*pos), member)) /** - * list_for_each_entry_continue - continue iteration over list of given type + * cds_list_for_each_entry_continue - continue iteration over list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. @@ -1438,13 +1438,13 @@ static inline void list_splice_tail_init(struct list_head *list, * Continue to iterate over list of given type, continuing after * the current position. */ -#define list_for_each_entry_continue(pos, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_continue(pos, head, member) \ + for (pos = cds_list_entry(pos->member.next, typeof(*pos), member); \ prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + pos = cds_list_entry(pos->member.next, typeof(*pos), member)) /** - * list_for_each_entry_continue_reverse - iterate backwards from the given point + * cds_list_for_each_entry_continue_reverse - iterate backwards from the given point * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. @@ -1452,38 +1452,38 @@ static inline void list_splice_tail_init(struct list_head *list, * Start to iterate over list of given type backwards, continuing after * the current position. */ -#define list_for_each_entry_continue_reverse(pos, head, member) \ - for (pos = list_entry(pos->member.prev, typeof(*pos), member); \ +#define cds_list_for_each_entry_continue_reverse(pos, head, member) \ + for (pos = cds_list_entry(pos->member.prev, typeof(*pos), member); \ prefetch(pos->member.prev), &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) + pos = cds_list_entry(pos->member.prev, typeof(*pos), member)) /** - * list_for_each_entry_from - iterate over list of given type from the current point + * cds_list_for_each_entry_from - iterate over list of given type from the current point * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. * * Iterate over list of given type, continuing from current position. */ -#define list_for_each_entry_from(pos, head, member) \ +#define cds_list_for_each_entry_from(pos, head, member) \ for (; prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + pos = cds_list_entry(pos->member.next, typeof(*pos), member)) /** - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * cds_list_for_each_entry_safe - iterate over list of given type safe against removal of list entry * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. * @member: the name of the list_struct within the struct. */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe(pos, n, head, member) \ + for (pos = cds_list_entry((head)->next, typeof(*pos), member), \ + n = cds_list_entry(pos->member.next, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.next, typeof(*n), member)) /** - * list_for_each_entry_safe_continue + * cds_list_for_each_entry_safe_continue * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. @@ -1492,14 +1492,14 @@ static inline void list_splice_tail_init(struct list_head *list, * Iterate over list of given type, continuing after current point, * safe against removal of list entry. */ -#define list_for_each_entry_safe_continue(pos, n, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe_continue(pos, n, head, member) \ + for (pos = cds_list_entry(pos->member.next, typeof(*pos), member), \ + n = cds_list_entry(pos->member.next, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.next, typeof(*n), member)) /** - * list_for_each_entry_safe_from + * cds_list_for_each_entry_safe_from * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. @@ -1508,13 +1508,13 @@ static inline void list_splice_tail_init(struct list_head *list, * Iterate over list of given type from current point, safe against * removal of list entry. */ -#define list_for_each_entry_safe_from(pos, n, head, member) \ - for (n = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe_from(pos, n, head, member) \ + for (n = cds_list_entry(pos->member.next, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.next, typeof(*n), member)) /** - * list_for_each_entry_safe_reverse + * cds_list_for_each_entry_safe_reverse * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. @@ -1523,11 +1523,11 @@ static inline void list_splice_tail_init(struct list_head *list, * Iterate backwards over list of given type, safe against removal * of list entry. */ -#define list_for_each_entry_safe_reverse(pos, n, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member), \ - n = list_entry(pos->member.prev, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe_reverse(pos, n, head, member) \ + for (pos = cds_list_entry((head)->prev, typeof(*pos), member), \ + n = cds_list_entry(pos->member.prev, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.prev, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.prev, typeof(*n), member)) #endif //0 @@ -1538,60 +1538,60 @@ static inline void list_splice_tail_init(struct list_head *list, * You lose the ability to access the tail in O(1). */ -struct hlist_head { - struct hlist_node *first; +struct cds_hlist_head { + struct cds_hlist_node *first; }; -struct hlist_node { - struct hlist_node *next, **pprev; +struct cds_hlist_node { + struct cds_hlist_node *next, **pprev; }; #define HLIST_HEAD_INIT { .first = NULL } -#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } -#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) -static inline void INIT_HLIST_NODE(struct hlist_node *h) +#define HLIST_HEAD(name) struct cds_hlist_head name = { .first = NULL } +#define CDS_INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) +static inline void INIT_HLIST_NODE(struct cds_hlist_node *h) { h->next = NULL; h->pprev = NULL; } -static inline int hlist_unhashed(const struct hlist_node *h) +static inline int hlist_unhashed(const struct cds_hlist_node *h) { return !h->pprev; } -static inline int hlist_empty(const struct hlist_head *h) +static inline int hlist_empty(const struct cds_hlist_head *h) { return !h->first; } -static inline void __hlist_del(struct hlist_node *n) +static inline void __cds_hlist_del(struct cds_hlist_node *n) { - struct hlist_node *next = n->next; - struct hlist_node **pprev = n->pprev; + struct cds_hlist_node *next = n->next; + struct cds_hlist_node **pprev = n->pprev; *pprev = next; if (next) next->pprev = pprev; } -static inline void hlist_del(struct hlist_node *n) +static inline void cds_hlist_del(struct cds_hlist_node *n) { - __hlist_del(n); + __cds_hlist_del(n); n->next = LIST_POISON1; n->pprev = LIST_POISON2; } -static inline void hlist_del_init(struct hlist_node *n) +static inline void cds_hlist_del_init(struct cds_hlist_node *n) { if (!hlist_unhashed(n)) { - __hlist_del(n); + __cds_hlist_del(n); INIT_HLIST_NODE(n); } } -static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) +static inline void cds_hlist_add_head(struct cds_hlist_node *n, struct cds_hlist_head *h) { - struct hlist_node *first = h->first; + struct cds_hlist_node *first = h->first; n->next = first; if (first) first->pprev = &n->next; @@ -1600,8 +1600,8 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) } /* next must be != NULL */ -static inline void hlist_add_before(struct hlist_node *n, - struct hlist_node *next) +static inline void hlist_add_before(struct cds_hlist_node *n, + struct cds_hlist_node *next) { n->pprev = next->pprev; n->next = next; @@ -1609,8 +1609,8 @@ static inline void hlist_add_before(struct hlist_node *n, *(n->pprev) = n; } -static inline void hlist_add_after(struct hlist_node *n, - struct hlist_node *next) +static inline void hlist_add_after(struct cds_hlist_node *n, + struct cds_hlist_node *next) { next->next = n->next; n->next = next; @@ -1624,8 +1624,8 @@ static inline void hlist_add_after(struct hlist_node *n, * Move a list from one list head to another. Fixup the pprev * reference of the first entry if it exists. */ -static inline void hlist_move_list(struct hlist_head *old, - struct hlist_head *new) +static inline void hlist_move_list(struct cds_hlist_head *old, + struct cds_hlist_head *new) { new->first = old->first; if (new->first) @@ -1633,64 +1633,64 @@ static inline void hlist_move_list(struct hlist_head *old, old->first = NULL; } -#define hlist_entry(ptr, type, member) caa_container_of(ptr,type,member) +#define cds_hlist_entry(ptr, type, member) caa_container_of(ptr,type,member) -#define hlist_for_each(pos, head) \ +#define cds_hlist_for_each(pos, head) \ for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \ pos = pos->next) -#define hlist_for_each_safe(pos, n, head) \ +#define cds_hlist_for_each_safe(pos, n, head) \ for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ pos = n) /** - * hlist_for_each_entry - iterate over list of given type + * cds_hlist_for_each_entry - iterate over list of given type * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. + * @pos: the &struct cds_hlist_node to use as a loop cursor. * @head: the head for your list. - * @member: the name of the hlist_node within the struct. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry(tpos, pos, head, member) \ +#define cds_hlist_for_each_entry(tpos, pos, head, member) \ for (pos = (head)->first; \ pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = pos->next) /** - * hlist_for_each_entry_continue - iterate over a hlist continuing after current point + * cds_hlist_for_each_entry_continue - iterate over a hlist continuing after current point * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. - * @member: the name of the hlist_node within the struct. + * @pos: the &struct cds_hlist_node to use as a loop cursor. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry_continue(tpos, pos, member) \ +#define cds_hlist_for_each_entry_continue(tpos, pos, member) \ for (pos = (pos)->next; \ pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = pos->next) /** - * hlist_for_each_entry_from - iterate over a hlist continuing from current point + * cds_hlist_for_each_entry_from - iterate over a hlist continuing from current point * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. - * @member: the name of the hlist_node within the struct. + * @pos: the &struct cds_hlist_node to use as a loop cursor. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry_from(tpos, pos, member) \ +#define cds_hlist_for_each_entry_from(tpos, pos, member) \ for (; pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = pos->next) /** - * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * cds_hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. - * @n: another &struct hlist_node to use as temporary storage + * @pos: the &struct cds_hlist_node to use as a loop cursor. + * @n: another &struct cds_hlist_node to use as temporary storage * @head: the head for your list. - * @member: the name of the hlist_node within the struct. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ +#define cds_hlist_for_each_entry_safe(tpos, pos, n, head, member) \ for (pos = (head)->first; \ pos && ({ n = pos->next; 1; }) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = n) #endif diff --git a/tests/api_x86.h b/tests/api_x86.h index 0365432..c774c32 100644 --- a/tests/api_x86.h +++ b/tests/api_x86.h @@ -718,16 +718,16 @@ static void smp_init(void) * using the generic single-entry routines. */ -struct list_head { - struct list_head *next, *prev; +struct cds_list_head { + struct cds_list_head *next, *prev; }; -#define LIST_HEAD_INIT(name) { &(name), &(name) } +#define CDS_LIST_HEAD_INIT(name) { &(name), &(name) } -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) +#define CDS_LIST_HEAD(name) \ + struct cds_list_head name = CDS_LIST_HEAD_INIT(name) -static inline void INIT_LIST_HEAD(struct list_head *list) +static inline void CDS_INIT_LIST_HEAD(struct cds_list_head *list) { list->next = list; list->prev = list; @@ -740,9 +740,9 @@ static inline void INIT_LIST_HEAD(struct list_head *list) * the prev/next entries already! */ #ifndef CONFIG_DEBUG_LIST -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) +static inline void __cds_list_add(struct cds_list_head *new, + struct cds_list_head *prev, + struct cds_list_head *next) { next->prev = new; new->next = next; @@ -750,36 +750,36 @@ static inline void __list_add(struct list_head *new, prev->next = new; } #else -extern void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next); +extern void __cds_list_add(struct cds_list_head *new, + struct cds_list_head *prev, + struct cds_list_head *next); #endif /** - * list_add - add a new entry + * cds_list_add - add a new entry * @new: new entry to be added * @head: list head to add it after * * Insert a new entry after the specified head. * This is good for implementing stacks. */ -static inline void list_add(struct list_head *new, struct list_head *head) +static inline void cds_list_add(struct cds_list_head *new, struct cds_list_head *head) { - __list_add(new, head, head->next); + __cds_list_add(new, head, head->next); } /** - * list_add_tail - add a new entry + * cds_list_add_tail - add a new entry * @new: new entry to be added * @head: list head to add it before * * Insert a new entry before the specified head. * This is useful for implementing queues. */ -static inline void list_add_tail(struct list_head *new, struct list_head *head) +static inline void cds_list_add_tail(struct cds_list_head *new, struct cds_list_head *head) { - __list_add(new, head->prev, head); + __cds_list_add(new, head->prev, head); } /* @@ -789,38 +789,38 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head) * This is only for internal list manipulation where we know * the prev/next entries already! */ -static inline void __list_del(struct list_head * prev, struct list_head * next) +static inline void __cds_list_del(struct cds_list_head * prev, struct cds_list_head * next) { next->prev = prev; prev->next = next; } /** - * list_del - deletes entry from list. + * cds_list_del - deletes entry from list. * @entry: the element to delete from the list. - * Note: list_empty() on entry does not return true after this, the entry is + * Note: cds_list_empty() on entry does not return true after this, the entry is * in an undefined state. */ #ifndef CONFIG_DEBUG_LIST -static inline void list_del(struct list_head *entry) +static inline void cds_list_del(struct cds_list_head *entry) { - __list_del(entry->prev, entry->next); + __cds_list_del(entry->prev, entry->next); entry->next = LIST_POISON1; entry->prev = LIST_POISON2; } #else -extern void list_del(struct list_head *entry); +extern void cds_list_del(struct cds_list_head *entry); #endif /** - * list_replace - replace old entry by new one + * cds_list_replace - replace old entry by new one * @old : the element to be replaced * @new : the new element to insert * * If @old was empty, it will be overwritten. */ -static inline void list_replace(struct list_head *old, - struct list_head *new) +static inline void cds_list_replace(struct cds_list_head *old, + struct cds_list_head *new) { new->next = old->next; new->next->prev = new; @@ -828,44 +828,44 @@ static inline void list_replace(struct list_head *old, new->prev->next = new; } -static inline void list_replace_init(struct list_head *old, - struct list_head *new) +static inline void cds_list_replace_init(struct cds_list_head *old, + struct cds_list_head *new) { - list_replace(old, new); - INIT_LIST_HEAD(old); + cds_list_replace(old, new); + CDS_INIT_LIST_HEAD(old); } /** - * list_del_init - deletes entry from list and reinitialize it. + * cds_list_del_init - deletes entry from list and reinitialize it. * @entry: the element to delete from the list. */ -static inline void list_del_init(struct list_head *entry) +static inline void cds_list_del_init(struct cds_list_head *entry) { - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); + __cds_list_del(entry->prev, entry->next); + CDS_INIT_LIST_HEAD(entry); } /** - * list_move - delete from one list and add as another's head + * cds_list_move - delete from one list and add as another's head * @list: the entry to move * @head: the head that will precede our entry */ -static inline void list_move(struct list_head *list, struct list_head *head) +static inline void cds_list_move(struct cds_list_head *list, struct cds_list_head *head) { - __list_del(list->prev, list->next); - list_add(list, head); + __cds_list_del(list->prev, list->next); + cds_list_add(list, head); } /** - * list_move_tail - delete from one list and add as another's tail + * cds_list_move_tail - delete from one list and add as another's tail * @list: the entry to move * @head: the head that will follow our entry */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) +static inline void cds_list_move_tail(struct cds_list_head *list, + struct cds_list_head *head) { - __list_del(list->prev, list->next); - list_add_tail(list, head); + __cds_list_del(list->prev, list->next); + cds_list_add_tail(list, head); } /** @@ -873,37 +873,37 @@ static inline void list_move_tail(struct list_head *list, * @list: the entry to test * @head: the head of the list */ -static inline int list_is_last(const struct list_head *list, - const struct list_head *head) +static inline int list_is_last(const struct cds_list_head *list, + const struct cds_list_head *head) { return list->next == head; } /** - * list_empty - tests whether a list is empty + * cds_list_empty - tests whether a list is empty * @head: the list to test. */ -static inline int list_empty(const struct list_head *head) +static inline int cds_list_empty(const struct cds_list_head *head) { return head->next == head; } /** - * list_empty_careful - tests whether a list is empty and not being modified + * cds_list_empty_careful - tests whether a list is empty and not being modified * @head: the list to test * * Description: * tests whether a list is empty _and_ checks that no other CPU might be * in the process of modifying either member (next or prev) * - * NOTE: using list_empty_careful() without synchronization + * NOTE: using cds_list_empty_careful() without synchronization * can only be safe if the only activity that can happen - * to the list entry is list_del_init(). Eg. it cannot be used + * to the list entry is cds_list_del_init(). Eg. it cannot be used * if another CPU could re-list_add() it. */ -static inline int list_empty_careful(const struct list_head *head) +static inline int cds_list_empty_careful(const struct cds_list_head *head) { - struct list_head *next = head->next; + struct cds_list_head *next = head->next; return (next == head) && (next == head->prev); } @@ -911,15 +911,15 @@ static inline int list_empty_careful(const struct list_head *head) * list_is_singular - tests whether a list has just one entry. * @head: the list to test. */ -static inline int list_is_singular(const struct list_head *head) +static inline int list_is_singular(const struct cds_list_head *head) { return !list_empty(head) && (head->next == head->prev); } -static inline void __list_cut_position(struct list_head *list, - struct list_head *head, struct list_head *entry) +static inline void __list_cut_position(struct cds_list_head *list, + struct cds_list_head *head, struct cds_list_head *entry) { - struct list_head *new_first = entry->next; + struct cds_list_head *new_first = entry->next; list->next = head->next; list->next->prev = list; list->prev = entry; @@ -942,26 +942,26 @@ static inline void __list_cut_position(struct list_head *list, * losing its data. * */ -static inline void list_cut_position(struct list_head *list, - struct list_head *head, struct list_head *entry) +static inline void list_cut_position(struct cds_list_head *list, + struct cds_list_head *head, struct cds_list_head *entry) { - if (list_empty(head)) + if (cds_list_empty(head)) return; if (list_is_singular(head) && (head->next != entry && head != entry)) return; if (entry == head) - INIT_LIST_HEAD(list); + CDS_INIT_LIST_HEAD(list); else __list_cut_position(list, head, entry); } -static inline void __list_splice(const struct list_head *list, - struct list_head *prev, - struct list_head *next) +static inline void __cds_list_splice(const struct cds_list_head *list, + struct cds_list_head *prev, + struct cds_list_head *next) { - struct list_head *first = list->next; - struct list_head *last = list->prev; + struct cds_list_head *first = list->next; + struct cds_list_head *last = list->prev; first->prev = prev; prev->next = first; @@ -971,69 +971,69 @@ static inline void __list_splice(const struct list_head *list, } /** - * list_splice - join two lists, this is designed for stacks + * cds_list_splice - join two lists, this is designed for stacks * @list: the new list to add. * @head: the place to add it in the first list. */ -static inline void list_splice(const struct list_head *list, - struct list_head *head) +static inline void cds_list_splice(const struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) - __list_splice(list, head, head->next); + if (!cds_list_empty(list)) + __cds_list_splice(list, head, head->next); } /** - * list_splice_tail - join two lists, each list being a queue + * cds_list_splice_tail - join two lists, each list being a queue * @list: the new list to add. * @head: the place to add it in the first list. */ -static inline void list_splice_tail(struct list_head *list, - struct list_head *head) +static inline void cds_list_splice_tail(struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) - __list_splice(list, head->prev, head); + if (!cds_list_empty(list)) + __cds_list_splice(list, head->prev, head); } /** - * list_splice_init - join two lists and reinitialise the emptied list. + * cds_list_splice_init - join two lists and reinitialise the emptied list. * @list: the new list to add. * @head: the place to add it in the first list. * * The list at @list is reinitialised */ -static inline void list_splice_init(struct list_head *list, - struct list_head *head) +static inline void cds_list_splice_init(struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) { - __list_splice(list, head, head->next); - INIT_LIST_HEAD(list); + if (!cds_list_empty(list)) { + __cds_list_splice(list, head, head->next); + CDS_INIT_LIST_HEAD(list); } } /** - * list_splice_tail_init - join two lists and reinitialise the emptied list + * cds_list_splice_tail_init - join two lists and reinitialise the emptied list * @list: the new list to add. * @head: the place to add it in the first list. * * Each of the lists is a queue. * The list at @list is reinitialised */ -static inline void list_splice_tail_init(struct list_head *list, - struct list_head *head) +static inline void cds_list_splice_tail_init(struct cds_list_head *list, + struct cds_list_head *head) { - if (!list_empty(list)) { - __list_splice(list, head->prev, head); - INIT_LIST_HEAD(list); + if (!cds_list_empty(list)) { + __cds_list_splice(list, head->prev, head); + CDS_INIT_LIST_HEAD(list); } } /** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. + * cds_list_entry - get the struct for this entry + * @ptr: the &struct cds_list_head pointer. * @type: the type of the struct this is embedded in. * @member: the name of the list_struct within the struct. */ -#define list_entry(ptr, type, member) \ +#define cds_list_entry(ptr, type, member) \ caa_container_of(ptr, type, member) /** @@ -1045,95 +1045,95 @@ static inline void list_splice_tail_init(struct list_head *list, * Note, that list is expected to be not empty. */ #define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) + cds_list_entry((ptr)->next, type, member) /** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop cursor. + * cds_list_for_each - iterate over a list + * @pos: the &struct cds_list_head to use as a loop cursor. * @head: the head for your list. */ -#define list_for_each(pos, head) \ +#define cds_list_for_each(pos, head) \ for (pos = (head)->next; prefetch(pos->next), pos != (head); \ pos = pos->next) /** - * __list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop cursor. + * __cds_list_for_each - iterate over a list + * @pos: the &struct cds_list_head to use as a loop cursor. * @head: the head for your list. * - * This variant differs from list_for_each() in that it's the + * This variant differs from cds_list_for_each() in that it's the * simplest possible list iteration code, no prefetching is done. * Use this for code that knows the list to be very short (empty * or 1 entry) most of the time. */ -#define __list_for_each(pos, head) \ +#define __cds_list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) /** - * list_for_each_prev - iterate over a list backwards - * @pos: the &struct list_head to use as a loop cursor. + * cds_list_for_each_prev - iterate over a list backwards + * @pos: the &struct cds_list_head to use as a loop cursor. * @head: the head for your list. */ -#define list_for_each_prev(pos, head) \ +#define cds_list_for_each_prev(pos, head) \ for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \ pos = pos->prev) /** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop cursor. - * @n: another &struct list_head to use as temporary storage + * cds_list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct cds_list_head to use as a loop cursor. + * @n: another &struct cds_list_head to use as temporary storage * @head: the head for your list. */ -#define list_for_each_safe(pos, n, head) \ +#define cds_list_for_each_safe(pos, n, head) \ for (pos = (head)->next, n = pos->next; pos != (head); \ pos = n, n = pos->next) /** - * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry - * @pos: the &struct list_head to use as a loop cursor. - * @n: another &struct list_head to use as temporary storage + * cds_list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry + * @pos: the &struct cds_list_head to use as a loop cursor. + * @n: another &struct cds_list_head to use as temporary storage * @head: the head for your list. */ -#define list_for_each_prev_safe(pos, n, head) \ +#define cds_list_for_each_prev_safe(pos, n, head) \ for (pos = (head)->prev, n = pos->prev; \ prefetch(pos->prev), pos != (head); \ pos = n, n = pos->prev) /** - * list_for_each_entry - iterate over list of given type + * cds_list_for_each_entry - iterate over list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ +#define cds_list_for_each_entry(pos, head, member) \ + for (pos = cds_list_entry((head)->next, typeof(*pos), member); \ prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + pos = cds_list_entry(pos->member.next, typeof(*pos), member)) /** - * list_for_each_entry_reverse - iterate backwards over list of given type. + * cds_list_for_each_entry_reverse - iterate backwards over list of given type. * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. */ -#define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member); \ +#define cds_list_for_each_entry_reverse(pos, head, member) \ + for (pos = cds_list_entry((head)->prev, typeof(*pos), member); \ prefetch(pos->member.prev), &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) + pos = cds_list_entry(pos->member.prev, typeof(*pos), member)) /** - * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() + * list_prepare_entry - prepare a pos entry for use in cds_list_for_each_entry_continue() * @pos: the type * to use as a start point * @head: the head of the list * @member: the name of the list_struct within the struct. * - * Prepares a pos entry for use as a start point in list_for_each_entry_continue(). + * Prepares a pos entry for use as a start point in cds_list_for_each_entry_continue(). */ #define list_prepare_entry(pos, head, member) \ - ((pos) ? : list_entry(head, typeof(*pos), member)) + ((pos) ? : cds_list_entry(head, typeof(*pos), member)) /** - * list_for_each_entry_continue - continue iteration over list of given type + * cds_list_for_each_entry_continue - continue iteration over list of given type * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. @@ -1141,13 +1141,13 @@ static inline void list_splice_tail_init(struct list_head *list, * Continue to iterate over list of given type, continuing after * the current position. */ -#define list_for_each_entry_continue(pos, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_continue(pos, head, member) \ + for (pos = cds_list_entry(pos->member.next, typeof(*pos), member); \ prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + pos = cds_list_entry(pos->member.next, typeof(*pos), member)) /** - * list_for_each_entry_continue_reverse - iterate backwards from the given point + * cds_list_for_each_entry_continue_reverse - iterate backwards from the given point * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. @@ -1155,38 +1155,38 @@ static inline void list_splice_tail_init(struct list_head *list, * Start to iterate over list of given type backwards, continuing after * the current position. */ -#define list_for_each_entry_continue_reverse(pos, head, member) \ - for (pos = list_entry(pos->member.prev, typeof(*pos), member); \ +#define cds_list_for_each_entry_continue_reverse(pos, head, member) \ + for (pos = cds_list_entry(pos->member.prev, typeof(*pos), member); \ prefetch(pos->member.prev), &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) + pos = cds_list_entry(pos->member.prev, typeof(*pos), member)) /** - * list_for_each_entry_from - iterate over list of given type from the current point + * cds_list_for_each_entry_from - iterate over list of given type from the current point * @pos: the type * to use as a loop cursor. * @head: the head for your list. * @member: the name of the list_struct within the struct. * * Iterate over list of given type, continuing from current position. */ -#define list_for_each_entry_from(pos, head, member) \ +#define cds_list_for_each_entry_from(pos, head, member) \ for (; prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + pos = cds_list_entry(pos->member.next, typeof(*pos), member)) /** - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * cds_list_for_each_entry_safe - iterate over list of given type safe against removal of list entry * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. * @member: the name of the list_struct within the struct. */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe(pos, n, head, member) \ + for (pos = cds_list_entry((head)->next, typeof(*pos), member), \ + n = cds_list_entry(pos->member.next, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.next, typeof(*n), member)) /** - * list_for_each_entry_safe_continue + * cds_list_for_each_entry_safe_continue * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. @@ -1195,14 +1195,14 @@ static inline void list_splice_tail_init(struct list_head *list, * Iterate over list of given type, continuing after current point, * safe against removal of list entry. */ -#define list_for_each_entry_safe_continue(pos, n, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe_continue(pos, n, head, member) \ + for (pos = cds_list_entry(pos->member.next, typeof(*pos), member), \ + n = cds_list_entry(pos->member.next, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.next, typeof(*n), member)) /** - * list_for_each_entry_safe_from + * cds_list_for_each_entry_safe_from * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. @@ -1211,13 +1211,13 @@ static inline void list_splice_tail_init(struct list_head *list, * Iterate over list of given type from current point, safe against * removal of list entry. */ -#define list_for_each_entry_safe_from(pos, n, head, member) \ - for (n = list_entry(pos->member.next, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe_from(pos, n, head, member) \ + for (n = cds_list_entry(pos->member.next, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.next, typeof(*n), member)) /** - * list_for_each_entry_safe_reverse + * cds_list_for_each_entry_safe_reverse * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage * @head: the head for your list. @@ -1226,11 +1226,11 @@ static inline void list_splice_tail_init(struct list_head *list, * Iterate backwards over list of given type, safe against removal * of list entry. */ -#define list_for_each_entry_safe_reverse(pos, n, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member), \ - n = list_entry(pos->member.prev, typeof(*pos), member); \ +#define cds_list_for_each_entry_safe_reverse(pos, n, head, member) \ + for (pos = cds_list_entry((head)->prev, typeof(*pos), member), \ + n = cds_list_entry(pos->member.prev, typeof(*pos), member); \ &pos->member != (head); \ - pos = n, n = list_entry(n->member.prev, typeof(*n), member)) + pos = n, n = cds_list_entry(n->member.prev, typeof(*n), member)) #endif //0 @@ -1241,60 +1241,60 @@ static inline void list_splice_tail_init(struct list_head *list, * You lose the ability to access the tail in O(1). */ -struct hlist_head { - struct hlist_node *first; +struct cds_hlist_head { + struct cds_hlist_node *first; }; -struct hlist_node { - struct hlist_node *next, **pprev; +struct cds_hlist_node { + struct cds_hlist_node *next, **pprev; }; #define HLIST_HEAD_INIT { .first = NULL } -#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } -#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) -static inline void INIT_HLIST_NODE(struct hlist_node *h) +#define HLIST_HEAD(name) struct cds_hlist_head name = { .first = NULL } +#define CDS_INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) +static inline void INIT_HLIST_NODE(struct cds_hlist_node *h) { h->next = NULL; h->pprev = NULL; } -static inline int hlist_unhashed(const struct hlist_node *h) +static inline int hlist_unhashed(const struct cds_hlist_node *h) { return !h->pprev; } -static inline int hlist_empty(const struct hlist_head *h) +static inline int hlist_empty(const struct cds_hlist_head *h) { return !h->first; } -static inline void __hlist_del(struct hlist_node *n) +static inline void __cds_hlist_del(struct cds_hlist_node *n) { - struct hlist_node *next = n->next; - struct hlist_node **pprev = n->pprev; + struct cds_hlist_node *next = n->next; + struct cds_hlist_node **pprev = n->pprev; *pprev = next; if (next) next->pprev = pprev; } -static inline void hlist_del(struct hlist_node *n) +static inline void cds_hlist_del(struct cds_hlist_node *n) { - __hlist_del(n); + __cds_hlist_del(n); n->next = LIST_POISON1; n->pprev = LIST_POISON2; } -static inline void hlist_del_init(struct hlist_node *n) +static inline void cds_hlist_del_init(struct cds_hlist_node *n) { if (!hlist_unhashed(n)) { - __hlist_del(n); + __cds_hlist_del(n); INIT_HLIST_NODE(n); } } -static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) +static inline void cds_hlist_add_head(struct cds_hlist_node *n, struct cds_hlist_head *h) { - struct hlist_node *first = h->first; + struct cds_hlist_node *first = h->first; n->next = first; if (first) first->pprev = &n->next; @@ -1303,8 +1303,8 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) } /* next must be != NULL */ -static inline void hlist_add_before(struct hlist_node *n, - struct hlist_node *next) +static inline void hlist_add_before(struct cds_hlist_node *n, + struct cds_hlist_node *next) { n->pprev = next->pprev; n->next = next; @@ -1312,8 +1312,8 @@ static inline void hlist_add_before(struct hlist_node *n, *(n->pprev) = n; } -static inline void hlist_add_after(struct hlist_node *n, - struct hlist_node *next) +static inline void hlist_add_after(struct cds_hlist_node *n, + struct cds_hlist_node *next) { next->next = n->next; n->next = next; @@ -1327,8 +1327,8 @@ static inline void hlist_add_after(struct hlist_node *n, * Move a list from one list head to another. Fixup the pprev * reference of the first entry if it exists. */ -static inline void hlist_move_list(struct hlist_head *old, - struct hlist_head *new) +static inline void hlist_move_list(struct cds_hlist_head *old, + struct cds_hlist_head *new) { new->first = old->first; if (new->first) @@ -1336,64 +1336,64 @@ static inline void hlist_move_list(struct hlist_head *old, old->first = NULL; } -#define hlist_entry(ptr, type, member) caa_container_of(ptr,type,member) +#define cds_hlist_entry(ptr, type, member) caa_container_of(ptr,type,member) -#define hlist_for_each(pos, head) \ +#define cds_hlist_for_each(pos, head) \ for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \ pos = pos->next) -#define hlist_for_each_safe(pos, n, head) \ +#define cds_hlist_for_each_safe(pos, n, head) \ for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ pos = n) /** - * hlist_for_each_entry - iterate over list of given type + * cds_hlist_for_each_entry - iterate over list of given type * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. + * @pos: the &struct cds_hlist_node to use as a loop cursor. * @head: the head for your list. - * @member: the name of the hlist_node within the struct. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry(tpos, pos, head, member) \ +#define cds_hlist_for_each_entry(tpos, pos, head, member) \ for (pos = (head)->first; \ pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = pos->next) /** - * hlist_for_each_entry_continue - iterate over a hlist continuing after current point + * cds_hlist_for_each_entry_continue - iterate over a hlist continuing after current point * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. - * @member: the name of the hlist_node within the struct. + * @pos: the &struct cds_hlist_node to use as a loop cursor. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry_continue(tpos, pos, member) \ +#define cds_hlist_for_each_entry_continue(tpos, pos, member) \ for (pos = (pos)->next; \ pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = pos->next) /** - * hlist_for_each_entry_from - iterate over a hlist continuing from current point + * cds_hlist_for_each_entry_from - iterate over a hlist continuing from current point * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. - * @member: the name of the hlist_node within the struct. + * @pos: the &struct cds_hlist_node to use as a loop cursor. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry_from(tpos, pos, member) \ +#define cds_hlist_for_each_entry_from(tpos, pos, member) \ for (; pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = pos->next) /** - * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * cds_hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry * @tpos: the type * to use as a loop cursor. - * @pos: the &struct hlist_node to use as a loop cursor. - * @n: another &struct hlist_node to use as temporary storage + * @pos: the &struct cds_hlist_node to use as a loop cursor. + * @n: another &struct cds_hlist_node to use as temporary storage * @head: the head for your list. - * @member: the name of the hlist_node within the struct. + * @member: the name of the cds_hlist_node within the struct. */ -#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ +#define cds_hlist_for_each_entry_safe(tpos, pos, n, head, member) \ for (pos = (head)->first; \ pos && ({ n = pos->next; 1; }) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + ({ tpos = cds_hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = n) #endif diff --git a/tests/test_urcu_lfq.c b/tests/test_urcu_lfq.c index aed9be0..de7c8a3 100644 --- a/tests/test_urcu_lfq.c +++ b/tests/test_urcu_lfq.c @@ -154,7 +154,7 @@ static unsigned long long __thread nr_successful_enqueues; static unsigned int nr_enqueuers; static unsigned int nr_dequeuers; -static struct rcu_lfq_queue q; +static struct cds_lfq_queue_rcu q; void *thr_enqueuer(void *_count) { @@ -173,11 +173,11 @@ void *thr_enqueuer(void *_count) cmm_smp_mb(); for (;;) { - struct rcu_lfq_node *node = malloc(sizeof(*node)); + struct cds_lfq_node_rcu *node = malloc(sizeof(*node)); if (!node) goto fail; - rcu_lfq_node_init(node); - rcu_lfq_enqueue(&q, node); + cds_lfq_node_init_rcu(node); + cds_lfq_enqueue_rcu(&q, node); nr_successful_enqueues++; if (unlikely(wdelay)) @@ -202,7 +202,7 @@ fail: static void rcu_release_node(struct urcu_ref *ref) { - struct rcu_lfq_node *node = caa_container_of(ref, struct rcu_lfq_node, ref); + struct cds_lfq_node_rcu *node = caa_container_of(ref, struct cds_lfq_node_rcu, ref); defer_rcu(free, node); //synchronize_rcu(); //free(node); @@ -226,7 +226,7 @@ void *thr_dequeuer(void *_count) cmm_smp_mb(); for (;;) { - struct rcu_lfq_node *node = rcu_lfq_dequeue(&q, + struct cds_lfq_node_rcu *node = cds_lfq_dequeue_rcu(&q, rcu_release_node); if (node) { @@ -255,16 +255,16 @@ void *thr_dequeuer(void *_count) static void release_node(struct urcu_ref *ref) { - struct rcu_lfq_node *node = caa_container_of(ref, struct rcu_lfq_node, ref); + struct cds_lfq_node_rcu *node = caa_container_of(ref, struct cds_lfq_node_rcu, ref); free(node); } -void test_end(struct rcu_lfq_queue *q, unsigned long long *nr_dequeues) +void test_end(struct cds_lfq_queue_rcu *q, unsigned long long *nr_dequeues) { - struct rcu_lfq_node *node; + struct cds_lfq_node_rcu *node; do { - node = rcu_lfq_dequeue(q, release_node); + node = cds_lfq_dequeue_rcu(q, release_node); if (node) { urcu_ref_put(&node->ref, release_node); (*nr_dequeues)++; @@ -363,7 +363,7 @@ int main(int argc, char **argv) tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers); count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers); count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers); - rcu_lfq_init(&q); + cds_lfq_init_rcu(&q); next_aff = 0; diff --git a/tests/test_urcu_lfs.c b/tests/test_urcu_lfs.c index 02be2d4..8335f24 100644 --- a/tests/test_urcu_lfs.c +++ b/tests/test_urcu_lfs.c @@ -154,7 +154,7 @@ static unsigned long long __thread nr_successful_enqueues; static unsigned int nr_enqueuers; static unsigned int nr_dequeuers; -static struct rcu_lfs_stack s; +static struct cds_lfs_stack_rcu s; void *thr_enqueuer(void *_count) { @@ -173,11 +173,11 @@ void *thr_enqueuer(void *_count) cmm_smp_mb(); for (;;) { - struct rcu_lfs_node *node = malloc(sizeof(*node)); + struct cds_lfs_node_rcu *node = malloc(sizeof(*node)); if (!node) goto fail; - rcu_lfs_node_init(node); - rcu_lfs_push(&s, node); + cds_lfs_node_init_rcu(node); + cds_lfs_push_rcu(&s, node); nr_successful_enqueues++; if (unlikely(wdelay)) @@ -218,7 +218,7 @@ void *thr_dequeuer(void *_count) cmm_smp_mb(); for (;;) { - struct rcu_lfs_node *node = rcu_lfs_pop(&s); + struct cds_lfs_node_rcu *node = cds_lfs_pop_rcu(&s); if (node) { defer_rcu(free, node); @@ -244,12 +244,12 @@ void *thr_dequeuer(void *_count) return ((void*)2); } -void test_end(struct rcu_lfs_stack *s, unsigned long long *nr_dequeues) +void test_end(struct cds_lfs_stack_rcu *s, unsigned long long *nr_dequeues) { - struct rcu_lfs_node *node; + struct cds_lfs_node_rcu *node; do { - node = rcu_lfs_pop(s); + node = cds_lfs_pop_rcu(s); if (node) { free(node); (*nr_dequeues)++; @@ -348,7 +348,7 @@ int main(int argc, char **argv) tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers); count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers); count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers); - rcu_lfs_init(&s); + cds_lfs_init_rcu(&s); next_aff = 0; diff --git a/tests/test_urcu_wfq.c b/tests/test_urcu_wfq.c index cb49454..bcdd4c0 100644 --- a/tests/test_urcu_wfq.c +++ b/tests/test_urcu_wfq.c @@ -153,7 +153,7 @@ static unsigned long long __thread nr_successful_enqueues; static unsigned int nr_enqueuers; static unsigned int nr_dequeuers; -static struct wfq_queue q; +static struct cds_wfq_queue q; void *thr_enqueuer(void *_count) { @@ -170,11 +170,11 @@ void *thr_enqueuer(void *_count) cmm_smp_mb(); for (;;) { - struct wfq_node *node = malloc(sizeof(*node)); + struct cds_wfq_node *node = malloc(sizeof(*node)); if (!node) goto fail; - wfq_node_init(node); - wfq_enqueue(&q, node); + cds_wfq_node_init(node); + cds_wfq_enqueue(&q, node); nr_successful_enqueues++; if (unlikely(wdelay)) @@ -210,7 +210,7 @@ void *thr_dequeuer(void *_count) cmm_smp_mb(); for (;;) { - struct wfq_node *node = wfq_dequeue_blocking(&q); + struct cds_wfq_node *node = cds_wfq_dequeue_blocking(&q); if (node) { free(node); @@ -233,12 +233,12 @@ void *thr_dequeuer(void *_count) return ((void*)2); } -void test_end(struct wfq_queue *q, unsigned long long *nr_dequeues) +void test_end(struct cds_wfq_queue *q, unsigned long long *nr_dequeues) { - struct wfq_node *node; + struct cds_wfq_node *node; do { - node = wfq_dequeue_blocking(q); + node = cds_wfq_dequeue_blocking(q); if (node) { free(node); (*nr_dequeues)++; @@ -337,7 +337,7 @@ int main(int argc, char **argv) tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers); count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers); count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers); - wfq_init(&q); + cds_wfq_init(&q); next_aff = 0; diff --git a/tests/test_urcu_wfs.c b/tests/test_urcu_wfs.c index 49f9218..dc45700 100644 --- a/tests/test_urcu_wfs.c +++ b/tests/test_urcu_wfs.c @@ -153,7 +153,7 @@ static unsigned long long __thread nr_successful_enqueues; static unsigned int nr_enqueuers; static unsigned int nr_dequeuers; -static struct wfs_stack s; +static struct cds_wfs_stack s; void *thr_enqueuer(void *_count) { @@ -170,11 +170,11 @@ void *thr_enqueuer(void *_count) cmm_smp_mb(); for (;;) { - struct wfs_node *node = malloc(sizeof(*node)); + struct cds_wfs_node *node = malloc(sizeof(*node)); if (!node) goto fail; - wfs_node_init(node); - wfs_push(&s, node); + cds_wfs_node_init(node); + cds_wfs_push(&s, node); nr_successful_enqueues++; if (unlikely(wdelay)) @@ -210,7 +210,7 @@ void *thr_dequeuer(void *_count) cmm_smp_mb(); for (;;) { - struct wfs_node *node = wfs_pop_blocking(&s); + struct cds_wfs_node *node = cds_wfs_pop_blocking(&s); if (node) { free(node); @@ -233,12 +233,12 @@ void *thr_dequeuer(void *_count) return ((void*)2); } -void test_end(struct wfs_stack *s, unsigned long long *nr_dequeues) +void test_end(struct cds_wfs_stack *s, unsigned long long *nr_dequeues) { - struct wfs_node *node; + struct cds_wfs_node *node; do { - node = wfs_pop_blocking(s); + node = cds_wfs_pop_blocking(s); if (node) { free(node); (*nr_dequeues)++; @@ -337,7 +337,7 @@ int main(int argc, char **argv) tid_dequeuer = malloc(sizeof(*tid_dequeuer) * nr_dequeuers); count_enqueuer = malloc(2 * sizeof(*count_enqueuer) * nr_enqueuers); count_dequeuer = malloc(2 * sizeof(*count_dequeuer) * nr_dequeuers); - wfs_init(&s); + cds_wfs_init(&s); next_aff = 0; diff --git a/urcu-bp-static.h b/urcu-bp-static.h index ea2c376..2049ee6 100644 --- a/urcu-bp-static.h +++ b/urcu-bp-static.h @@ -140,7 +140,7 @@ struct rcu_reader { /* Data used by both reader and synchronize_rcu() */ long ctr; /* Data used for registry */ - struct list_head node __attribute__((aligned(CAA_CACHE_LINE_SIZE))); + struct cds_list_head node __attribute__((aligned(CAA_CACHE_LINE_SIZE))); pthread_t tid; int alloc; /* registry entry allocated */ }; diff --git a/urcu-bp.c b/urcu-bp.c index b457d2b..136f97d 100644 --- a/urcu-bp.c +++ b/urcu-bp.c @@ -66,7 +66,7 @@ long rcu_gp_ctr = RCU_GP_COUNT; */ struct rcu_reader __thread *rcu_reader; -static LIST_HEAD(registry); +static CDS_LIST_HEAD(registry); struct registry_arena { void *p; @@ -118,7 +118,7 @@ static void mutex_unlock(pthread_mutex_t *mutex) void update_counter_and_wait(void) { - LIST_HEAD(qsreaders); + CDS_LIST_HEAD(qsreaders); int wait_loops = 0; struct rcu_reader *index, *tmp; @@ -144,12 +144,12 @@ void update_counter_and_wait(void) */ for (;;) { wait_loops++; - list_for_each_entry_safe(index, tmp, ®istry, node) { + cds_list_for_each_entry_safe(index, tmp, ®istry, node) { if (!rcu_old_gp_ongoing(&index->ctr)) - list_move(&index->node, &qsreaders); + cds_list_move(&index->node, &qsreaders); } - if (list_empty(®istry)) { + if (cds_list_empty(®istry)) { break; } else { if (wait_loops == RCU_QS_ACTIVE_ATTEMPTS) @@ -159,7 +159,7 @@ void update_counter_and_wait(void) } } /* put back the reader list in the registry */ - list_splice(&qsreaders, ®istry); + cds_list_splice(&qsreaders, ®istry); } void synchronize_rcu(void) @@ -174,7 +174,7 @@ void synchronize_rcu(void) mutex_lock(&rcu_gp_lock); - if (list_empty(®istry)) + if (cds_list_empty(®istry)) goto out; /* All threads should read qparity before accessing data structure @@ -279,7 +279,7 @@ static void add_thread(void) /* Add to registry */ rcu_reader_reg->tid = pthread_self(); assert(rcu_reader_reg->ctr == 0); - list_add(&rcu_reader_reg->node, ®istry); + cds_list_add(&rcu_reader_reg->node, ®istry); rcu_reader = rcu_reader_reg; } @@ -299,7 +299,7 @@ static void rcu_gc_registry(void) ret = pthread_kill(tid, 0); assert(ret != EINVAL); if (ret == ESRCH) { - list_del(&rcu_reader_reg->node); + cds_list_del(&rcu_reader_reg->node); rcu_reader_reg->ctr = 0; rcu_reader_reg->alloc = 0; registry_arena.used -= sizeof(struct rcu_reader); diff --git a/urcu-defer-static.h b/urcu-defer-static.h index 1e2aef2..3e5df3e 100644 --- a/urcu-defer-static.h +++ b/urcu-defer-static.h @@ -98,7 +98,7 @@ struct defer_queue { void **q; /* registry information */ unsigned long last_head; - struct list_head list; /* list of thread queues */ + struct cds_list_head list; /* list of thread queues */ }; #ifdef __cplusplus diff --git a/urcu-defer.c b/urcu-defer.c index c28e848..796e7e1 100644 --- a/urcu-defer.c +++ b/urcu-defer.c @@ -54,7 +54,7 @@ static int defer_thread_futex; * the reclamation tread. */ static struct defer_queue __thread defer_queue; -static LIST_HEAD(registry); +static CDS_LIST_HEAD(registry); static pthread_t tid_defer; static void mutex_lock(pthread_mutex_t *mutex) @@ -109,7 +109,7 @@ static unsigned long rcu_defer_num_callbacks(void) struct defer_queue *index; mutex_lock(&rcu_defer_mutex); - list_for_each_entry(index, ®istry, list) { + cds_list_for_each_entry(index, ®istry, list) { head = CAA_LOAD_SHARED(index->head); num_items += head - index->tail; } @@ -207,11 +207,11 @@ void rcu_defer_barrier(void) struct defer_queue *index; unsigned long num_items = 0; - if (list_empty(®istry)) + if (cds_list_empty(®istry)) return; mutex_lock(&rcu_defer_mutex); - list_for_each_entry(index, ®istry, list) { + cds_list_for_each_entry(index, ®istry, list) { index->last_head = CAA_LOAD_SHARED(index->head); num_items += index->last_head - index->tail; } @@ -223,7 +223,7 @@ void rcu_defer_barrier(void) goto end; } synchronize_rcu(); - list_for_each_entry(index, ®istry, list) + cds_list_for_each_entry(index, ®istry, list) rcu_defer_barrier_queue(index, index->last_head); end: mutex_unlock(&rcu_defer_mutex); @@ -349,8 +349,8 @@ void rcu_defer_register_thread(void) mutex_lock(&defer_thread_mutex); mutex_lock(&rcu_defer_mutex); - was_empty = list_empty(®istry); - list_add(&defer_queue.list, ®istry); + was_empty = cds_list_empty(®istry); + cds_list_add(&defer_queue.list, ®istry); mutex_unlock(&rcu_defer_mutex); if (was_empty) @@ -364,11 +364,11 @@ void rcu_defer_unregister_thread(void) mutex_lock(&defer_thread_mutex); mutex_lock(&rcu_defer_mutex); - list_del(&defer_queue.list); + cds_list_del(&defer_queue.list); _rcu_defer_barrier_thread(); free(defer_queue.q); defer_queue.q = NULL; - is_empty = list_empty(®istry); + is_empty = cds_list_empty(®istry); mutex_unlock(&rcu_defer_mutex); if (is_empty) @@ -378,5 +378,5 @@ void rcu_defer_unregister_thread(void) void rcu_defer_exit(void) { - assert(list_empty(®istry)); + assert(cds_list_empty(®istry)); } diff --git a/urcu-qsbr-static.h b/urcu-qsbr-static.h index ab4dcb5..da4a782 100644 --- a/urcu-qsbr-static.h +++ b/urcu-qsbr-static.h @@ -135,7 +135,7 @@ struct rcu_reader { /* Data used by both reader and synchronize_rcu() */ unsigned long ctr; /* Data used for registry */ - struct list_head node __attribute__((aligned(CAA_CACHE_LINE_SIZE))); + struct cds_list_head node __attribute__((aligned(CAA_CACHE_LINE_SIZE))); pthread_t tid; }; diff --git a/urcu-qsbr.c b/urcu-qsbr.c index 51d34c7..b7c42fd 100644 --- a/urcu-qsbr.c +++ b/urcu-qsbr.c @@ -59,7 +59,7 @@ unsigned int yield_active; unsigned int __thread rand_yield; #endif -static LIST_HEAD(registry); +static CDS_LIST_HEAD(registry); static void mutex_lock(pthread_mutex_t *mutex) { @@ -108,7 +108,7 @@ static void wait_gp(void) static void update_counter_and_wait(void) { - LIST_HEAD(qsreaders); + CDS_LIST_HEAD(qsreaders); int wait_loops = 0; struct rcu_reader *index, *tmp; @@ -146,12 +146,12 @@ static void update_counter_and_wait(void) cmm_smp_mb(); } - list_for_each_entry_safe(index, tmp, ®istry, node) { + cds_list_for_each_entry_safe(index, tmp, ®istry, node) { if (!rcu_gp_ongoing(&index->ctr)) - list_move(&index->node, &qsreaders); + cds_list_move(&index->node, &qsreaders); } - if (list_empty(®istry)) { + if (cds_list_empty(®istry)) { if (wait_loops == RCU_QS_ACTIVE_ATTEMPTS) { /* Read reader_gp before write futex */ cmm_smp_mb(); @@ -171,7 +171,7 @@ static void update_counter_and_wait(void) } } /* put back the reader list in the registry */ - list_splice(&qsreaders, ®istry); + cds_list_splice(&qsreaders, ®istry); } /* @@ -202,7 +202,7 @@ void synchronize_rcu(void) mutex_lock(&rcu_gp_lock); - if (list_empty(®istry)) + if (cds_list_empty(®istry)) goto out; /* @@ -258,7 +258,7 @@ void synchronize_rcu(void) CAA_STORE_SHARED(rcu_reader.ctr, 0); mutex_lock(&rcu_gp_lock); - if (list_empty(®istry)) + if (cds_list_empty(®istry)) goto out; update_counter_and_wait(); out: @@ -305,7 +305,7 @@ void rcu_register_thread(void) assert(rcu_reader.ctr == 0); mutex_lock(&rcu_gp_lock); - list_add(&rcu_reader.node, ®istry); + cds_list_add(&rcu_reader.node, ®istry); mutex_unlock(&rcu_gp_lock); _rcu_thread_online(); } @@ -318,11 +318,11 @@ void rcu_unregister_thread(void) */ _rcu_thread_offline(); mutex_lock(&rcu_gp_lock); - list_del(&rcu_reader.node); + cds_list_del(&rcu_reader.node); mutex_unlock(&rcu_gp_lock); } void rcu_exit(void) { - assert(list_empty(®istry)); + assert(cds_list_empty(®istry)); } diff --git a/urcu-static.h b/urcu-static.h index 46fe64a..58dfabb 100644 --- a/urcu-static.h +++ b/urcu-static.h @@ -222,7 +222,7 @@ struct rcu_reader { unsigned long ctr; char need_mb; /* Data used for registry */ - struct list_head node __attribute__((aligned(CAA_CACHE_LINE_SIZE))); + struct cds_list_head node __attribute__((aligned(CAA_CACHE_LINE_SIZE))); pthread_t tid; }; diff --git a/urcu.c b/urcu.c index b4a5a7d..5a9c2f0 100644 --- a/urcu.c +++ b/urcu.c @@ -80,7 +80,7 @@ unsigned int yield_active; unsigned int __thread rand_yield; #endif -static LIST_HEAD(registry); +static CDS_LIST_HEAD(registry); static void mutex_lock(pthread_mutex_t *mutex) { @@ -146,7 +146,7 @@ static void force_mb_all_readers(void) * Ask for each threads to execute a cmm_smp_mb() so we can consider the * compiler barriers around rcu read lock as real memory barriers. */ - if (list_empty(®istry)) + if (cds_list_empty(®istry)) return; /* * pthread_kill has a cmm_smp_mb(). But beware, we assume it performs @@ -154,7 +154,7 @@ static void force_mb_all_readers(void) * safe and don't assume anything : we use cmm_smp_mc() to make sure the * cache flush is enforced. */ - list_for_each_entry(index, ®istry, node) { + cds_list_for_each_entry(index, ®istry, node) { CAA_STORE_SHARED(index->need_mb, 1); pthread_kill(index->tid, SIGRCU); } @@ -171,7 +171,7 @@ static void force_mb_all_readers(void) * relevant bug report. For Linux kernels, we recommend getting * the Linux Test Project (LTP). */ - list_for_each_entry(index, ®istry, node) { + cds_list_for_each_entry(index, ®istry, node) { while (CAA_LOAD_SHARED(index->need_mb)) { pthread_kill(index->tid, SIGRCU); poll(NULL, 0, 1); @@ -200,7 +200,7 @@ static void wait_gp(void) void update_counter_and_wait(void) { - LIST_HEAD(qsreaders); + CDS_LIST_HEAD(qsreaders); int wait_loops = 0; struct rcu_reader *index, *tmp; @@ -234,13 +234,13 @@ void update_counter_and_wait(void) smp_mb_master(RCU_MB_GROUP); } - list_for_each_entry_safe(index, tmp, ®istry, node) { + cds_list_for_each_entry_safe(index, tmp, ®istry, node) { if (!rcu_gp_ongoing(&index->ctr)) - list_move(&index->node, &qsreaders); + cds_list_move(&index->node, &qsreaders); } #ifndef HAS_INCOHERENT_CACHES - if (list_empty(®istry)) { + if (cds_list_empty(®istry)) { if (wait_loops == RCU_QS_ACTIVE_ATTEMPTS) { /* Read reader_gp before write futex */ smp_mb_master(RCU_MB_GROUP); @@ -258,7 +258,7 @@ void update_counter_and_wait(void) * BUSY-LOOP. Force the reader thread to commit its * rcu_reader.ctr update to memory if we wait for too long. */ - if (list_empty(®istry)) { + if (cds_list_empty(®istry)) { if (wait_loops == RCU_QS_ACTIVE_ATTEMPTS) { /* Read reader_gp before write futex */ smp_mb_master(RCU_MB_GROUP); @@ -281,14 +281,14 @@ void update_counter_and_wait(void) #endif /* #else #ifndef HAS_INCOHERENT_CACHES */ } /* put back the reader list in the registry */ - list_splice(&qsreaders, ®istry); + cds_list_splice(&qsreaders, ®istry); } void synchronize_rcu(void) { mutex_lock(&rcu_gp_lock); - if (list_empty(®istry)) + if (cds_list_empty(®istry)) goto out; /* All threads should read qparity before accessing data structure @@ -353,14 +353,14 @@ void rcu_register_thread(void) mutex_lock(&rcu_gp_lock); rcu_init(); /* In case gcc does not support constructor attribute */ - list_add(&rcu_reader.node, ®istry); + cds_list_add(&rcu_reader.node, ®istry); mutex_unlock(&rcu_gp_lock); } void rcu_unregister_thread(void) { mutex_lock(&rcu_gp_lock); - list_del(&rcu_reader.node); + cds_list_del(&rcu_reader.node); mutex_unlock(&rcu_gp_lock); } @@ -426,6 +426,6 @@ void rcu_exit(void) exit(-1); } assert(act.sa_sigaction == sigrcu_handler); - assert(list_empty(®istry)); + assert(cds_list_empty(®istry)); } #endif /* #ifdef RCU_SIGNAL */ diff --git a/urcu/hlist.h b/urcu/hlist.h index 9f7776f..e3b94ce 100644 --- a/urcu/hlist.h +++ b/urcu/hlist.h @@ -16,41 +16,41 @@ * published by the Free Software Foundation. */ -struct hlist_head +struct cds_hlist_head { - struct hlist_node *next; + struct cds_hlist_node *next; }; -struct hlist_node +struct cds_hlist_node { - struct hlist_node *next; - struct hlist_node *prev; + struct cds_hlist_node *next; + struct cds_hlist_node *prev; }; /* Initialize a new list head. */ -static inline void INIT_HLIST_HEAD(struct hlist_head *ptr) +static inline void CDS_INIT_HLIST_HEAD(struct cds_hlist_head *ptr) { ptr->next = NULL; } /* Get typed element from list at a given position. */ -#define hlist_entry(ptr, type, member) \ +#define cds_hlist_entry(ptr, type, member) \ ((type *) ((char *) (ptr) - (unsigned long) (&((type *) 0)->member))) /* Add new element at the head of the list. */ -static inline void hlist_add_head (struct hlist_node *newp, - struct hlist_head *head) +static inline void cds_hlist_add_head (struct cds_hlist_node *newp, + struct cds_hlist_head *head) { if (head->next) head->next->prev = newp; newp->next = head->next; - newp->prev = (struct hlist_node *)head; + newp->prev = (struct cds_hlist_node *)head; head->next = newp; } /* Remove element from list. */ -static inline void hlist_del (struct hlist_node *elem) +static inline void cds_hlist_del (struct cds_hlist_node *elem) { if (elem->next) elem->next->prev = elem->prev; @@ -58,18 +58,18 @@ static inline void hlist_del (struct hlist_node *elem) elem->prev->next = elem->next; } -#define hlist_for_each_entry(entry, pos, head, member) \ +#define cds_hlist_for_each_entry(entry, pos, head, member) \ for (pos = (head)->next, \ - entry = hlist_entry(pos, typeof(*entry), member); \ + entry = cds_hlist_entry(pos, typeof(*entry), member); \ pos != NULL; \ pos = pos->next, \ - entry = hlist_entry(pos, typeof(*entry), member)) + entry = cds_hlist_entry(pos, typeof(*entry), member)) -#define hlist_for_each_entry_safe(entry, pos, p, head, member) \ +#define cds_hlist_for_each_entry_safe(entry, pos, p, head, member) \ for (pos = (head)->next, \ - entry = hlist_entry(pos, typeof(*entry), member); \ + entry = cds_hlist_entry(pos, typeof(*entry), member); \ (pos != NULL) && ({ p = pos->next; 1;}); \ pos = p, \ - entry = hlist_entry(pos, typeof(*entry), member)) + entry = cds_hlist_entry(pos, typeof(*entry), member)) #endif /* _KCOMPAT_HLIST_H */ diff --git a/urcu/list.h b/urcu/list.h index 888e776..b872713 100644 --- a/urcu/list.h +++ b/urcu/list.h @@ -26,26 +26,26 @@ /* Basic type for the double-link list. */ -typedef struct list_head +typedef struct cds_list_head { - struct list_head *next; - struct list_head *prev; + struct cds_list_head *next; + struct cds_list_head *prev; } list_t; /* Define a variable with the head and tail of the list. */ -#define LIST_HEAD(name) \ +#define CDS_LIST_HEAD(name) \ list_t name = { &(name), &(name) } /* Initialize a new list head. */ -#define INIT_LIST_HEAD(ptr) \ +#define CDS_INIT_LIST_HEAD(ptr) \ (ptr)->next = (ptr)->prev = (ptr) -#define LIST_HEAD_INIT(name) { .prev = &(name), .next = &(name) } +#define CDS_LIST_HEAD_INIT(name) { .prev = &(name), .next = &(name) } /* Add new element at the head of the list. */ static inline void -list_add (list_t *newp, list_t *head) +cds_list_add (list_t *newp, list_t *head) { head->next->prev = newp; newp->next = head->next; @@ -56,7 +56,7 @@ list_add (list_t *newp, list_t *head) /* Add new element at the tail of the list. */ static inline void -list_add_tail (list_t *newp, list_t *head) +cds_list_add_tail (list_t *newp, list_t *head) { head->prev->next = newp; newp->next = head; @@ -67,7 +67,7 @@ list_add_tail (list_t *newp, list_t *head) /* Remove element from list. */ static inline void -__list_del (list_t *prev, list_t *next) +__cds_list_del (list_t *prev, list_t *next) { next->prev = prev; prev->next = next; @@ -75,23 +75,23 @@ __list_del (list_t *prev, list_t *next) /* Remove element from list. */ static inline void -list_del (list_t *elem) +cds_list_del (list_t *elem) { - __list_del (elem->prev, elem->next); + __cds_list_del (elem->prev, elem->next); } /* delete from list, add to another list as head */ static inline void -list_move (list_t *elem, list_t *head) +cds_list_move (list_t *elem, list_t *head) { - __list_del (elem->prev, elem->next); - list_add (elem, head); + __cds_list_del (elem->prev, elem->next); + cds_list_add (elem, head); } /* replace an old entry. */ static inline void -list_replace(list_t *old, list_t *_new) +cds_list_replace(list_t *old, list_t *_new) { _new->next = old->next; _new->prev = old->prev; @@ -101,7 +101,7 @@ list_replace(list_t *old, list_t *_new) /* Join two lists. */ static inline void -list_splice (list_t *add, list_t *head) +cds_list_splice (list_t *add, list_t *head) { /* Do nothing if the list which gets added is empty. */ if (add != add->next) @@ -115,56 +115,56 @@ list_splice (list_t *add, list_t *head) /* Get typed element from list at a given position. */ -#define list_entry(ptr, type, member) \ +#define cds_list_entry(ptr, type, member) \ ((type *) ((char *) (ptr) - (unsigned long) (&((type *) 0)->member))) /* Iterate forward over the elements of the list. */ -#define list_for_each(pos, head) \ +#define cds_list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) /* Iterate forward over the elements of the list. */ -#define list_for_each_prev(pos, head) \ +#define cds_list_for_each_prev(pos, head) \ for (pos = (head)->prev; pos != (head); pos = pos->prev) /* Iterate backwards over the elements list. The list elements can be removed from the list while doing this. */ -#define list_for_each_prev_safe(pos, p, head) \ +#define cds_list_for_each_prev_safe(pos, p, head) \ for (pos = (head)->prev, p = pos->prev; \ pos != (head); \ pos = p, p = pos->prev) -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ +#define cds_list_for_each_entry(pos, head, member) \ + for (pos = cds_list_entry((head)->next, typeof(*pos), member); \ &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) + pos = cds_list_entry(pos->member.next, typeof(*pos), member)) -#define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member); \ +#define cds_list_for_each_entry_reverse(pos, head, member) \ + for (pos = cds_list_entry((head)->prev, typeof(*pos), member); \ &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) + pos = cds_list_entry(pos->member.prev, typeof(*pos), member)) -#define list_for_each_entry_safe(pos, p, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - p = list_entry(pos->member.next,typeof(*pos), member); \ +#define cds_list_for_each_entry_safe(pos, p, head, member) \ + for (pos = cds_list_entry((head)->next, typeof(*pos), member), \ + p = cds_list_entry(pos->member.next,typeof(*pos), member); \ &pos->member != (head); \ - pos = p, p = list_entry(pos->member.next, typeof(*pos), member)) + pos = p, p = cds_list_entry(pos->member.next, typeof(*pos), member)) -static inline int list_empty(list_t *head) +static inline int cds_list_empty(list_t *head) { return head == head->next; } -static inline void list_replace_init(list_t *old, +static inline void cds_list_replace_init(list_t *old, list_t *_new) { list_t *head = old->next; - list_del(old); - list_add_tail(_new, head); - INIT_LIST_HEAD(old); + cds_list_del(old); + cds_list_add_tail(_new, head); + CDS_INIT_LIST_HEAD(old); } #endif /* list.h */ diff --git a/urcu/rcuhlist.h b/urcu/rcuhlist.h index cce80aa..ef024ab 100644 --- a/urcu/rcuhlist.h +++ b/urcu/rcuhlist.h @@ -30,11 +30,11 @@ /* Add new element at the head of the list. */ -static inline void hlist_add_head_rcu(struct hlist_node *newp, - struct hlist_head *head) +static inline void cds_hlist_add_head_rcu(struct cds_hlist_node *newp, + struct cds_hlist_head *head) { newp->next = head->next; - newp->prev = (struct hlist_node *)head; + newp->prev = (struct cds_hlist_node *)head; cmm_smp_wmb(); if (head->next) head->next->prev = newp; @@ -42,7 +42,7 @@ static inline void hlist_add_head_rcu(struct hlist_node *newp, } /* Remove element from list. */ -static inline void hlist_del_rcu(struct hlist_node *elem) +static inline void cds_hlist_del_rcu(struct cds_hlist_node *elem) { if (elem->next) elem->next->prev = elem->prev; @@ -54,11 +54,11 @@ static inline void hlist_del_rcu(struct hlist_node *elem) * This must be done while rcu_read_lock() is held. */ -#define hlist_for_each_entry_rcu(entry, pos, head, member) \ +#define cds_hlist_for_each_entry_rcu(entry, pos, head, member) \ for (pos = rcu_dereference((head)->next), \ - entry = hlist_entry(pos, typeof(*entry), member); \ + entry = cds_hlist_entry(pos, typeof(*entry), member); \ pos != NULL; \ pos = rcu_dereference(pos->next), \ - entry = hlist_entry(pos, typeof(*entry), member)) + entry = cds_hlist_entry(pos, typeof(*entry), member)) #endif /* _URCU_RCUHLIST_H */ diff --git a/urcu/rculfqueue-static.h b/urcu/rculfqueue-static.h index ffc5bdb..95294f9 100644 --- a/urcu/rculfqueue-static.h +++ b/urcu/rculfqueue-static.h @@ -47,21 +47,21 @@ extern "C" { #define URCU_LFQ_PERMANENT_REF 128 -void _rcu_lfq_node_init(struct rcu_lfq_node *node) +void _cds_lfq_node_init_rcu(struct cds_lfq_node_rcu *node) { node->next = NULL; urcu_ref_init(&node->ref); } -void _rcu_lfq_init(struct rcu_lfq_queue *q) +void _cds_lfq_init_rcu(struct cds_lfq_queue_rcu *q) { - _rcu_lfq_node_init(&q->init); + _cds_lfq_node_init_rcu(&q->init); /* Make sure the initial node is never freed. */ urcu_ref_set(&q->init.ref, URCU_LFQ_PERMANENT_REF); q->head = q->tail = &q->init; } -void _rcu_lfq_enqueue(struct rcu_lfq_queue *q, struct rcu_lfq_node *node) +void _cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q, struct cds_lfq_node_rcu *node) { urcu_ref_get(&node->ref); @@ -71,7 +71,7 @@ void _rcu_lfq_enqueue(struct rcu_lfq_queue *q, struct rcu_lfq_node *node) */ for (;;) { - struct rcu_lfq_node *tail, *next; + struct cds_lfq_node_rcu *tail, *next; rcu_read_lock(); tail = rcu_dereference(q->tail); @@ -105,17 +105,17 @@ void _rcu_lfq_enqueue(struct rcu_lfq_queue *q, struct rcu_lfq_node *node) * The entry returned by dequeue must be taken care of by doing a urcu_ref_put, * which calls the release primitive when the reference count drops to zero. A * grace period must be waited after execution of the release callback before - * performing the actual memory reclamation or modifying the rcu_lfq_node + * performing the actual memory reclamation or modifying the cds_lfq_node_rcu * structure. * In other words, the entry lfq node returned by dequeue must not be * modified/re-used/freed until the reference count reaches zero and a grace * period has elapsed (after the refcount reached 0). */ -struct rcu_lfq_node * -_rcu_lfq_dequeue(struct rcu_lfq_queue *q, void (*release)(struct urcu_ref *)) +struct cds_lfq_node_rcu * +_cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu *q, void (*release)(struct urcu_ref *)) { for (;;) { - struct rcu_lfq_node *head, *next; + struct cds_lfq_node_rcu *head, *next; rcu_read_lock(); head = rcu_dereference(q->head); diff --git a/urcu/rculfqueue.h b/urcu/rculfqueue.h index f229cc7..7b3f81a 100644 --- a/urcu/rculfqueue.h +++ b/urcu/rculfqueue.h @@ -40,43 +40,43 @@ extern "C" { * which point their reference count will be decremented. */ -struct rcu_lfq_node { - struct rcu_lfq_node *next; +struct cds_lfq_node_rcu { + struct cds_lfq_node_rcu *next; struct urcu_ref ref; }; -struct rcu_lfq_queue { - struct rcu_lfq_node *head, *tail; - struct rcu_lfq_node init; /* Dummy initialization node */ +struct cds_lfq_queue_rcu { + struct cds_lfq_node_rcu *head, *tail; + struct cds_lfq_node_rcu init; /* Dummy initialization node */ }; #ifdef _LGPL_SOURCE #include -#define rcu_lfq_node_init _rcu_lfq_node_init -#define rcu_lfq_init _rcu_lfq_init -#define rcu_lfq_enqueue _rcu_lfq_enqueue -#define rcu_lfq_dequeue _rcu_lfq_dequeue +#define cds_lfq_node_init_rcu _cds_lfq_node_init_rcu +#define cds_lfq_init_rcu _cds_lfq_init_rcu +#define cds_lfq_enqueue_rcu _cds_lfq_enqueue_rcu +#define cds_lfq_dequeue_rcu _cds_lfq_dequeue_rcu #else /* !_LGPL_SOURCE */ -extern void rcu_lfq_node_init(struct rcu_lfq_node *node); -extern void rcu_lfq_init(struct rcu_lfq_queue *q); -extern void rcu_lfq_enqueue(struct rcu_lfq_queue *q, struct rcu_lfq_node *node); +extern void cds_lfq_node_init_rcu(struct cds_lfq_node_rcu *node); +extern void cds_lfq_init_rcu(struct cds_lfq_queue_rcu *q); +extern void cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q, struct cds_lfq_node_rcu *node); /* * The entry returned by dequeue must be taken care of by doing a urcu_ref_put, * which calls the release primitive when the reference count drops to zero. A * grace period must be waited after execution of the release callback before - * performing the actual memory reclamation or modifying the rcu_lfq_node + * performing the actual memory reclamation or modifying the cds_lfq_node_rcu * structure. * In other words, the entry lfq node returned by dequeue must not be * modified/re-used/freed until the reference count reaches zero and a grace * period has elapsed (after the refcount reached 0). */ -extern struct rcu_lfq_node * -rcu_lfq_dequeue(struct rcu_lfq_queue *q, void (*release)(struct urcu_ref *)); +extern struct cds_lfq_node_rcu * +cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu *q, void (*release)(struct urcu_ref *)); #endif /* !_LGPL_SOURCE */ diff --git a/urcu/rculfstack-static.h b/urcu/rculfstack-static.h index 3ce24c5..f541d40 100644 --- a/urcu/rculfstack-static.h +++ b/urcu/rculfstack-static.h @@ -33,21 +33,21 @@ extern "C" { #endif -void _rcu_lfs_node_init(struct rcu_lfs_node *node) +void _cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node) { } -void _rcu_lfs_init(struct rcu_lfs_stack *s) +void _cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s) { s->head = NULL; } -void _rcu_lfs_push(struct rcu_lfs_stack *s, struct rcu_lfs_node *node) +void _cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, struct cds_lfs_node_rcu *node) { - struct rcu_lfs_node *head = NULL; + struct cds_lfs_node_rcu *head = NULL; for (;;) { - struct rcu_lfs_node *old_head = head; + struct cds_lfs_node_rcu *old_head = head; node->next = head; /* @@ -62,19 +62,19 @@ void _rcu_lfs_push(struct rcu_lfs_stack *s, struct rcu_lfs_node *node) /* * The caller must wait for a grace period to pass before freeing the returned - * node or modifying the rcu_lfs_node structure. + * node or modifying the cds_lfs_node_rcu structure. * Returns NULL if stack is empty. */ -struct rcu_lfs_node * -_rcu_lfs_pop(struct rcu_lfs_stack *s) +struct cds_lfs_node_rcu * +_cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s) { for (;;) { - struct rcu_lfs_node *head; + struct cds_lfs_node_rcu *head; rcu_read_lock(); head = rcu_dereference(s->head); if (head) { - struct rcu_lfs_node *next = rcu_dereference(head->next); + struct cds_lfs_node_rcu *next = rcu_dereference(head->next); if (uatomic_cmpxchg(&s->head, head, next) == head) { rcu_read_unlock(); diff --git a/urcu/rculfstack.h b/urcu/rculfstack.h index a33fcb1..20ac26c 100644 --- a/urcu/rculfstack.h +++ b/urcu/rculfstack.h @@ -27,35 +27,35 @@ extern "C" { #endif -struct rcu_lfs_node { - struct rcu_lfs_node *next; +struct cds_lfs_node_rcu { + struct cds_lfs_node_rcu *next; }; -struct rcu_lfs_stack { - struct rcu_lfs_node *head; +struct cds_lfs_stack_rcu { + struct cds_lfs_node_rcu *head; }; #ifdef _LGPL_SOURCE #include -#define rcu_lfs_node_init _rcu_lfs_node_init -#define rcu_lfs_init _rcu_lfs_init -#define rcu_lfs_push _rcu_lfs_push -#define rcu_lfs_pop _rcu_lfs_pop +#define cds_lfs_node_init_rcu _cds_lfs_node_init_rcu +#define cds_lfs_init_rcu _cds_lfs_init_rcu +#define cds_lfs_push_rcu _cds_lfs_push_rcu +#define cds_lfs_pop_rcu _cds_lfs_pop_rcu #else /* !_LGPL_SOURCE */ -extern void rcu_lfs_node_init(struct rcu_lfs_node *node); -extern void rcu_lfs_init(struct rcu_lfs_stack *s); -extern void rcu_lfs_push(struct rcu_lfs_stack *s, struct rcu_lfs_node *node); +extern void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node); +extern void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s); +extern void cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, struct cds_lfs_node_rcu *node); /* * The caller must wait for a grace period to pass before freeing the returned - * node or modifying the rcu_lfs_node structure. + * node or modifying the cds_lfs_node_rcu structure. * Returns NULL if stack is empty. */ -extern struct rcu_lfs_node *rcu_lfs_pop(struct rcu_lfs_stack *s); +extern struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s); #endif /* !_LGPL_SOURCE */ diff --git a/urcu/rculist.h b/urcu/rculist.h index 3a4e335..d5bffbc 100644 --- a/urcu/rculist.h +++ b/urcu/rculist.h @@ -30,7 +30,7 @@ /* Add new element at the head of the list. */ -static inline void list_add_rcu(list_t *newp, list_t *head) +static inline void cds_list_add_rcu(list_t *newp, list_t *head) { newp->next = head->next; newp->prev = head; @@ -41,7 +41,7 @@ static inline void list_add_rcu(list_t *newp, list_t *head) /* replace an old entry atomically. */ -static inline void list_replace_rcu(list_t *old, list_t *_new) +static inline void cds_list_replace_rcu(list_t *old, list_t *_new) { _new->next = old->next; _new->prev = old->prev; @@ -50,7 +50,7 @@ static inline void list_replace_rcu(list_t *old, list_t *_new) } /* Remove element from list. */ -static inline void list_del_rcu(list_t *elem) +static inline void cds_list_del_rcu(list_t *elem) { elem->next->prev = elem->prev; elem->prev->next = elem->next; @@ -62,16 +62,16 @@ static inline void list_del_rcu(list_t *elem) */ /* Iterate forward over the elements of the list. */ -#define list_for_each_rcu(pos, head) \ +#define cds_list_for_each_rcu(pos, head) \ for (pos = rcu_dereference((head)->next); pos != (head); \ pos = rcu_dereference(pos->next)) /* Iterate through elements of the list. */ -#define list_for_each_entry_rcu(pos, head, member) \ - for (pos = list_entry(rcu_dereference((head)->next), typeof(*pos), member); \ +#define cds_list_for_each_entry_rcu(pos, head, member) \ + for (pos = cds_list_entry(rcu_dereference((head)->next), typeof(*pos), member); \ &pos->member != (head); \ - pos = list_entry(rcu_dereference(pos->member.next), typeof(*pos), member)) + pos = cds_list_entry(rcu_dereference(pos->member.next), typeof(*pos), member)) #endif /* _URCU_RCULIST_H */ diff --git a/urcu/wfqueue-static.h b/urcu/wfqueue-static.h index d0db3fc..4839c47 100644 --- a/urcu/wfqueue-static.h +++ b/urcu/wfqueue-static.h @@ -47,16 +47,16 @@ extern "C" { #define WFQ_ADAPT_ATTEMPTS 10 /* Retry if being set */ #define WFQ_WAIT 10 /* Wait 10 ms if being set */ -void _wfq_node_init(struct wfq_node *node) +void _cds_wfq_node_init(struct cds_wfq_node *node) { node->next = NULL; } -void _wfq_init(struct wfq_queue *q) +void _cds_wfq_init(struct cds_wfq_queue *q) { int ret; - _wfq_node_init(&q->dummy); + _cds_wfq_node_init(&q->dummy); /* Set queue head and tail */ q->head = &q->dummy; q->tail = &q->dummy.next; @@ -64,9 +64,9 @@ void _wfq_init(struct wfq_queue *q) assert(!ret); } -void _wfq_enqueue(struct wfq_queue *q, struct wfq_node *node) +void _cds_wfq_enqueue(struct cds_wfq_queue *q, struct cds_wfq_node *node) { - struct wfq_node **old_tail; + struct cds_wfq_node **old_tail; /* * uatomic_xchg() implicit memory barrier orders earlier stores to data @@ -90,10 +90,10 @@ void _wfq_enqueue(struct wfq_queue *q, struct wfq_node *node) * thread to be scheduled. The queue appears empty until tail->next is set by * enqueue. */ -struct wfq_node * -___wfq_dequeue_blocking(struct wfq_queue *q) +struct cds_wfq_node * +___cds_wfq_dequeue_blocking(struct cds_wfq_queue *q) { - struct wfq_node *node, *next; + struct cds_wfq_node *node, *next; int attempt = 0; /* @@ -121,22 +121,22 @@ ___wfq_dequeue_blocking(struct wfq_queue *q) * Requeue dummy node if we just dequeued it. */ if (node == &q->dummy) { - _wfq_node_init(node); - _wfq_enqueue(q, node); - return ___wfq_dequeue_blocking(q); + _cds_wfq_node_init(node); + _cds_wfq_enqueue(q, node); + return ___cds_wfq_dequeue_blocking(q); } return node; } -struct wfq_node * -_wfq_dequeue_blocking(struct wfq_queue *q) +struct cds_wfq_node * +_cds_wfq_dequeue_blocking(struct cds_wfq_queue *q) { - struct wfq_node *retnode; + struct cds_wfq_node *retnode; int ret; ret = pthread_mutex_lock(&q->lock); assert(!ret); - retnode = ___wfq_dequeue_blocking(q); + retnode = ___cds_wfq_dequeue_blocking(q); ret = pthread_mutex_unlock(&q->lock); assert(!ret); return retnode; diff --git a/urcu/wfqueue.h b/urcu/wfqueue.h index 5dc64f1..f063900 100644 --- a/urcu/wfqueue.h +++ b/urcu/wfqueue.h @@ -40,13 +40,13 @@ extern "C" { * Paul E. McKenney. */ -struct wfq_node { - struct wfq_node *next; +struct cds_wfq_node { + struct cds_wfq_node *next; }; -struct wfq_queue { - struct wfq_node *head, **tail; - struct wfq_node dummy; /* Dummy node */ +struct cds_wfq_queue { + struct cds_wfq_node *head, **tail; + struct cds_wfq_node dummy; /* Dummy node */ pthread_mutex_t lock; }; @@ -54,20 +54,20 @@ struct wfq_queue { #include -#define wfq_node_init _wfq_node_init -#define wfq_init _wfq_init -#define wfq_enqueue _wfq_enqueue -#define __wfq_dequeue_blocking ___wfq_dequeue_blocking -#define wfq_dequeue_blocking _wfq_dequeue_blocking +#define cds_wfq_node_init _cds_wfq_node_init +#define cds_wfq_init _cds_wfq_init +#define cds_wfq_enqueue _cds_wfq_enqueue +#define __cds_wfq_dequeue_blocking ___cds_wfq_dequeue_blocking +#define cds_wfq_dequeue_blocking _cds_wfq_dequeue_blocking #else /* !_LGPL_SOURCE */ -extern void wfq_node_init(struct wfq_node *node); -extern void wfq_init(struct wfq_queue *q); -extern void wfq_enqueue(struct wfq_queue *q, struct wfq_node *node); -/* __wfq_dequeue_blocking: caller ensures mutual exclusion between dequeues */ -extern struct wfq_node *__wfq_dequeue_blocking(struct wfq_queue *q); -extern struct wfq_node *wfq_dequeue_blocking(struct wfq_queue *q); +extern void cds_wfq_node_init(struct cds_wfq_node *node); +extern void cds_wfq_init(struct cds_wfq_queue *q); +extern void cds_wfq_enqueue(struct cds_wfq_queue *q, struct cds_wfq_node *node); +/* __cds_wfq_dequeue_blocking: caller ensures mutual exclusion between dequeues */ +extern struct cds_wfq_node *__cds_wfq_dequeue_blocking(struct cds_wfq_queue *q); +extern struct cds_wfq_node *cds_wfq_dequeue_blocking(struct cds_wfq_queue *q); #endif /* !_LGPL_SOURCE */ diff --git a/urcu/wfstack-static.h b/urcu/wfstack-static.h index 0acb4f0..cecdde1 100644 --- a/urcu/wfstack-static.h +++ b/urcu/wfstack-static.h @@ -35,27 +35,27 @@ extern "C" { #endif -#define WF_STACK_END ((void *)0x1UL) -#define WFS_ADAPT_ATTEMPTS 10 /* Retry if being set */ -#define WFS_WAIT 10 /* Wait 10 ms if being set */ +#define CDS_WF_STACK_END ((void *)0x1UL) +#define CDS_WFS_ADAPT_ATTEMPTS 10 /* Retry if being set */ +#define CDS_WFS_WAIT 10 /* Wait 10 ms if being set */ -void _wfs_node_init(struct wfs_node *node) +void _cds_wfs_node_init(struct cds_wfs_node *node) { node->next = NULL; } -void _wfs_init(struct wfs_stack *s) +void _cds_wfs_init(struct cds_wfs_stack *s) { int ret; - s->head = WF_STACK_END; + s->head = CDS_WF_STACK_END; ret = pthread_mutex_init(&s->lock, NULL); assert(!ret); } -void _wfs_push(struct wfs_stack *s, struct wfs_node *node) +void _cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node) { - struct wfs_node *old_head; + struct cds_wfs_node *old_head; assert(node->next == NULL); /* @@ -73,22 +73,22 @@ void _wfs_push(struct wfs_stack *s, struct wfs_node *node) /* * Returns NULL if stack is empty. */ -struct wfs_node * -___wfs_pop_blocking(struct wfs_stack *s) +struct cds_wfs_node * +___cds_wfs_pop_blocking(struct cds_wfs_stack *s) { - struct wfs_node *head, *next; + struct cds_wfs_node *head, *next; int attempt = 0; retry: head = CAA_LOAD_SHARED(s->head); - if (head == WF_STACK_END) + if (head == CDS_WF_STACK_END) return NULL; /* * Adaptative busy-looping waiting for push to complete. */ while ((next = CAA_LOAD_SHARED(head->next)) == NULL) { - if (++attempt >= WFS_ADAPT_ATTEMPTS) { - poll(NULL, 0, WFS_WAIT); /* Wait for 10ms */ + if (++attempt >= CDS_WFS_ADAPT_ATTEMPTS) { + poll(NULL, 0, CDS_WFS_WAIT); /* Wait for 10ms */ attempt = 0; } else caa_cpu_relax(); @@ -99,15 +99,15 @@ retry: goto retry; /* Concurrent modification. Retry. */ } -struct wfs_node * -_wfs_pop_blocking(struct wfs_stack *s) +struct cds_wfs_node * +_cds_wfs_pop_blocking(struct cds_wfs_stack *s) { - struct wfs_node *retnode; + struct cds_wfs_node *retnode; int ret; ret = pthread_mutex_lock(&s->lock); assert(!ret); - retnode = ___wfs_pop_blocking(s); + retnode = ___cds_wfs_pop_blocking(s); ret = pthread_mutex_unlock(&s->lock); assert(!ret); return retnode; diff --git a/urcu/wfstack.h b/urcu/wfstack.h index 6cb4971..c13ba64 100644 --- a/urcu/wfstack.h +++ b/urcu/wfstack.h @@ -31,12 +31,12 @@ extern "C" { #endif -struct wfs_node { - struct wfs_node *next; +struct cds_wfs_node { + struct cds_wfs_node *next; }; -struct wfs_stack { - struct wfs_node *head; +struct cds_wfs_stack { + struct cds_wfs_node *head; pthread_mutex_t lock; }; @@ -44,20 +44,20 @@ struct wfs_stack { #include -#define wfs_node_init _wfs_node_init -#define wfs_init _wfs_init -#define wfs_push _wfs_push -#define __wfs_pop_blocking ___wfs_pop_blocking -#define wfs_pop_blocking _wfs_pop_blocking +#define cds_wfs_node_init _cds_wfs_node_init +#define cds_wfs_init _cds_wfs_init +#define cds_wfs_push _cds_wfs_push +#define __cds_wfs_pop_blocking ___cds_wfs_pop_blocking +#define cds_wfs_pop_blocking _cds_wfs_pop_blocking #else /* !_LGPL_SOURCE */ -extern void wfs_node_init(struct wfs_node *node); -extern void wfs_init(struct wfs_stack *s); -extern void wfs_push(struct wfs_stack *s, struct wfs_node *node); -/* __wfs_pop_blocking: caller ensures mutual exclusion between pops */ -extern struct wfs_node *__wfs_pop_blocking(struct wfs_stack *s); -extern struct wfs_node *wfs_pop_blocking(struct wfs_stack *s); +extern void cds_wfs_node_init(struct cds_wfs_node *node); +extern void cds_wfs_init(struct cds_wfs_stack *s); +extern void cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node); +/* __cds_wfs_pop_blocking: caller ensures mutual exclusion between pops */ +extern struct cds_wfs_node *__cds_wfs_pop_blocking(struct cds_wfs_stack *s); +extern struct cds_wfs_node *cds_wfs_pop_blocking(struct cds_wfs_stack *s); #endif /* !_LGPL_SOURCE */ diff --git a/wfqueue.c b/wfqueue.c index 182b4a4..dc7bdfc 100644 --- a/wfqueue.c +++ b/wfqueue.c @@ -28,27 +28,27 @@ * library wrappers to be used by non-LGPL compatible source code. */ -void wfq_node_init(struct wfq_node *node) +void cds_wfq_node_init(struct cds_wfq_node *node) { - _wfq_node_init(node); + _cds_wfq_node_init(node); } -void wfq_init(struct wfq_queue *q) +void cds_wfq_init(struct cds_wfq_queue *q) { - _wfq_init(q); + _cds_wfq_init(q); } -void wfq_enqueue(struct wfq_queue *q, struct wfq_node *node) +void cds_wfq_enqueue(struct cds_wfq_queue *q, struct cds_wfq_node *node) { - _wfq_enqueue(q, node); + _cds_wfq_enqueue(q, node); } -struct wfq_node *__wfq_dequeue_blocking(struct wfq_queue *q) +struct cds_wfq_node *__cds_wfq_dequeue_blocking(struct cds_wfq_queue *q) { - return ___wfq_dequeue_blocking(q); + return ___cds_wfq_dequeue_blocking(q); } -struct wfq_node *wfq_dequeue_blocking(struct wfq_queue *q) +struct cds_wfq_node *cds_wfq_dequeue_blocking(struct cds_wfq_queue *q) { - return _wfq_dequeue_blocking(q); + return _cds_wfq_dequeue_blocking(q); } diff --git a/wfstack.c b/wfstack.c index 6221307..db29558 100644 --- a/wfstack.c +++ b/wfstack.c @@ -28,27 +28,27 @@ * library wrappers to be used by non-LGPL compatible source code. */ -void wfs_node_init(struct wfs_node *node) +void cds_wfs_node_init(struct cds_wfs_node *node) { - _wfs_node_init(node); + _cds_wfs_node_init(node); } -void wfs_init(struct wfs_stack *s) +void cds_wfs_init(struct cds_wfs_stack *s) { - _wfs_init(s); + _cds_wfs_init(s); } -void wfs_push(struct wfs_stack *s, struct wfs_node *node) +void cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node) { - _wfs_push(s, node); + _cds_wfs_push(s, node); } -struct wfs_node *__wfs_pop_blocking(struct wfs_stack *s) +struct cds_wfs_node *__cds_wfs_pop_blocking(struct cds_wfs_stack *s) { - return ___wfs_pop_blocking(s); + return ___cds_wfs_pop_blocking(s); } -struct wfs_node *wfs_pop_blocking(struct wfs_stack *s) +struct cds_wfs_node *cds_wfs_pop_blocking(struct cds_wfs_stack *s) { - return _wfs_pop_blocking(s); + return _cds_wfs_pop_blocking(s); } -- 2.34.1