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

[Xen-devel] [PATCH v2 08/11] tools/libvchan: init_xs_srv: Turn xs retry from goto into for (; ; )



No functional change.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
---
 tools/libvchan/init.c | 50 ++++++++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/tools/libvchan/init.c b/tools/libvchan/init.c
index f099765a38..d987acd338 100644
--- a/tools/libvchan/init.c
+++ b/tools/libvchan/init.c
@@ -266,31 +266,33 @@ static int init_xs_srv(struct libxenvchan *ctrl, int 
domain, const char* xs_base
        perms[1].id = domain;
        perms[1].perms = XS_PERM_READ;
 
-retry_transaction:
-       xs_trans = xs_transaction_start(xs);
-       if (!xs_trans)
-               goto fail;
-
-       snprintf(ref, sizeof ref, "%d", ring_ref);
-       snprintf(buf, sizeof buf, "%s/ring-ref", xs_base);
-       if (!xs_write(xs, xs_trans, buf, ref, strlen(ref)))
-               goto fail;
-       if (!xs_set_permissions(xs, xs_trans, buf, perms, 2))
-               goto fail;
-
-       snprintf(ref, sizeof ref, "%d", ctrl->event_port);
-       snprintf(buf, sizeof buf, "%s/event-channel", xs_base);
-       if (!xs_write(xs, xs_trans, buf, ref, strlen(ref)))
-               goto fail;
-       if (!xs_set_permissions(xs, xs_trans, buf, perms, 2))
-               goto fail;
-
-       if (!xs_transaction_end(xs, xs_trans, 0)) {
-               if (errno == EAGAIN)
-                       goto retry_transaction;
-       } else {
-               ret = 0;
+       for (;;) {
+               xs_trans = xs_transaction_start(xs);
+               if (!xs_trans)
+                       goto fail;
+
+               snprintf(ref, sizeof ref, "%d", ring_ref);
+               snprintf(buf, sizeof buf, "%s/ring-ref", xs_base);
+               if (!xs_write(xs, xs_trans, buf, ref, strlen(ref)))
+                       goto fail;
+               if (!xs_set_permissions(xs, xs_trans, buf, perms, 2))
+                       goto fail;
+
+               snprintf(ref, sizeof ref, "%d", ctrl->event_port);
+               snprintf(buf, sizeof buf, "%s/event-channel", xs_base);
+               if (!xs_write(xs, xs_trans, buf, ref, strlen(ref)))
+                       goto fail;
+               if (!xs_set_permissions(xs, xs_trans, buf, perms, 2))
+                       goto fail;
+
+               if (xs_transaction_end(xs, xs_trans, 0))
+                       break;
+               else if (errno != EAGAIN)
+                       goto fail;
+               /* EAGAIN, retry */
        }
+       ret = 0;
+
  fail:
        free(domid_str);
        xs_close(xs);
-- 
2.11.0


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

 


Rackspace

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