Ian Campbell
2012-Nov-20 17:23 UTC
[PATCH 01 of 15] libxl: move definition of libxl_domain_config into the IDL
# HG changeset patch
# User Ian Campbell <ijc@hellion.org.uk>
# Date 1353432136 0
# Node ID 601dc257a740d3a6047667731007283a4dcb9600
# Parent c893596e2d4c7ddd62a3704ea5460be4e5be38df
libxl: move definition of libxl_domain_config into the IDL
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
Posted during 4.2 freeze and deferred until 4.3...
diff -r c893596e2d4c -r 601dc257a740 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h Tue Nov 20 17:22:10 2012 +0000
+++ b/tools/libxl/libxl.h Tue Nov 20 17:22:16 2012 +0000
@@ -474,26 +474,6 @@ typedef struct {
#define LIBXL_VERSION 0
-typedef struct {
- libxl_domain_create_info c_info;
- libxl_domain_build_info b_info;
-
- int num_disks, num_nics, num_pcidevs, num_vfbs, num_vkbs, num_vtpms;
-
- libxl_device_disk *disks;
- libxl_device_nic *nics;
- libxl_device_pci *pcidevs;
- libxl_device_vfb *vfbs;
- libxl_device_vkb *vkbs;
- libxl_device_vtpm *vtpms;
-
- libxl_action_on_shutdown on_poweroff;
- libxl_action_on_shutdown on_reboot;
- libxl_action_on_shutdown on_watchdog;
- libxl_action_on_shutdown on_crash;
-} libxl_domain_config;
-char *libxl_domain_config_to_json(libxl_ctx *ctx, libxl_domain_config *p);
-
/* context functions */
int libxl_ctx_alloc(libxl_ctx **pctx, int version,
unsigned flags /* none currently defined */,
diff -r c893596e2d4c -r 601dc257a740 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c Tue Nov 20 17:22:10 2012 +0000
+++ b/tools/libxl/libxl_create.c Tue Nov 20 17:22:16 2012 +0000
@@ -24,43 +24,6 @@
#include <xenguest.h>
#include <xen/hvm/hvm_info_table.h>
-void libxl_domain_config_init(libxl_domain_config *d_config)
-{
- memset(d_config, 0, sizeof(*d_config));
- libxl_domain_create_info_init(&d_config->c_info);
- libxl_domain_build_info_init(&d_config->b_info);
-}
-
-void libxl_domain_config_dispose(libxl_domain_config *d_config)
-{
- int i;
-
- for (i=0; i<d_config->num_disks; i++)
- libxl_device_disk_dispose(&d_config->disks[i]);
- free(d_config->disks);
-
- for (i=0; i<d_config->num_nics; i++)
- libxl_device_nic_dispose(&d_config->nics[i]);
- free(d_config->nics);
-
- for (i=0; i<d_config->num_pcidevs; i++)
- libxl_device_pci_dispose(&d_config->pcidevs[i]);
- free(d_config->pcidevs);
-
- for (i=0; i<d_config->num_vfbs; i++)
- libxl_device_vfb_dispose(&d_config->vfbs[i]);
- free(d_config->vfbs);
-
- for (i=0; i<d_config->num_vkbs; i++)
- libxl_device_vkb_dispose(&d_config->vkbs[i]);
- free(d_config->vkbs);
-
- libxl_device_vtpm_list_free(d_config->vtpms, d_config->num_vtpms);
-
- libxl_domain_create_info_dispose(&d_config->c_info);
- libxl_domain_build_info_dispose(&d_config->b_info);
-}
-
int libxl__domain_create_info_setdefault(libxl__gc *gc,
libxl_domain_create_info *c_info)
{
diff -r c893596e2d4c -r 601dc257a740 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c Tue Nov 20 17:22:10 2012 +0000
+++ b/tools/libxl/libxl_json.c Tue Nov 20 17:22:16 2012 +0000
@@ -786,158 +786,6 @@ out:
return ret;
}
-yajl_gen_status libxl_domain_config_gen_json(yajl_gen hand,
- libxl_domain_config *p)
-{
- yajl_gen_status s;
- int i;
-
- s = yajl_gen_map_open(hand);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_string(hand, (const unsigned char *)"c_info",
- sizeof("c_info")-1);
- if (s != yajl_gen_status_ok)
- goto out;
- s = libxl_domain_create_info_gen_json(hand, &p->c_info);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_string(hand, (const unsigned char *)"b_info",
- sizeof("b_info")-1);
- if (s != yajl_gen_status_ok)
- goto out;
- s = libxl_domain_build_info_gen_json(hand, &p->b_info);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_string(hand, (const unsigned char *)"disks",
- sizeof("disks")-1);
- if (s != yajl_gen_status_ok)
- goto out;
- s = yajl_gen_array_open(hand);
- if (s != yajl_gen_status_ok)
- goto out;
- for (i = 0; i < p->num_disks; i++) {
- s = libxl_device_disk_gen_json(hand, &p->disks[i]);
- if (s != yajl_gen_status_ok)
- goto out;
- }
- s = yajl_gen_array_close(hand);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_string(hand, (const unsigned char *)"nics",
- sizeof("nics")-1);
- if (s != yajl_gen_status_ok)
- goto out;
- s = yajl_gen_array_open(hand);
- if (s != yajl_gen_status_ok)
- goto out;
- for (i = 0; i < p->num_nics; i++) {
- s = libxl_device_nic_gen_json(hand, &p->nics[i]);
- if (s != yajl_gen_status_ok)
- goto out;
- }
- s = yajl_gen_array_close(hand);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_string(hand, (const unsigned char *)"pcidevs",
- sizeof("pcidevs")-1);
- if (s != yajl_gen_status_ok)
- goto out;
- s = yajl_gen_array_open(hand);
- if (s != yajl_gen_status_ok)
- goto out;
- for (i = 0; i < p->num_pcidevs; i++) {
- s = libxl_device_pci_gen_json(hand, &p->pcidevs[i]);
- if (s != yajl_gen_status_ok)
- goto out;
- }
- s = yajl_gen_array_close(hand);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_string(hand, (const unsigned char *)"vfbs",
- sizeof("vfbs")-1);
- if (s != yajl_gen_status_ok)
- goto out;
- s = yajl_gen_array_open(hand);
- if (s != yajl_gen_status_ok)
- goto out;
- for (i = 0; i < p->num_vfbs; i++) {
- s = libxl_device_vfb_gen_json(hand, &p->vfbs[i]);
- if (s != yajl_gen_status_ok)
- goto out;
- }
- s = yajl_gen_array_close(hand);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_string(hand, (const unsigned char *)"vkbs",
- sizeof("vkbs")-1);
- if (s != yajl_gen_status_ok)
- goto out;
- s = yajl_gen_array_open(hand);
- if (s != yajl_gen_status_ok)
- goto out;
- for (i = 0; i < p->num_vkbs; i++) {
- s = libxl_device_vkb_gen_json(hand, &p->vkbs[i]);
- if (s != yajl_gen_status_ok)
- goto out;
- }
- s = yajl_gen_array_close(hand);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_string(hand, (const unsigned char *)"on_poweroff",
- sizeof("on_poweroff")-1);
- if (s != yajl_gen_status_ok)
- goto out;
- s = libxl_action_on_shutdown_gen_json(hand, &p->on_poweroff);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_string(hand, (const unsigned char *)"on_reboot",
- sizeof("on_reboot")-1);
- if (s != yajl_gen_status_ok)
- goto out;
- s = libxl_action_on_shutdown_gen_json(hand, &p->on_reboot);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_string(hand, (const unsigned char *)"on_watchdog",
- sizeof("on_watchdog")-1);
- if (s != yajl_gen_status_ok)
- goto out;
- s = libxl_action_on_shutdown_gen_json(hand, &p->on_watchdog);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_string(hand, (const unsigned char *)"on_crash",
- sizeof("on_crash")-1);
- if (s != yajl_gen_status_ok)
- goto out;
- s = libxl_action_on_shutdown_gen_json(hand, &p->on_crash);
- if (s != yajl_gen_status_ok)
- goto out;
-
- s = yajl_gen_map_close(hand);
- if (s != yajl_gen_status_ok)
- goto out;
- out:
- return s;
-}
-
-char *libxl_domain_config_to_json(libxl_ctx *ctx, libxl_domain_config *p)
-{
- return libxl__object_to_json(ctx, "libxl_domain_config",
-
(libxl__gen_json_callback)&libxl_domain_config_gen_json,
- (void *)p);
-}
-
/*
* Local variables:
* mode: C
diff -r c893596e2d4c -r 601dc257a740 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl Tue Nov 20 17:22:10 2012 +0000
+++ b/tools/libxl/libxl_types.idl Tue Nov 20 17:22:16 2012 +0000
@@ -401,6 +401,23 @@ libxl_device_vtpm = Struct("device_vtpm"
("uuid", libxl_uuid),
])
+libxl_domain_config = Struct("domain_config", [
+ ("c_info", libxl_domain_create_info),
+ ("b_info", libxl_domain_build_info),
+
+ ("disks", Array(libxl_device_disk, "num_disks")),
+ ("nics", Array(libxl_device_nic, "num_nics")),
+ ("pcidevs", Array(libxl_device_pci, "num_pcidevs")),
+ ("vfbs", Array(libxl_device_vfb, "num_vfbs")),
+ ("vkbs", Array(libxl_device_vkb, "num_vkbs")),
+ ("vtpms", Array(libxl_device_vtpm, "num_vtpms")),
+
+ ("on_poweroff", libxl_action_on_shutdown),
+ ("on_reboot", libxl_action_on_shutdown),
+ ("on_watchdog", libxl_action_on_shutdown),
+ ("on_crash", libxl_action_on_shutdown),
+ ])
+
libxl_diskinfo = Struct("diskinfo", [
("backend", string),
("backend_id", uint32),
diff -r c893596e2d4c -r 601dc257a740 tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py Tue Nov 20 17:22:10 2012 +0000
+++ b/tools/ocaml/libs/xl/genwrap.py Tue Nov 20 17:22:16 2012 +0000
@@ -283,6 +283,7 @@ if __name__ == ''__main__'':
"cpupoolinfo",
"domain_create_info",
"domain_build_info",
+ "domain_config",
"vcpuinfo",
"event",
]
Ian Campbell
2012-Dec-19 14:34 UTC
Re: [PATCH 01 of 15] libxl: move definition of libxl_domain_config into the IDL
On Tue, 2012-11-20 at 17:23 +0000, Ian Campbell wrote:> # HG changeset patch > # User Ian Campbell <ijc@hellion.org.uk> > # Date 1353432136 0 > # Node ID 601dc257a740d3a6047667731007283a4dcb9600 > # Parent c893596e2d4c7ddd62a3704ea5460be4e5be38df > libxl: move definition of libxl_domain_config into the IDL > > Signed-off-by: Ian Campbell <ian.campbell@citrix.com> > Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> > --- > Posted during 4.2 freeze and deferred until 4.3...And now, finally, committed.> > diff -r c893596e2d4c -r 601dc257a740 tools/libxl/libxl.h > --- a/tools/libxl/libxl.h Tue Nov 20 17:22:10 2012 +0000 > +++ b/tools/libxl/libxl.h Tue Nov 20 17:22:16 2012 +0000 > @@ -474,26 +474,6 @@ typedef struct { > > #define LIBXL_VERSION 0 > > -typedef struct { > - libxl_domain_create_info c_info; > - libxl_domain_build_info b_info; > - > - int num_disks, num_nics, num_pcidevs, num_vfbs, num_vkbs, num_vtpms; > - > - libxl_device_disk *disks; > - libxl_device_nic *nics; > - libxl_device_pci *pcidevs; > - libxl_device_vfb *vfbs; > - libxl_device_vkb *vkbs; > - libxl_device_vtpm *vtpms; > - > - libxl_action_on_shutdown on_poweroff; > - libxl_action_on_shutdown on_reboot; > - libxl_action_on_shutdown on_watchdog; > - libxl_action_on_shutdown on_crash; > -} libxl_domain_config; > -char *libxl_domain_config_to_json(libxl_ctx *ctx, libxl_domain_config *p); > - > /* context functions */ > int libxl_ctx_alloc(libxl_ctx **pctx, int version, > unsigned flags /* none currently defined */, > diff -r c893596e2d4c -r 601dc257a740 tools/libxl/libxl_create.c > --- a/tools/libxl/libxl_create.c Tue Nov 20 17:22:10 2012 +0000 > +++ b/tools/libxl/libxl_create.c Tue Nov 20 17:22:16 2012 +0000 > @@ -24,43 +24,6 @@ > #include <xenguest.h> > #include <xen/hvm/hvm_info_table.h> > > -void libxl_domain_config_init(libxl_domain_config *d_config) > -{ > - memset(d_config, 0, sizeof(*d_config)); > - libxl_domain_create_info_init(&d_config->c_info); > - libxl_domain_build_info_init(&d_config->b_info); > -} > - > -void libxl_domain_config_dispose(libxl_domain_config *d_config) > -{ > - int i; > - > - for (i=0; i<d_config->num_disks; i++) > - libxl_device_disk_dispose(&d_config->disks[i]); > - free(d_config->disks); > - > - for (i=0; i<d_config->num_nics; i++) > - libxl_device_nic_dispose(&d_config->nics[i]); > - free(d_config->nics); > - > - for (i=0; i<d_config->num_pcidevs; i++) > - libxl_device_pci_dispose(&d_config->pcidevs[i]); > - free(d_config->pcidevs); > - > - for (i=0; i<d_config->num_vfbs; i++) > - libxl_device_vfb_dispose(&d_config->vfbs[i]); > - free(d_config->vfbs); > - > - for (i=0; i<d_config->num_vkbs; i++) > - libxl_device_vkb_dispose(&d_config->vkbs[i]); > - free(d_config->vkbs); > - > - libxl_device_vtpm_list_free(d_config->vtpms, d_config->num_vtpms); > - > - libxl_domain_create_info_dispose(&d_config->c_info); > - libxl_domain_build_info_dispose(&d_config->b_info); > -} > - > int libxl__domain_create_info_setdefault(libxl__gc *gc, > libxl_domain_create_info *c_info) > { > diff -r c893596e2d4c -r 601dc257a740 tools/libxl/libxl_json.c > --- a/tools/libxl/libxl_json.c Tue Nov 20 17:22:10 2012 +0000 > +++ b/tools/libxl/libxl_json.c Tue Nov 20 17:22:16 2012 +0000 > @@ -786,158 +786,6 @@ out: > return ret; > } > > -yajl_gen_status libxl_domain_config_gen_json(yajl_gen hand, > - libxl_domain_config *p) > -{ > - yajl_gen_status s; > - int i; > - > - s = yajl_gen_map_open(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_string(hand, (const unsigned char *)"c_info", > - sizeof("c_info")-1); > - if (s != yajl_gen_status_ok) > - goto out; > - s = libxl_domain_create_info_gen_json(hand, &p->c_info); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_string(hand, (const unsigned char *)"b_info", > - sizeof("b_info")-1); > - if (s != yajl_gen_status_ok) > - goto out; > - s = libxl_domain_build_info_gen_json(hand, &p->b_info); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_string(hand, (const unsigned char *)"disks", > - sizeof("disks")-1); > - if (s != yajl_gen_status_ok) > - goto out; > - s = yajl_gen_array_open(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - for (i = 0; i < p->num_disks; i++) { > - s = libxl_device_disk_gen_json(hand, &p->disks[i]); > - if (s != yajl_gen_status_ok) > - goto out; > - } > - s = yajl_gen_array_close(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_string(hand, (const unsigned char *)"nics", > - sizeof("nics")-1); > - if (s != yajl_gen_status_ok) > - goto out; > - s = yajl_gen_array_open(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - for (i = 0; i < p->num_nics; i++) { > - s = libxl_device_nic_gen_json(hand, &p->nics[i]); > - if (s != yajl_gen_status_ok) > - goto out; > - } > - s = yajl_gen_array_close(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_string(hand, (const unsigned char *)"pcidevs", > - sizeof("pcidevs")-1); > - if (s != yajl_gen_status_ok) > - goto out; > - s = yajl_gen_array_open(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - for (i = 0; i < p->num_pcidevs; i++) { > - s = libxl_device_pci_gen_json(hand, &p->pcidevs[i]); > - if (s != yajl_gen_status_ok) > - goto out; > - } > - s = yajl_gen_array_close(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_string(hand, (const unsigned char *)"vfbs", > - sizeof("vfbs")-1); > - if (s != yajl_gen_status_ok) > - goto out; > - s = yajl_gen_array_open(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - for (i = 0; i < p->num_vfbs; i++) { > - s = libxl_device_vfb_gen_json(hand, &p->vfbs[i]); > - if (s != yajl_gen_status_ok) > - goto out; > - } > - s = yajl_gen_array_close(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_string(hand, (const unsigned char *)"vkbs", > - sizeof("vkbs")-1); > - if (s != yajl_gen_status_ok) > - goto out; > - s = yajl_gen_array_open(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - for (i = 0; i < p->num_vkbs; i++) { > - s = libxl_device_vkb_gen_json(hand, &p->vkbs[i]); > - if (s != yajl_gen_status_ok) > - goto out; > - } > - s = yajl_gen_array_close(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_string(hand, (const unsigned char *)"on_poweroff", > - sizeof("on_poweroff")-1); > - if (s != yajl_gen_status_ok) > - goto out; > - s = libxl_action_on_shutdown_gen_json(hand, &p->on_poweroff); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_string(hand, (const unsigned char *)"on_reboot", > - sizeof("on_reboot")-1); > - if (s != yajl_gen_status_ok) > - goto out; > - s = libxl_action_on_shutdown_gen_json(hand, &p->on_reboot); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_string(hand, (const unsigned char *)"on_watchdog", > - sizeof("on_watchdog")-1); > - if (s != yajl_gen_status_ok) > - goto out; > - s = libxl_action_on_shutdown_gen_json(hand, &p->on_watchdog); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_string(hand, (const unsigned char *)"on_crash", > - sizeof("on_crash")-1); > - if (s != yajl_gen_status_ok) > - goto out; > - s = libxl_action_on_shutdown_gen_json(hand, &p->on_crash); > - if (s != yajl_gen_status_ok) > - goto out; > - > - s = yajl_gen_map_close(hand); > - if (s != yajl_gen_status_ok) > - goto out; > - out: > - return s; > -} > - > -char *libxl_domain_config_to_json(libxl_ctx *ctx, libxl_domain_config *p) > -{ > - return libxl__object_to_json(ctx, "libxl_domain_config", > - (libxl__gen_json_callback)&libxl_domain_config_gen_json, > - (void *)p); > -} > - > /* > * Local variables: > * mode: C > diff -r c893596e2d4c -r 601dc257a740 tools/libxl/libxl_types.idl > --- a/tools/libxl/libxl_types.idl Tue Nov 20 17:22:10 2012 +0000 > +++ b/tools/libxl/libxl_types.idl Tue Nov 20 17:22:16 2012 +0000 > @@ -401,6 +401,23 @@ libxl_device_vtpm = Struct("device_vtpm" > ("uuid", libxl_uuid), > ]) > > +libxl_domain_config = Struct("domain_config", [ > + ("c_info", libxl_domain_create_info), > + ("b_info", libxl_domain_build_info), > + > + ("disks", Array(libxl_device_disk, "num_disks")), > + ("nics", Array(libxl_device_nic, "num_nics")), > + ("pcidevs", Array(libxl_device_pci, "num_pcidevs")), > + ("vfbs", Array(libxl_device_vfb, "num_vfbs")), > + ("vkbs", Array(libxl_device_vkb, "num_vkbs")), > + ("vtpms", Array(libxl_device_vtpm, "num_vtpms")), > + > + ("on_poweroff", libxl_action_on_shutdown), > + ("on_reboot", libxl_action_on_shutdown), > + ("on_watchdog", libxl_action_on_shutdown), > + ("on_crash", libxl_action_on_shutdown), > + ]) > + > libxl_diskinfo = Struct("diskinfo", [ > ("backend", string), > ("backend_id", uint32), > diff -r c893596e2d4c -r 601dc257a740 tools/ocaml/libs/xl/genwrap.py > --- a/tools/ocaml/libs/xl/genwrap.py Tue Nov 20 17:22:10 2012 +0000 > +++ b/tools/ocaml/libs/xl/genwrap.py Tue Nov 20 17:22:16 2012 +0000 > @@ -283,6 +283,7 @@ if __name__ == ''__main__'': > "cpupoolinfo", > "domain_create_info", > "domain_build_info", > + "domain_config", > "vcpuinfo", > "event", > ] > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel