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

[Xen-changelog] [xen-unstable] libxl_qmp: Use GC instead of CTX as parameter for _initialize.



# HG changeset patch
# User Anthony PERARD <anthony.perard@xxxxxxxxxx>
# Date 1329763528 0
# Node ID a2d15eaa2fe2870898391ec608ed5449c04e6ace
# Parent  ca80eca9cfa39d1b60d1216948dac5711d550b83
libxl_qmp: Use GC instead of CTX as parameter for _initialize.

This make things a bit easier.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r ca80eca9cfa3 -r a2d15eaa2fe2 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Mon Feb 20 18:34:14 2012 +0000
+++ b/tools/libxl/libxl_create.c        Mon Feb 20 18:45:28 2012 +0000
@@ -594,7 +594,7 @@
     if (dm_starting) {
         if (d_config->b_info.device_model_version
             == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
-            libxl__qmp_initializations(ctx, domid);
+            libxl__qmp_initializations(gc, domid);
         }
         ret = libxl__confirm_device_model_startup(gc, &state, dm_starting);
         if (ret < 0) {
diff -r ca80eca9cfa3 -r a2d15eaa2fe2 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Mon Feb 20 18:34:14 2012 +0000
+++ b/tools/libxl/libxl_internal.h      Mon Feb 20 18:45:28 2012 +0000
@@ -995,7 +995,7 @@
 /* Initialise and connect to the QMP socket.
  *   Return an handler or NULL if there is an error
  */
-_hidden libxl__qmp_handler *libxl__qmp_initialize(libxl_ctx *ctx,
+_hidden libxl__qmp_handler *libxl__qmp_initialize(libxl__gc *gc,
                                                   uint32_t domid);
 /* ask to QEMU the serial port information and store it in xenstore. */
 _hidden int libxl__qmp_query_serial(libxl__qmp_handler *qmp);
@@ -1011,7 +1011,7 @@
 _hidden void libxl__qmp_cleanup(libxl__gc *gc, uint32_t domid);
 
 /* this helper calls qmp_initialize, query_serial and qmp_close */
-_hidden int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid);
+_hidden int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid);
 
 /* from libxl_json */
 #include <yajl/yajl_gen.h>
diff -r ca80eca9cfa3 -r a2d15eaa2fe2 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c   Mon Feb 20 18:34:14 2012 +0000
+++ b/tools/libxl/libxl_qmp.c   Mon Feb 20 18:45:28 2012 +0000
@@ -289,17 +289,17 @@
  * Handler functions
  */
 
-static libxl__qmp_handler *qmp_init_handler(libxl_ctx *ctx, uint32_t domid)
+static libxl__qmp_handler *qmp_init_handler(libxl__gc *gc, uint32_t domid)
 {
     libxl__qmp_handler *qmp = NULL;
 
     qmp = calloc(1, sizeof (libxl__qmp_handler));
     if (qmp == NULL) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR,
+        LIBXL__LOG_ERRNO(libxl__gc_owner(gc), LIBXL__LOG_ERROR,
                          "Failed to allocate qmp_handler");
         return NULL;
     }
-    qmp->ctx = ctx;
+    qmp->ctx = libxl__gc_owner(gc);
     qmp->domid = domid;
     qmp->timeout = 5;
 
@@ -624,20 +624,18 @@
  * API
  */
 
-libxl__qmp_handler *libxl__qmp_initialize(libxl_ctx *ctx, uint32_t domid)
+libxl__qmp_handler *libxl__qmp_initialize(libxl__gc *gc, uint32_t domid)
 {
     int ret = 0;
     libxl__qmp_handler *qmp = NULL;
     char *qmp_socket;
-    GC_INIT(ctx);
 
-    qmp = qmp_init_handler(ctx, domid);
+    qmp = qmp_init_handler(gc, domid);
 
     qmp_socket = libxl__sprintf(gc, "%s/qmp-libxl-%d",
                                 libxl_run_dir_path(), domid);
     if ((ret = qmp_open(qmp, qmp_socket, QMP_SOCKET_CONNECT_TIMEOUT)) < 0) {
-        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Connection error");
-        GC_FREE;
+        LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, "Connection error");
         qmp_free_handler(qmp);
         return NULL;
     }
@@ -651,9 +649,8 @@
         }
     }
 
-    GC_FREE;
     if (!qmp->connected) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to connect to QMP");
+        LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, "Failed to connect to QMP");
         libxl__qmp_close(qmp);
         return NULL;
     }
@@ -747,7 +744,7 @@
     char *hostaddr = NULL;
     int rc = 0;
 
-    qmp = libxl__qmp_initialize(libxl__gc_owner(gc), domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return -1;
 
@@ -792,7 +789,7 @@
     libxl_key_value_list args = NULL;
     int rc = 0;
 
-    qmp = libxl__qmp_initialize(libxl__gc_owner(gc), domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return ERROR_FAIL;
 
@@ -853,7 +850,7 @@
     libxl_key_value_list args = NULL;
     int rc = 0;
 
-    qmp = libxl__qmp_initialize(libxl__gc_owner(gc), domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return ERROR_FAIL;
 
@@ -883,12 +880,12 @@
     return rc;
 }
 
-int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid)
+int libxl__qmp_initializations(libxl__gc *gc, uint32_t domid)
 {
     libxl__qmp_handler *qmp = NULL;
     int ret = 0;
 
-    qmp = libxl__qmp_initialize(ctx, domid);
+    qmp = libxl__qmp_initialize(gc, domid);
     if (!qmp)
         return -1;
     ret = libxl__qmp_query_serial(qmp);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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