summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2021-04-02 08:52:07 +0300
committerGitHub <noreply@github.com>2021-04-02 11:22:07 +0530
commit34f854ad2f5d53578d7a4543f837cf0fb0f1a76a (patch)
treee909402e129a83e3699a2c9a80e98814e3371227
parenta23fcdf13fce0c9c606ac18b791ceccc3bceb7eb (diff)
downloadglusterfs-34f854ad2f5d53578d7a4543f837cf0fb0f1a76a.tar.gz
glusterfs-34f854ad2f5d53578d7a4543f837cf0fb0f1a76a.tar.xz
glusterfs-34f854ad2f5d53578d7a4543f837cf0fb0f1a76a.zip
list.h: remove offensive language, introduce _list_del() (#2132)
1. Replace offensive variables with the values the Linux kernel uses. 2. Introduce an internal function - _list_del() that can be used when list->next and list->prev are going to be assigned later on. (too bad in the code we do not have enough uses of list_move() and list_move() tail, btw. Would have contributed also to code readability) * list.h: defined LIST_POSION1, LIST_POISION2 similar to Linux kernel defines Fixes: #2025 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
-rw-r--r--libglusterfs/src/glusterfs/list.h29
1 files changed, 21 insertions, 8 deletions
diff --git a/libglusterfs/src/glusterfs/list.h b/libglusterfs/src/glusterfs/list.h
index 221a710ca3..bd070b2655 100644
--- a/libglusterfs/src/glusterfs/list.h
+++ b/libglusterfs/src/glusterfs/list.h
@@ -66,21 +66,34 @@ list_add_order(struct list_head *new, struct list_head *head,
list_add(new, pos);
}
+/* Delete a list entry by making the prev/next entries
+ point to each other.
+
+ This is only for internal list manipulation where we know
+ the prev/next entries already! */
static inline void
-list_del(struct list_head *old)
+_list_del(struct list_head *old)
{
- old->prev->next = old->next;
old->next->prev = old->prev;
+ old->prev->next = old->next;
+}
+
+#define LIST_POISON1 ((void *)0xdead000000000100)
+#define LIST_POISON2 ((void *)0xdead000000000122)
- old->next = (void *)0xbabebabe;
- old->prev = (void *)0xcafecafe;
+static inline void
+list_del(struct list_head *old)
+{
+ _list_del(old);
+
+ old->next = (struct list_head *)LIST_POISON1;
+ old->prev = (struct list_head *)LIST_POISON2;
}
static inline void
list_del_init(struct list_head *old)
{
- old->prev->next = old->next;
- old->next->prev = old->prev;
+ _list_del(old);
old->next = old;
old->prev = old;
@@ -89,14 +102,14 @@ list_del_init(struct list_head *old)
static inline void
list_move(struct list_head *list, struct list_head *head)
{
- list_del(list);
+ _list_del(list);
list_add(list, head);
}
static inline void
list_move_tail(struct list_head *list, struct list_head *head)
{
- list_del(list);
+ _list_del(list);
list_add_tail(list, head);
}