[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2 08/11] include/uk/list: fix style issues



Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
---
 include/uk/list.h | 115 ++++++++++++++++++++++------------------------
 1 file changed, 54 insertions(+), 61 deletions(-)

diff --git a/include/uk/list.h b/include/uk/list.h
index 161363a5..1ee24ee5 100644
--- a/include/uk/list.h
+++ b/include/uk/list.h
@@ -51,14 +51,12 @@ struct uk_list_head {
 static inline void
 UK_INIT_LIST_HEAD(struct uk_list_head *list)
 {
-
        list->next = list->prev = list;
 }
 
 static inline int
 uk_list_empty(const struct uk_list_head *head)
 {
-
        return (head->next == head);
 }
 
@@ -80,14 +78,12 @@ __uk_list_del(struct uk_list_head *prev, struct 
uk_list_head *next)
 static inline void
 __uk_list_del_entry(struct uk_list_head *entry)
 {
-
        __uk_list_del(entry->prev, entry->next);
 }
 
 static inline void
 uk_list_del(struct uk_list_head *entry)
 {
-
        __uk_list_del(entry->prev, entry->next);
 }
 
@@ -101,7 +97,8 @@ uk_list_replace(struct uk_list_head *old_entry, struct 
uk_list_head *new_entry)
 }
 
 static inline void
