summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-07-25 21:04:13 +0200
committerRichard Braun <rbraun@sceen.net>2017-07-25 21:04:13 +0200
commit92b58ff6e9a2a82e5abb86b4e926d4fa22dfc2a3 (patch)
tree908ca23cd945e0593a49214ab89eab17e0709776
parent56fd1f5d9aabdbae8e694e9268875268a2811740 (diff)
Rename llsync accessors
-rw-r--r--hlist.h18
-rw-r--r--list.h14
-rw-r--r--rdxtree.c30
-rw-r--r--rdxtree.h6
-rw-r--r--slist.h22
5 files changed, 45 insertions, 45 deletions
diff --git a/hlist.h b/hlist.h
index 256d52f..0e9deeb 100644
--- a/hlist.h
+++ b/hlist.h
@@ -290,8 +290,8 @@ for (entry = hlist_first_entry(list, typeof(*entry), member), \
* These macros can be replaced by actual functions in an environment
* that provides lockless synchronization such as RCU.
*/
-#define llsync_assign_ptr(ptr, value) ((ptr) = (value))
-#define llsync_read_ptr(ptr) (ptr)
+#define llsync_store_ptr(ptr, value) ((ptr) = (value))
+#define llsync_load_ptr(ptr) (ptr)
/*
* Return the first node of a list.
@@ -299,7 +299,7 @@ for (entry = hlist_first_entry(list, typeof(*entry), member), \
static inline struct hlist_node *
hlist_llsync_first(const struct hlist *list)
{
- return llsync_read_ptr(list->first);
+ return llsync_load_ptr(list->first);
}
/*
@@ -308,7 +308,7 @@ hlist_llsync_first(const struct hlist *list)
static inline struct hlist_node *
hlist_llsync_next(const struct hlist_node *node)
{
- return llsync_read_ptr(node->next);
+ return llsync_load_ptr(node->next);
}
/*
@@ -327,7 +327,7 @@ hlist_llsync_insert_head(struct hlist *list, struct hlist_node *node)
first->pprev = &node->next;
}
- llsync_assign_ptr(list->first, node);
+ llsync_store_ptr(list->first, node);
}
/*
@@ -339,7 +339,7 @@ hlist_llsync_insert_before(struct hlist_node *next, struct hlist_node *node)
node->next = next;
node->pprev = next->pprev;
next->pprev = &node->next;
- llsync_assign_ptr(*node->pprev, node);
+ llsync_store_ptr(*node->pprev, node);
}
/*
@@ -355,7 +355,7 @@ hlist_llsync_insert_after(struct hlist_node *prev, struct hlist_node *node)
node->next->pprev = &node->next;
}
- llsync_assign_ptr(prev->next, node);
+ llsync_store_ptr(prev->next, node);
}
/*
@@ -368,7 +368,7 @@ hlist_llsync_remove(struct hlist_node *node)
node->next->pprev = node->pprev;
}
- llsync_assign_ptr(*node->pprev, node->next);
+ llsync_store_ptr(*node->pprev, node->next);
}
/*
@@ -376,7 +376,7 @@ hlist_llsync_remove(struct hlist_node *node)
* given node based on the given type and member.
*/
#define hlist_llsync_entry(node, type, member) \
- structof(llsync_read_ptr(node), type, member)
+ structof(llsync_load_ptr(node), type, member)
/*
* Get the first entry of a list.
diff --git a/list.h b/list.h
index 20da213..4853b2e 100644
--- a/list.h
+++ b/list.h
@@ -409,8 +409,8 @@ for (entry = list_last_entry(list, typeof(*entry), member), \
* These macros can be replaced by actual functions in an environment
* that provides lockless synchronization such as RCU.
*/
-#define llsync_assign_ptr(ptr, value) ((ptr) = (value))
-#define llsync_read_ptr(ptr) (ptr)
+#define llsync_store_ptr(ptr, value) ((ptr) = (value))
+#define llsync_load_ptr(ptr) (ptr)
/*
* Return the first node of a list.
@@ -418,7 +418,7 @@ for (entry = list_last_entry(list, typeof(*entry), member), \
static inline struct list *
list_llsync_first(const struct list *list)
{
- return llsync_read_ptr(list->next);
+ return llsync_load_ptr(list->next);
}
/*
@@ -427,7 +427,7 @@ list_llsync_first(const struct list *list)
static inline struct list *
list_llsync_next(const struct list *node)
{
- return llsync_read_ptr(node->next);
+ return llsync_load_ptr(node->next);
}
/*
@@ -440,7 +440,7 @@ list_llsync_add(struct list *prev, struct list *next, struct list *node)
{
node->next = next;
node->prev = prev;
- llsync_assign_ptr(prev->next, node);
+ llsync_store_ptr(prev->next, node);
next->prev = node;
}
@@ -489,7 +489,7 @@ static inline void
list_llsync_remove(struct list *node)
{
node->next->prev = node->prev;
- llsync_assign_ptr(node->prev->next, node->next);
+ llsync_store_ptr(node->prev->next, node->next);
}
/*
@@ -497,7 +497,7 @@ list_llsync_remove(struct list *node)
* given node based on the given type and member.
*/
#define list_llsync_entry(node, type, member) \
- structof(llsync_read_ptr(node), type, member)
+ structof(llsync_load_ptr(node), type, member)
/*
* Get the first entry of a list.
diff --git a/rdxtree.c b/rdxtree.c
index 636e29d..5ae0d76 100644
--- a/rdxtree.c
+++ b/rdxtree.c
@@ -215,7 +215,7 @@ rdxtree_node_insert(struct rdxtree_node *node, unsigned short index,
assert(node->entries[index] == NULL);
node->nr_entries++;
- llsync_assign_ptr(node->entries[index], entry);
+ llsync_store_ptr(node->entries[index], entry);
}
static inline void
@@ -232,7 +232,7 @@ rdxtree_node_remove(struct rdxtree_node *node, unsigned short index)
assert(node->entries[index] != NULL);
node->nr_entries--;
- llsync_assign_ptr(node->entries[index], NULL);
+ llsync_store_ptr(node->entries[index], NULL);
}
static inline void *
@@ -244,7 +244,7 @@ rdxtree_node_find(struct rdxtree_node *node, unsigned short *indexp)
index = *indexp;
while (index < ARRAY_SIZE(node->entries)) {
- ptr = rdxtree_entry_addr(llsync_read_ptr(node->entries[index]));
+ ptr = rdxtree_entry_addr(llsync_load_ptr(node->entries[index]));
if (ptr != NULL) {
*indexp = index;
@@ -332,7 +332,7 @@ rdxtree_shrink(struct rdxtree *tree)
rdxtree_node_unlink(rdxtree_entry_addr(entry));
}
- llsync_assign_ptr(tree->root, entry);
+ llsync_store_ptr(tree->root, entry);
rdxtree_node_schedule_destruction(node);
}
}
@@ -380,7 +380,7 @@ rdxtree_grow(struct rdxtree *tree, rdxtree_key_t key)
rdxtree_node_insert(node, 0, tree->root);
tree->height++;
- llsync_assign_ptr(tree->root, rdxtree_node_to_entry(node));
+ llsync_store_ptr(tree->root, rdxtree_node_to_entry(node));
root = node;
} while (new_height > tree->height);
@@ -403,7 +403,7 @@ rdxtree_cleanup(struct rdxtree *tree, struct rdxtree_node *node)
if (node->parent == NULL) {
tree->height = 0;
- llsync_assign_ptr(tree->root, NULL);
+ llsync_store_ptr(tree->root, NULL);
rdxtree_node_schedule_destruction(node);
break;
}
@@ -458,7 +458,7 @@ rdxtree_insert_common(struct rdxtree *tree, rdxtree_key_t key,
return ERROR_BUSY;
}
- llsync_assign_ptr(tree->root, ptr);
+ llsync_store_ptr(tree->root, ptr);
if (slotp != NULL) {
*slotp = &tree->root;
@@ -486,7 +486,7 @@ rdxtree_insert_common(struct rdxtree *tree, rdxtree_key_t key,
}
if (prev == NULL) {
- llsync_assign_ptr(tree->root, rdxtree_node_to_entry(node));
+ llsync_store_ptr(tree->root, rdxtree_node_to_entry(node));
} else {
rdxtree_node_link(node, prev, index);
rdxtree_node_insert_node(prev, index, node);
@@ -535,7 +535,7 @@ rdxtree_insert_alloc_common(struct rdxtree *tree, void *ptr,
if (unlikely(height == 0)) {
if (tree->root == NULL) {
- llsync_assign_ptr(tree->root, ptr);
+ llsync_store_ptr(tree->root, ptr);
*keyp = 0;
if (slotp != NULL) {
@@ -631,7 +631,7 @@ rdxtree_remove(struct rdxtree *tree, rdxtree_key_t key)
node = rdxtree_entry_addr(tree->root);
if (unlikely(height == 0)) {
- llsync_assign_ptr(tree->root, NULL);
+ llsync_store_ptr(tree->root, NULL);
return node;
}
@@ -670,7 +670,7 @@ rdxtree_lookup_common(const struct rdxtree *tree, rdxtree_key_t key,
unsigned short height, shift, index;
void *entry;
- entry = llsync_read_ptr(tree->root);
+ entry = llsync_load_ptr(tree->root);
if (entry == NULL) {
node = NULL;
@@ -701,7 +701,7 @@ rdxtree_lookup_common(const struct rdxtree *tree, rdxtree_key_t key,
prev = node;
index = (unsigned short)(key >> shift) & RDXTREE_RADIX_MASK;
- entry = llsync_read_ptr(node->entries[index]);
+ entry = llsync_load_ptr(node->entries[index]);
node = rdxtree_entry_addr(entry);
shift -= RDXTREE_RADIX;
height--;
@@ -725,7 +725,7 @@ rdxtree_replace_slot(void **slot, void *ptr)
old = *slot;
assert(old != NULL);
rdxtree_assert_alignment(old);
- llsync_assign_ptr(*slot, ptr);
+ llsync_store_ptr(*slot, ptr);
return old;
}
@@ -737,7 +737,7 @@ rdxtree_walk_next(struct rdxtree *tree, struct rdxtree_iter *iter)
rdxtree_key_t key;
void *entry;
- entry = llsync_read_ptr(tree->root);
+ entry = llsync_load_ptr(tree->root);
if (entry == NULL) {
return NULL;
@@ -833,7 +833,7 @@ rdxtree_remove_all(struct rdxtree *tree)
if (tree->height == 0) {
if (tree->root != NULL) {
- llsync_assign_ptr(tree->root, NULL);
+ llsync_store_ptr(tree->root, NULL);
}
return;
diff --git a/rdxtree.h b/rdxtree.h
index 7604380..1eb8205 100644
--- a/rdxtree.h
+++ b/rdxtree.h
@@ -42,8 +42,8 @@
* These macros can be replaced by actual functions in an environment
* that provides lockless synchronization such as RCU.
*/
-#define llsync_assign_ptr(ptr, value) ((ptr) = (value))
-#define llsync_read_ptr(ptr) (ptr)
+#define llsync_store_ptr(ptr, value) ((ptr) = (value))
+#define llsync_load_ptr(ptr) (ptr)
/*
* This macro selects between 32 or 64-bits (the default) keys.
@@ -184,7 +184,7 @@ rdxtree_lookup_slot(const struct rdxtree *tree, rdxtree_key_t key)
static inline void *
rdxtree_load_slot(void **slot)
{
- return llsync_read_ptr(*slot);
+ return llsync_load_ptr(*slot);
}
/*
diff --git a/slist.h b/slist.h
index 146b6d7..5bb1ceb 100644
--- a/slist.h
+++ b/slist.h
@@ -323,8 +323,8 @@ for (entry = slist_first_entry(list, typeof(*entry), member), \
* These macros can be replaced by actual functions in an environment
* that provides lockless synchronization such as RCU.
*/
-#define llsync_assign_ptr(ptr, value) ((ptr) = (value))
-#define llsync_read_ptr(ptr) (ptr)
+#define llsync_store_ptr(ptr, value) ((ptr) = (value))
+#define llsync_load_ptr(ptr) (ptr)
/*
* Return the first node of a list.
@@ -332,7 +332,7 @@ for (entry = slist_first_entry(list, typeof(*entry), member), \
static inline struct slist_node *
slist_llsync_first(const struct slist *list)
{
- return llsync_read_ptr(list->first);
+ return llsync_load_ptr(list->first);
}
/*
@@ -341,7 +341,7 @@ slist_llsync_first(const struct slist *list)
static inline struct slist_node *
slist_llsync_next(const struct slist_node *node)
{
- return llsync_read_ptr(node->next);
+ return llsync_load_ptr(node->next);
}
/*
@@ -355,7 +355,7 @@ slist_llsync_insert_head(struct slist *list, struct slist_node *node)
}
node->next = list->first;
- llsync_assign_ptr(list->first, node);
+ llsync_store_ptr(list->first, node);
}
/*
@@ -367,9 +367,9 @@ slist_llsync_insert_tail(struct slist *list, struct slist_node *node)
node->next = NULL;
if (slist_empty(list)) {
- llsync_assign_ptr(list->first, node);
+ llsync_store_ptr(list->first, node);
} else {
- llsync_assign_ptr(list->last->next, node);
+ llsync_store_ptr(list->last->next, node);
}
list->last = node;
@@ -387,7 +387,7 @@ slist_llsync_insert_after(struct slist *list, struct slist_node *prev,
struct slist_node *node)
{
node->next = prev->next;
- llsync_assign_ptr(prev->next, node);
+ llsync_store_ptr(prev->next, node);
if (list->last == prev) {
list->last = node;
@@ -408,14 +408,14 @@ slist_llsync_remove(struct slist *list, struct slist_node *prev)
if (slist_end(prev)) {
node = list->first;
- llsync_assign_ptr(list->first, node->next);
+ llsync_store_ptr(list->first, node->next);
if (list->last == node) {
list->last = NULL;
}
} else {
node = prev->next;
- llsync_assign_ptr(prev->next, node->next);
+ llsync_store_ptr(prev->next, node->next);
if (list->last == node) {
list->last = prev;
@@ -428,7 +428,7 @@ slist_llsync_remove(struct slist *list, struct slist_node *prev)
* given node based on the given type and member.
*/
#define slist_llsync_entry(node, type, member) \
- structof(llsync_read_ptr(node), type, member)
+ structof(llsync_load_ptr(node), type, member)
/*
* Get the first entry of a list.