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

Re: [Xen-devel] [PATCH v3 COLOPre 16/26] tools/libx{l, c}: add back channel to libxc





On 06/30/2015 06:17 PM, Ian Campbell wrote:
On Thu, 2015-06-25 at 14:25 +0800, Yang Hongyang wrote:

diff --git a/tools/libxl/libxl_save_callout.c b/tools/libxl/libxl_save_callout.c
index 12cc57e..25817d6 100644
--- a/tools/libxl/libxl_save_callout.c
+++ b/tools/libxl/libxl_save_callout.c
@@ -27,7 +27,7 @@
   */
  static void run_helper(libxl__egc *egc, libxl__save_helper_state *shs,
                         const char *mode_arg,
-                       int stream_fd,
+                       int stream_fd, int back_fd,
                         const int *preserve_fds, int num_preserve_fds,
                         const unsigned long *argnums, int num_argnums);

@@ -70,8 +70,8 @@ void libxl__xc_domain_restore(libxl__egc *egc, 
libxl__domain_create_state *dcs,
      dcs->shs.need_results = 1;
      dcs->shs.toolstack_data_file = 0;

-    run_helper(egc, &dcs->shs, "--restore-domain", restore_fd, 0,0,
-               argnums, ARRAY_SIZE(argnums));
+    run_helper(egc, &dcs->shs, "--restore-domain", restore_fd, dcs->send_fd,

restore_fd comes from convenience aliases, it would be in keeping to do
the same for send_fd too (and elsewhere)

Ok


@@ -174,6 +175,16 @@ static void run_helper(libxl__egc *egc, 
libxl__save_helper_state *shs,
          libxl_fd_set_cloexec(CTX, stream_fd, 0);
          *stream_fd_arg = GCSPRINTF("%d", stream_fd);

+        if (back_fd <= 2) {
+            back_fd = dup(back_fd);
+            if (back_fd < 0) {
+                LOGE(ERROR,"dup migration back channel");
+                exit(-1);
+            }
+        }
+        libxl_fd_set_cloexec(CTX, back_fd, 0);
+        *back_fd_arg = GCSPRINTF("%d", back_fd);

This is an exact duplicate of the stream_fd setup, I think you should
make it a helper which takes a gc, an fd and a const char *what
(=="stream" or "backchannel" for logging) and returns a string
representing a safe (i.e. possibly dupd) version of the fd.

ok, will do in the next version.


Ian.

.


--
Thanks,
Yang.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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