-uk_list_replace_init(struct uk_list_head *old_entry, struct uk_list_head 
*new_entry)
+uk_list_replace_init(struct uk_list_head *old_entry,
+                    struct uk_list_head *new_entry)
 {
        uk_list_replace(old_entry, new_entry);
        UK_INIT_LIST_HEAD(old_entry);
@@ -109,9 +106,8 @@ uk_list_replace_init(struct uk_list_head *old_entry, struct 
uk_list_head *new_en
 
 static inline void
 __uk_list_add(struct uk_list_head *new_entry, struct uk_list_head *prev,
-    struct uk_list_head *next)
+             struct uk_list_head *next)
 {
-
        next->prev = new_entry;
        new_entry->next = next;
        new_entry->prev = prev;
@@ -121,7 +117,6 @@ __uk_list_add(struct uk_list_head *new_entry, struct 
uk_list_head *prev,
 static inline void
 uk_list_del_init(struct uk_list_head *entry)
 {
-
        uk_list_del(entry);
        UK_INIT_LIST_HEAD(entry);
 }
@@ -141,25 +136,27 @@ uk_list_del_init(struct uk_list_head *entry)
        uk_list_entry(((ptr)->member.next), typeof(*(ptr)), member)
 
 #define        uk_list_safe_reset_next(ptr, n, member) \
-       (n) = uk_list_next_entry(ptr, member)
+       ((n) = uk_list_next_entry(ptr, member))
 
 #define        uk_list_prev_entry(ptr, member)                                 
\
        uk_list_entry(((ptr)->member.prev), typeof(*(ptr)), member)
 
-#define        uk_list_for_each(p, head)                                       
        \
+#define        uk_list_for_each(p, head)                               \
        for (p = (head)->next; p != (head); p = (p)->next)
 
-#define        uk_list_for_each_safe(p, n, head)                               
        \
+#define        uk_list_for_each_safe(p, n, head)                               
\
        for (p = (head)->next, n = (p)->next; p != (head); p = n, n = (p)->next)
 
 #define uk_list_for_each_entry(p, h, field)                            \
-       for (p = uk_list_entry((h)->next, typeof(*p), field); &(p)->field != 
(h); \
-           p = uk_list_entry((p)->field.next, typeof(*p), field))
+       for (p = uk_list_entry((h)->next, typeof(*p), field);           \
+            &(p)->field != (h);                                        \
+            p = uk_list_entry((p)->field.next, typeof(*p), field))
 
 #define uk_list_for_each_entry_safe(p, n, h, field)                    \
        for (p = uk_list_entry((h)->next, typeof(*p), field),           \
-           n = uk_list_entry((p)->field.next, typeof(*p), field); &(p)->field 
!= (h);\
-           p = n, n = uk_list_entry(n->field.next, typeof(*n), field))
+                    n = uk_list_entry((p)->field.next, typeof(*p), field); \
+            &(p)->field != (h);                                        \
+            p = n, n = uk_list_entry(n->field.next, typeof(*n), field))
 
 #define        uk_list_for_each_entry_from(p, h, field) \
        for ( ; &(p)->field != (h); \
@@ -169,44 +166,44 @@ uk_list_del_init(struct uk_list_head *entry)
        for (p = uk_list_next_entry((p), field); &(p)->field != (h);    \
            p = uk_list_next_entry((p), field))
 
-#define        uk_list_for_each_entry_safe_from(pos, n, head, member)          
        \
-       for (n = uk_list_entry((pos)->member.next, typeof(*pos), member);       
        \
-            &(pos)->member != (head);                                          
\
+#define        uk_list_for_each_entry_safe_from(pos, n, head, member)          
\
+       for (n = uk_list_entry((pos)->member.next, typeof(*pos), member); \
+            &(pos)->member != (head);                                  \
             pos = n, n = uk_list_entry(n->member.next, typeof(*n), member))
 
 #define        uk_list_for_each_entry_reverse(p, h, field)                     
\
-       for (p = uk_list_entry((h)->prev, typeof(*p), field); &(p)->field != 
(h); \
-           p = uk_list_entry((p)->field.prev, typeof(*p), field))
+       for (p = uk_list_entry((h)->prev, typeof(*p), field);           \
+            &(p)->field != (h);                                        \
+            p = uk_list_entry((p)->field.prev, typeof(*p), field))
 
 #define        uk_list_for_each_entry_safe_reverse(p, n, h, field)             
\
        for (p = uk_list_entry((h)->prev, typeof(*p), field),           \
-           n = uk_list_entry((p)->field.prev, typeof(*p), field); &(p)->field 
!= (h); \
-           p = n, n = uk_list_entry(n->field.prev, typeof(*n), field))
+                    n = uk_list_entry((p)->field.prev, typeof(*p), field); \
+            &(p)->field != (h);                                        \
+            p = n, n = uk_list_entry(n->field.prev, typeof(*n), field))
 
-#define        uk_list_for_each_entry_continue_reverse(p, h, field) \
-       for (p = uk_list_entry((p)->field.prev, typeof(*p), field); &(p)->field 
!= (h); \
-           p = uk_list_entry((p)->field.prev, typeof(*p), field))
+#define        uk_list_for_each_entry_continue_reverse(p, h, field)            
\
+       for (p = uk_list_entry((p)->field.prev, typeof(*p), field);     \
+            &(p)->field != (h);                                        \
+            p = uk_list_entry((p)->field.prev, typeof(*p), field))
 
 #define        uk_list_for_each_prev(p, h) for (p = (h)->prev; p != (h); p = 
(p)->prev)
 
 static inline void
 uk_list_add(struct uk_list_head *new_entry, struct uk_list_head *head)
 {
-
        __uk_list_add(new_entry, head, head->next);
 }
 
 static inline void
 uk_list_add_tail(struct uk_list_head *new_entry, struct uk_list_head *head)
 {
-
        __uk_list_add(new_entry, head->prev, head);
 }
 
 static inline void
 uk_list_move(struct uk_list_head *list, struct uk_list_head *head)
 {
-
        uk_list_del(list);
        uk_list_add(list, head);
 }
@@ -214,14 +211,13 @@ uk_list_move(struct uk_list_head *list, struct 
uk_list_head *head)
 static inline void
 uk_list_move_tail(struct uk_list_head *entry, struct uk_list_head *head)
 {
-
        uk_list_del(entry);
        uk_list_add_tail(entry, head);
 }
 
 static inline void
 __uk_list_splice(const struct uk_list_head *list, struct uk_list_head *prev,
-    struct uk_list_head *next)
+                struct uk_list_head *next)
 {
        struct uk_list_head *first;
        struct uk_list_head *last;
@@ -239,21 +235,18 @@ __uk_list_splice(const struct uk_list_head *list, struct 
uk_list_head *prev,
 static inline void
 uk_list_splice(const struct uk_list_head *list, struct uk_list_head *head)
 {
-
        __uk_list_splice(list, head, head->next);
 }
 
 static inline void
 uk_list_splice_tail(struct uk_list_head *list, struct uk_list_head *head)
 {
-
        __uk_list_splice(list, head->prev, head);
 }
 
 static inline void
 uk_list_splice_init(struct uk_list_head *list, struct uk_list_head *head)
 {
-
        __uk_list_splice(list, head, head->next);
        UK_INIT_LIST_HEAD(list);
 }
@@ -261,7 +254,6 @@ uk_list_splice_init(struct uk_list_head *list, struct 
uk_list_head *head)
 static inline void
 uk_list_splice_tail_init(struct uk_list_head *list, struct uk_list_head *head)
 {
-
        __uk_list_splice(list, head->prev, head);
        UK_INIT_LIST_HEAD(list);
 }
@@ -277,7 +269,7 @@ struct uk_hlist_node {
 
 #define        UK_HLIST_HEAD_INIT { }
 #define        UK_HLIST_HEAD(name) struct uk_hlist_head name = 
UK_HLIST_HEAD_INIT
-#define        UK_INIT_HLIST_HEAD(head) (head)->first = NULL
+#define        UK_INIT_HLIST_HEAD(head) ((head)->first = NULL)
 #define        UK_INIT_HLIST_NODE(node)                                        
\
 do {                                                                   \
        (node)->next = NULL;                                            \
@@ -287,21 +279,18 @@ do {                                                      
                \
 static inline int
 uk_hlist_unhashed(const struct uk_hlist_node *h)
 {
-
        return !h->pprev;
 }
 
 static inline int
 uk_hlist_empty(const struct uk_hlist_head *h)
 {
-
        return !UK_READ_ONCE(h->first);
 }
 
 static inline void
 uk_hlist_del(struct uk_hlist_node *n)
 {
-
        UK_WRITE_ONCE(*(n->pprev), n->next);
        if (n->next != NULL)
                n->next->pprev = n->pprev;
@@ -310,7 +299,6 @@ uk_hlist_del(struct uk_hlist_node *n)
 static inline void
 uk_hlist_del_init(struct uk_hlist_node *n)
 {
-
        if (uk_hlist_unhashed(n))
                return;
        uk_hlist_del(n);
@@ -320,7 +308,6 @@ uk_hlist_del_init(struct uk_hlist_node *n)
 static inline void
 uk_hlist_add_head(struct uk_hlist_node *n, struct uk_hlist_head *h)
 {
-
        n->next = h->first;
        if (h->first != NULL)
                h->first->pprev = &n->next;
@@ -331,7 +318,6 @@ uk_hlist_add_head(struct uk_hlist_node *n, struct 
uk_hlist_head *h)
 static inline void
 uk_hlist_add_before(struct uk_hlist_node *n, struct uk_hlist_node *next)
 {
-
        n->pprev = next->pprev;
        n->next = next;
        next->pprev = &n->next;
@@ -341,7 +327,6 @@ uk_hlist_add_before(struct uk_hlist_node *n, struct 
uk_hlist_node *next)
 static inline void
 uk_hlist_add_behind(struct uk_hlist_node *n, struct uk_hlist_node *prev)
 {
-
        n->next = prev->next;
        UK_WRITE_ONCE(prev->next, n);
        n->pprev = &prev->next;
@@ -351,9 +336,9 @@ uk_hlist_add_behind(struct uk_hlist_node *n, struct 
uk_hlist_node *prev)
 }
 
 static inline void
-uk_hlist_move_list(struct uk_hlist_head *old_entry, struct uk_hlist_head 
*new_entry)
+uk_hlist_move_list(struct uk_hlist_head *old_entry,
+                  struct uk_hlist_head *new_entry)
 {
-
        new_entry->first = old_entry->first;
        if (new_entry->first)
                new_entry->first->pprev = &new_entry->first;
@@ -369,6 +354,7 @@ static inline void __uk_list_cut_position(struct 
uk_list_head *list,
                struct uk_list_head *head, struct uk_list_head *entry)
 {
        struct uk_list_head *new_first = entry->next;
+
        list->next = head->next;
        list->next->prev = list;
        list->prev = entry;
@@ -399,30 +385,37 @@ static inline int uk_list_is_last(const struct 
uk_list_head *list,
 
 #define        uk_hlist_entry(ptr, type, field)        __containerof(ptr, 
type, field)
 
-#define        uk_hlist_for_each(p, head)                                      
        \
+#define        uk_hlist_for_each(p, head)                      \
        for (p = (head)->first; p; p = (p)->next)
 
-#define        uk_hlist_for_each_safe(p, n, head)                              
        \
+#define        uk_hlist_for_each_safe(p, n, head)                              
\
        for (p = (head)->first; p && ({ n = (p)->next; 1; }); p = n)
 
 #define        uk_hlist_entry_safe(ptr, type, member) \
        ((ptr) ? uk_hlist_entry(ptr, type, member) : NULL)
 
-#define        uk_hlist_for_each_entry(pos, head, member)                      
        \
-       for (pos = uk_hlist_entry_safe((head)->first, typeof(*(pos)), member);\
-            pos;                                                       \
-            pos = uk_hlist_entry_safe((pos)->member.next, typeof(*(pos)), 
member))
-
-#define        uk_hlist_for_each_entry_continue(pos, member)                   
\
-       for (pos = uk_hlist_entry_safe((pos)->member.next, typeof(*(pos)), 
member); \
-            (pos);                                                     \
-            pos = uk_hlist_entry_safe((pos)->member.next, typeof(*(pos)), 
member))
-
-#define        uk_hlist_for_each_entry_from(pos, member)                       
        \
-       for (; (pos);                                                           
\
-            pos = uk_hlist_entry_safe((pos)->member.next, typeof(*(pos)), 
member))
-
-#define        uk_hlist_for_each_entry_safe(pos, n, head, member)              
        \
+#define        uk_hlist_for_each_entry(pos, head, member)              \
+       for (pos = uk_hlist_entry_safe((head)->first,           \
+                                      typeof(*(pos)), member); \
+            pos;                                               \
+            pos = uk_hlist_entry_safe((pos)->member.next,      \
+                                      typeof(*(pos)), member))
+
+#define        uk_hlist_for_each_entry_continue(pos, member)           \
+       for (pos = uk_hlist_entry_safe((pos)->member.next,      \
+                                      typeof(*(pos)),          \
+                                      member);                 \
+            (pos);                                             \
+            pos = uk_hlist_entry_safe((pos)->member.next,      \
+                                      typeof(*(pos)), member))
+
+#define        uk_hlist_for_each_entry_from(pos, member)               \
+       for (; (pos);                                           \
+            pos = uk_hlist_entry_safe((pos)->member.next,      \
+                                      typeof(*(pos)),          \
+                                      member))
+
+#define        uk_hlist_for_each_entry_safe(pos, n, head, member)              
\
        for (pos = uk_hlist_entry_safe((head)->first, typeof(*(pos)), member); \
             (pos) && ({ n = (pos)->member.next; 1; });                 \
             pos = uk_hlist_entry_safe(n, typeof(*(pos)), member))
-- 
2.19.2


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.