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

[xen master] tools/xenstore: simplify loop handling connection I/O



commit e8e6e42279a5723239c5c40ba4c7f579a979465d
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Wed Jun 15 10:22:38 2022 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Jun 15 10:22:38 2022 +0200

    tools/xenstore: simplify loop handling connection I/O
    
    The loop handling input and output of connections of xenstored is
    open coding list_for_each_entry_safe() in an incredibly complicated
    way.
    
    Use list_for_each_entry_safe() instead, making it much more clear how
    the code is working.
    
    Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 tools/xenstore/xenstored_core.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 6e4022e5da..fa733e714e 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -2368,16 +2368,8 @@ int main(int argc, char *argv[])
                        }
                }
 
-               next = list_entry(connections.next, typeof(*conn), list);
-               if (&next->list != &connections)
-                       talloc_increase_ref_count(next);
-               while (&next->list != &connections) {
-                       conn = next;
-
-                       next = list_entry(conn->list.next,
-                                         typeof(*conn), list);
-                       if (&next->list != &connections)
-                               talloc_increase_ref_count(next);
+               list_for_each_entry_safe(conn, next, &connections, list) {
+                       talloc_increase_ref_count(conn);
 
                        if (conn_can_read(conn))
                                handle_input(conn);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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