WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] tools: libxl: remove libxl_domain_build_s

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] tools: libxl: remove libxl_domain_build_state from the IDL
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 29 Apr 2011 01:55:25 +0100
Delivery-date: Thu, 28 Apr 2011 18:02:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1303315987 -3600
# Node ID a086a6d6c372bd3234da24b3f6c064452a6865d1
# Parent  a327e85cfe8104d77fc5b962e8f86f4483b7a66c
tools: libxl: remove libxl_domain_build_state from the IDL

This datastructure is internal to the library.

Remove the reference from libxl_device_console. This could never have
been used from outside libxl and is only used internally to add the
primary PV console to a guest. Make an internal variant of
libxl_device_console_add which takes the build state as a parameter
instead.

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


diff -r a327e85cfe81 -r a086a6d6c372 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Apr 20 17:13:07 2011 +0100
+++ b/tools/libxl/libxl.c       Wed Apr 20 17:13:07 2011 +0100
@@ -1389,14 +1389,20 @@
 }
 
 
/******************************************************************************/
-int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid, 
libxl_device_console *console)
+int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
+                              libxl_device_console *console,
+                              libxl__domain_build_state *state)
 {
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
     flexarray_t *front;
     flexarray_t *back;
     libxl__device device;
     int rc;
 
+    if (console->devid && state) {
+        rc = ERROR_INVAL;
+        goto out;
+    }
+
     front = flexarray_make(16, 1);
     if (!front) {
         rc = ERROR_NOMEM;
@@ -1416,20 +1422,20 @@
     device.kind = DEVICE_CONSOLE;
 
     flexarray_append(back, "frontend-id");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", domid));
+    flexarray_append(back, libxl__sprintf(gc, "%d", domid));
     flexarray_append(back, "online");
     flexarray_append(back, "1");
     flexarray_append(back, "state");
-    flexarray_append(back, libxl__sprintf(&gc, "%d", 1));
+    flexarray_append(back, libxl__sprintf(gc, "%d", 1));
     flexarray_append(back, "domain");
-    flexarray_append(back, libxl__domid_to_name(&gc, domid));
+    flexarray_append(back, libxl__domid_to_name(gc, domid));
     flexarray_append(back, "protocol");
     flexarray_append(back, LIBXL_XENCONSOLE_PROTOCOL);
 
     flexarray_append(front, "backend-id");
-    flexarray_append(front, libxl__sprintf(&gc, "%d", console->backend_domid));
+    flexarray_append(front, libxl__sprintf(gc, "%d", console->backend_domid));
     flexarray_append(front, "limit");
-    flexarray_append(front, libxl__sprintf(&gc, "%d", LIBXL_XENCONSOLE_LIMIT));
+    flexarray_append(front, libxl__sprintf(gc, "%d", LIBXL_XENCONSOLE_LIMIT));
     flexarray_append(front, "type");
     if (console->consback == LIBXL_CONSOLE_BACKEND_XENCONSOLED)
         flexarray_append(front, "xenconsoled");
@@ -1438,30 +1444,37 @@
     flexarray_append(front, "output");
     flexarray_append(front, console->output);
 
-    if (device.devid == 0) {
-        if (console->build_state == NULL) {
-            rc = ERROR_INVAL;
-            goto out_free;
-        }
+    if (state) {
         flexarray_append(front, "port");
-        flexarray_append(front, libxl__sprintf(&gc, "%"PRIu32, 
console->build_state->console_port));
+        flexarray_append(front, libxl__sprintf(gc, "%"PRIu32, 
state->console_port));
         flexarray_append(front, "ring-ref");
-        flexarray_append(front, libxl__sprintf(&gc, "%lu", 
console->build_state->console_mfn));
+        flexarray_append(front, libxl__sprintf(gc, "%lu", state->console_mfn));
     } else {
         flexarray_append(front, "state");
-        flexarray_append(front, libxl__sprintf(&gc, "%d", 1));
+        flexarray_append(front, libxl__sprintf(gc, "%d", 1));
         flexarray_append(front, "protocol");
         flexarray_append(front, LIBXL_XENCONSOLE_PROTOCOL);
     }
 
-    libxl__device_generic_add(&gc, &device,
-                             libxl__xs_kvs_of_flexarray(&gc, back, 
back->count),
-                             libxl__xs_kvs_of_flexarray(&gc, front, 
front->count));
+    libxl__device_generic_add(gc, &device,
+                             libxl__xs_kvs_of_flexarray(gc, back, back->count),
+                             libxl__xs_kvs_of_flexarray(gc, front, 
front->count));
     rc = 0;
 out_free:
     flexarray_free(back);
     flexarray_free(front);
 out:
+    return rc;
+}
+
+int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid,
+                              libxl_device_console *console)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    int rc = ERROR_INVAL;
+
+    rc = libxl__device_console_add(&gc, domid, console, NULL);
+
     libxl__free_all(&gc);
     return rc;
 }
