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

[Xen-devel] [PATCH 1 of 2] libxl: provide libxl_domain_config_init



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1333533071 -3600
# Node ID ac6f863df8f8c86dcc58df15f94333e6088e0bf4
# Parent  d00faeaf21dd280500d2deace00683d884a2dc10
libxl: provide libxl_domain_config_init.

Currently this struct is too complicated for the IDL to represent (arrays) so
for now implement by hand.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r d00faeaf21dd -r ac6f863df8f8 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Wed Apr 04 10:49:08 2012 +0100
+++ b/tools/libxl/libxl.h       Wed Apr 04 10:51:11 2012 +0100
@@ -462,6 +462,7 @@ int libxl_ctx_postfork(libxl_ctx *ctx);
 typedef int (*libxl_console_ready)(libxl_ctx *ctx, uint32_t domid, void *priv);
 int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config, 
libxl_console_ready cb, void *priv, uint32_t *domid);
 int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config, 
libxl_console_ready cb, void *priv, uint32_t *domid, int restore_fd);
+void libxl_domain_config_init(libxl_domain_config *d_config);
 void libxl_domain_config_dispose(libxl_domain_config *d_config);
 int libxl_domain_suspend(libxl_ctx *ctx, libxl_domain_suspend_info *info,
                           uint32_t domid, int fd);
diff -r d00faeaf21dd -r ac6f863df8f8 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Wed Apr 04 10:49:08 2012 +0100
+++ b/tools/libxl/libxl_create.c        Wed Apr 04 10:51:11 2012 +0100
@@ -22,6 +22,13 @@
 #include <xc_dom.h>
 #include <xenguest.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;
diff -r d00faeaf21dd -r ac6f863df8f8 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed Apr 04 10:49:08 2012 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Wed Apr 04 10:51:11 2012 +0100
@@ -535,8 +535,6 @@ static void parse_config_data(const char
         exit(1);
     }
 
-    libxl_domain_create_info_init(c_info);
-
     if (!xlu_cfg_get_string (config, "seclabel", &buf, 0)) {
         e = libxl_flask_context_to_sid(ctx, (char *)buf, strlen(buf),
                                     &c_info->ssidref);
@@ -582,7 +580,6 @@ static void parse_config_data(const char
         exit(1);
     }
 
-    libxl_domain_build_info_init(b_info);
     libxl_domain_build_info_init_type(b_info, c_info->type);
 
     /* the following is the actual config parsing with overriding values in 
the structures */
@@ -1505,7 +1502,7 @@ static int create_domain(struct domain_c
     pid_t child_console_pid = -1;
     struct save_file_header hdr;
 
-    memset(&d_config, 0x00, sizeof(d_config));
+    libxl_domain_config_init(&d_config);
 
     if (restore_file) {
         uint8_t *optdata_begin = 0;
@@ -1822,7 +1819,7 @@ start:
 
                 /* Reparse the configuration in case it has changed */
                 libxl_domain_config_dispose(&d_config);
-                memset(&d_config, 0, sizeof(d_config));
+                libxl_domain_config_init(&d_config);
                 parse_config_data(config_file, config_data, config_len,
                                   &d_config);
 

_______________________________________________
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®.