diff -r a327e85cfe81 -r a086a6d6c372 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl     Wed Apr 20 17:13:07 2011 +0100
+++ b/tools/libxl/libxl.idl     Wed Apr 20 17:13:07 2011 +0100
@@ -190,13 +190,6 @@
 then the user is responsible for calling
 libxl_file_reference_unmap.""")
 
-libxl_domain_build_state = Struct("domain_build_state",[
-    ("store_port",   uint32),
-    ("store_mfn",    unsigned_long),
-    ("console_port", uint32),
-    ("console_mfn",  unsigned_long),
-    ], destructor_fn=None)
-
 libxl_device_model_info = Struct("device_model_info",[
     ("domid",            libxl_domid),
     ("uuid",             libxl_uuid,  False, "this is use only with stubdom, 
and must be different from the domain uuid"),
@@ -259,7 +252,6 @@
     ("backend_domid", libxl_domid),
     ("devid", integer),
     ("consback", libxl_console_backend),
-    ("build_state", Reference(libxl_domain_build_state), True),
     ("output", string),
     ])
 
diff -r a327e85cfe81 -r a086a6d6c372 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Wed Apr 20 17:13:07 2011 +0100
+++ b/tools/libxl/libxl_create.c        Wed Apr 20 17:13:07 2011 +0100
@@ -133,7 +133,7 @@
     dm_info->xen_platform_pci = 1;
 }
 
-static int init_console_info(libxl_device_console *console, int dev_num, 
libxl_domain_build_state *state)
+static int init_console_info(libxl_device_console *console, int dev_num)
 {
     memset(console, 0x00, sizeof(libxl_device_console));
     console->devid = dev_num;
@@ -141,12 +141,11 @@
     console->output = strdup("pty");
     if ( NULL == console->output )
         return ERROR_NOMEM;
-    if (state)
-        console->build_state = state;
     return 0;
 }
 
-int libxl__domain_build(libxl__gc *gc, libxl_domain_build_info *info, uint32_t 
domid, libxl_domain_build_state *state)
+int libxl__domain_build(libxl__gc *gc, libxl_domain_build_info *info,
+                        uint32_t domid, libxl__domain_build_state *state)
 {
     char **vments = NULL, **localents = NULL;
     struct timeval start_time;
@@ -198,7 +197,8 @@
 }
 
 static int domain_restore(libxl__gc *gc, libxl_domain_build_info *info,
-                          uint32_t domid, int fd, libxl_domain_build_state 
*state,
+                          uint32_t domid, int fd,
+                          libxl__domain_build_state *state,
                           libxl_device_model_info *dm_info)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -403,7 +403,7 @@
     libxl_ctx *ctx = libxl__gc_owner(gc);
     libxl__device_model_starting *dm_starting = 0;
     libxl_device_model_info *dm_info = &d_config->dm_info;
-    libxl_domain_build_state state;
+    libxl__domain_build_state state;
     uint32_t domid;
     int i, ret;
 
@@ -464,10 +464,10 @@
     if (d_config->c_info.hvm) {
         libxl_device_console console;
 
-        ret = init_console_info(&console, 0, &state);
+        ret = init_console_info(&console, 0);
         if ( ret )
             goto error_out;
-        libxl_device_console_add(ctx, domid, &console);
+        libxl__device_console_add(gc, domid, &console, &state);
         libxl_device_console_destroy(&console);
 
         dm_info->domid = domid;
@@ -489,7 +489,7 @@
             libxl_device_vkb_add(ctx, domid, &d_config->vkbs[i]);
         }
 
-        ret = init_console_info(&console, 0, &state);
+        ret = init_console_info(&console, 0);
         if ( ret )
             goto error_out;
 
@@ -500,7 +500,7 @@
         if (need_qemu)
              console.consback = LIBXL_CONSOLE_BACKEND_IOEMU;
 
-        libxl_device_console_add(ctx, domid, &console);
+        libxl__device_console_add(gc, domid, &console, &state);
         libxl_device_console_destroy(&console);
 
         if (need_qemu)
diff -r a327e85cfe81 -r a086a6d6c372 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Wed Apr 20 17:13:07 2011 +0100
+++ b/tools/libxl/libxl_dm.c    Wed Apr 20 17:13:07 2011 +0100
@@ -569,7 +569,7 @@
     libxl_device_console *console;
     libxl_domain_create_info c_info;
     libxl_domain_build_info b_info;
-    libxl_domain_build_state state;
+    libxl__domain_build_state state;
     uint32_t domid;
     char **args;
     struct xs_permissions perm[2];
@@ -684,7 +684,6 @@
                 name = libxl__sprintf(gc, "qemu-dm-%s", 
libxl_domid_to_name(ctx, info->domid));
                 libxl_create_logfile(ctx, name, &filename);
                 console[i].output = libxl__sprintf(gc, "file:%s", filename);
-                console[i].build_state = &state;
                 free(filename);
                 break;
             case STUBDOM_CONSOLE_SAVE:
@@ -698,7 +697,8 @@
                 console[i].output = "pty";
                 break;
         }
-        ret = libxl_device_console_add(ctx, domid, &console[i]);
+        ret = libxl__device_console_add(gc, domid, &console[i],
+                                    i == STUBDOM_CONSOLE_LOGGING ? &state : 
NULL);
         if (ret)
             goto out_free;
     }
diff -r a327e85cfe81 -r a086a6d6c372 tools/libxl/libxl_dom.c
--- a/tools/libxl/libxl_dom.c   Wed Apr 20 17:13:07 2011 +0100
+++ b/tools/libxl/libxl_dom.c   Wed Apr 20 17:13:07 2011 +0100
@@ -67,7 +67,7 @@
 }
 
 int libxl__build_pre(libxl__gc *gc, uint32_t domid,
-              libxl_domain_build_info *info, libxl_domain_build_state *state)
+              libxl_domain_build_info *info, libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
@@ -91,8 +91,9 @@
 }
 
 int libxl__build_post(libxl__gc *gc, uint32_t domid,
-               libxl_domain_build_info *info, libxl_domain_build_state *state,
-               char **vms_ents, char **local_ents)
+                      libxl_domain_build_info *info,
+                      libxl__domain_build_state *state,
+                      char **vms_ents, char **local_ents)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char *dom_path, *vm_path;
@@ -145,7 +146,7 @@
 }
 
 int libxl__build_pv(libxl__gc *gc, uint32_t domid,
-             libxl_domain_build_info *info, libxl_domain_build_state *state)
+             libxl_domain_build_info *info, libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     struct xc_dom_image *dom;
@@ -277,7 +278,7 @@
 }
 
 int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
-              libxl_domain_build_info *info, libxl_domain_build_state *state)
+              libxl_domain_build_info *info, libxl__domain_build_state *state)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int ret, rc = ERROR_INVAL;
@@ -305,8 +306,9 @@
 }
 
 int libxl__domain_restore_common(libxl__gc *gc, uint32_t domid,
-                   libxl_domain_build_info *info, libxl_domain_build_state 
*state,
-                   int fd)
+                                 libxl_domain_build_info *info,
+                                 libxl__domain_build_state *state,
+                                 int fd)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     /* read signature */
diff -r a327e85cfe81 -r a086a6d6c372 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Wed Apr 20 17:13:07 2011 +0100
+++ b/tools/libxl/libxl_internal.h      Wed Apr 20 17:13:07 2011 +0100
@@ -169,23 +169,33 @@
 _hidden int libxl__domain_is_hvm(libxl__gc *gc, uint32_t domid);
 _hidden int libxl__domain_shutdown_reason(libxl__gc *gc, uint32_t domid);
 
+typedef struct {
+    uint32_t store_port;
+    unsigned long store_mfn;
+
+    uint32_t console_port;
+    unsigned long console_mfn;
+} libxl__domain_build_state;
+
 _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid,
-              libxl_domain_build_info *info, libxl_domain_build_state *state);
+              libxl_domain_build_info *info, libxl__domain_build_state *state);
 _hidden int libxl__build_post(libxl__gc *gc, uint32_t domid,
-               libxl_domain_build_info *info, libxl_domain_build_state *state,
+               libxl_domain_build_info *info, libxl__domain_build_state *state,
                char **vms_ents, char **local_ents);
 
 _hidden int libxl__build_pv(libxl__gc *gc, uint32_t domid,
-             libxl_domain_build_info *info, libxl_domain_build_state *state);
+             libxl_domain_build_info *info, libxl__domain_build_state *state);
 _hidden int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
-              libxl_domain_build_info *info, libxl_domain_build_state *state);
+              libxl_domain_build_info *info, libxl__domain_build_state *state);
 
 _hidden int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
                                  const char *old_name, const char *new_name,
                                  xs_transaction_t trans);
 
 _hidden int libxl__domain_restore_common(libxl__gc *gc, uint32_t domid,
-                   libxl_domain_build_info *info, libxl_domain_build_state 
*state, int fd);
+                                         libxl_domain_build_info *info,
+                                         libxl__domain_build_state *state,
+                                         int fd);
 _hidden int libxl__domain_suspend_common(libxl__gc *gc, uint32_t domid, int 
fd, int hvm, int live, int debug);
 _hidden int libxl__domain_save_device_model(libxl__gc *gc, uint32_t domid, int 
fd);
 _hidden void libxl__userdata_destroyall(libxl__gc *gc, uint32_t domid);
@@ -198,6 +208,10 @@
 _hidden int libxl__device_disk_dev_number(char *virtpath,
                                           int *pdisk, int *ppartition);
 
+_hidden int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
+                                      libxl_device_console *console,
+                                      libxl__domain_build_state *state);
+
 _hidden int libxl__device_generic_add(libxl__gc *gc, libxl__device *device,
                              char **bents, char **fents);
 _hidden char *libxl__device_backend_path(libxl__gc *gc, libxl__device *device);
@@ -230,7 +244,9 @@
 
 /* from xl_create */
 _hidden int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info, 
uint32_t *domid);
-_hidden int libxl__domain_build(libxl__gc *gc, libxl_domain_build_info *info, 
uint32_t domid, /* out */ libxl_domain_build_state *state);
+_hidden int libxl__domain_build(libxl__gc *gc, libxl_domain_build_info *info,
+                                uint32_t domid,
+                                libxl__domain_build_state *state);
 
 /* for device model creation */
 _hidden const char *libxl__domain_device_model(libxl__gc *gc,
diff -r a327e85cfe81 -r a086a6d6c372 tools/ocaml/libs/xl/xl.ml
--- a/tools/ocaml/libs/xl/xl.ml Wed Apr 20 17:13:07 2011 +0100
+++ b/tools/ocaml/libs/xl/xl.ml Wed Apr 20 17:13:07 2011 +0100
@@ -70,16 +70,6 @@
        }
 end
 
-module Domain_build_state = struct
-       type t =
-       {
-               store_port : int;
-               store_mfn : int64;
-               console_port : int;
-               console_mfn : int64;
-       }
-end
-
 type domid = int
 
 type disk_phystype =
@@ -139,7 +129,7 @@
                consoletype : console_type;
        }
 
-       external add : t -> Domain_build_state.t -> domid -> unit = 
"stub_xl_device_console_add"
+       external add : t -> domid -> unit = "stub_xl_device_console_add"
 end
 
 module Device_vkb = struct
diff -r a327e85cfe81 -r a086a6d6c372 tools/ocaml/libs/xl/xl.mli
--- a/tools/ocaml/libs/xl/xl.mli        Wed Apr 20 17:13:07 2011 +0100
+++ b/tools/ocaml/libs/xl/xl.mli        Wed Apr 20 17:13:07 2011 +0100
@@ -70,16 +70,6 @@
        }
 end
 
-module Domain_build_state : sig
-       type t =
-       {
-               store_port : int;
-               store_mfn : int64;
-               console_port : int;
-               console_mfn : int64;
-       }
-end
-
 type domid = int
 
 type disk_phystype =
@@ -139,7 +129,7 @@
                consoletype : console_type;
        }
 
-       external add : t -> Domain_build_state.t -> domid -> unit = 
"stub_xl_device_console_add"
+       external add : t -> domid -> unit = "stub_xl_device_console_add"
 end
 
 module Device_vkb : sig
diff -r a327e85cfe81 -r a086a6d6c372 tools/ocaml/libs/xl/xl_stubs.c
--- a/tools/ocaml/libs/xl/xl_stubs.c    Wed Apr 20 17:13:07 2011 +0100
+++ b/tools/ocaml/libs/xl/xl_stubs.c    Wed Apr 20 17:13:07 2011 +0100
@@ -294,18 +294,6 @@
        CAMLreturn(0);
 }
 
-static int domain_build_state_val(caml_gc *gc, libxl_domain_build_state 
*c_val, value v)
-{
-       CAMLparam1(v);
-
-       c_val->store_port = Int_val(Field(v, 0));
-       c_val->store_mfn = Int64_val(Field(v, 1));
-       c_val->console_port = Int_val(Field(v, 2));
-       c_val->console_mfn = Int64_val(Field(v, 3));
-       
-       CAMLreturn(0);
-}
-
 static value Val_sched_credit(libxl_sched_credit *c_val)
 {
        CAMLparam0();
@@ -436,17 +424,14 @@
        CAMLreturn(Val_unit);
 }
 
-value stub_xl_device_console_add(value info, value state, value domid)
+value stub_xl_device_console_add(value info, value domid)
 {
-       CAMLparam3(info, state, domid);
+       CAMLparam2(info, domid);
        libxl_device_console c_info;
-       libxl_domain_build_state c_state;
        int ret;
        INIT_STRUCT();
 
        device_console_val(&gc, &c_info, info);
-       domain_build_state_val(&gc, &c_state, state);
-       c_info.build_state = &c_state;
 
        INIT_CTX();
        ret = libxl_device_console_add(ctx, Int_val(domid), &c_info);
diff -r a327e85cfe81 -r a086a6d6c372 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c Wed Apr 20 17:13:07 2011 +0100
+++ b/tools/python/xen/lowlevel/xl/xl.c Wed Apr 20 17:13:07 2011 +0100
@@ -232,12 +232,6 @@
     return -1;
 }
 
-int attrib__libxl_domain_build_state_ptr_set(PyObject *v, 
libxl_domain_build_state **pptr)
-{
-    PyErr_SetString(PyExc_NotImplementedError, "Setting 
domain_build_state_ptr");
-    return -1;
-}
-
 int attrib__libxl_file_reference_set(PyObject *v, libxl_file_reference *pptr)
 {
     return genwrap__string_set(v, &pptr->path);
@@ -329,12 +323,6 @@
     return list;
 }
 
-PyObject *attrib__libxl_domain_build_state_ptr_get(libxl_domain_build_state 
**pptr)
-{
-    PyErr_SetString(PyExc_NotImplementedError, "Getting 
domain_build_state_ptr");
-    return NULL;
-}
-
 PyObject *attrib__libxl_file_reference_get(libxl_file_reference *pptr)
 {
     return genwrap__string_get(&pptr->path);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] tools: libxl: remove libxl_domain_build_state from the IDL, Xen patchbot-unstable <=