xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
Subject: [PATCH 1/5] add some return values testing in stubdom
Date: Wed, 13 Jan 2010 16:14:51 +0000	[thread overview]
Message-ID: <1263399295-19453-2-git-send-email-vincent.hanquez@eu.citrix.com> (raw)
In-Reply-To: <1263399295-19453-1-git-send-email-vincent.hanquez@eu.citrix.com>

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]


Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
---
 tools/libxl/libxl.c |   35 +++++++++++++++++++++++++----------
 1 files changed, 25 insertions(+), 10 deletions(-)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-add-some-return-values-testing-in-stubdom.patch --]
[-- Type: text/x-patch; name="0001-add-some-return-values-testing-in-stubdom.patch", Size: 3207 bytes --]

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index df3ddc0..ede485b 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -824,7 +824,7 @@ static int libxl_create_stubdom(struct libxl_ctx *ctx,
                                 libxl_device_vkb *vkb,
                                 libxl_device_model_starting **starting_r)
 {
-    int i, num_console = 1;
+    int i, num_console = 1, ret;
     libxl_device_console *console;
     libxl_domain_create_info c_info;
     libxl_domain_build_info b_info;
@@ -855,12 +855,18 @@ static int libxl_create_stubdom(struct libxl_ctx *ctx,
     b_info.u.pv.features = "";
     b_info.hvm = 0;
 
-    libxl_domain_make(ctx, &c_info, &domid);
-    libxl_domain_build(ctx, &b_info, domid, &state);
+    ret = libxl_domain_make(ctx, &c_info, &domid);
+    if (ret) return ret;
+    ret = libxl_domain_build(ctx, &b_info, domid, &state);
+    if (ret) return ret;
 
     libxl_write_dmargs(ctx, domid, info->domid, args);
-    libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/image/device-model-domid", libxl_xs_get_dompath(ctx, info->domid)), "%d", domid);
-    libxl_xs_write(ctx, XBT_NULL, libxl_sprintf(ctx, "%s/target", libxl_xs_get_dompath(ctx, domid)), "%d", info->domid);
+    libxl_xs_write(ctx, XBT_NULL,
+                   libxl_sprintf(ctx, "%s/image/device-model-domid", libxl_xs_get_dompath(ctx, info->domid)),
+                   "%d", domid);
+    libxl_xs_write(ctx, XBT_NULL,
+                   libxl_sprintf(ctx, "%s/target", libxl_xs_get_dompath(ctx, domid)),
+                   "%d", info->domid);
     xc_domain_set_target(ctx->xch, domid, info->domid);
     xs_set_target(ctx->xsh, domid, info->domid);
 
@@ -880,27 +886,36 @@ retry_transaction:
 
     for (i = 0; i < num_disks; i++) {
         disks[i].domid = domid;
-        libxl_device_disk_add(ctx, domid, &disks[i]);
+        ret = libxl_device_disk_add(ctx, domid, &disks[i]);
+        if (ret) return ret;
     }
     for (i = 0; i < num_vifs; i++) {
         vifs[i].domid = domid;
-        libxl_device_nic_add(ctx, domid, &vifs[i]);
+        ret = libxl_device_nic_add(ctx, domid, &vifs[i]);
+        if (ret) return ret;
     }
     vfb->domid = domid;
-    libxl_device_vfb_add(ctx, domid, vfb);
+    ret = libxl_device_vfb_add(ctx, domid, vfb);
+    if (ret) return ret;
     vkb->domid = domid;
-    libxl_device_vkb_add(ctx, domid, vkb);
+    ret = libxl_device_vkb_add(ctx, domid, vkb);
+    if (ret) return ret;
 
     if (info->serial)
         num_console++;
+
     console = libxl_calloc(ctx, num_console, sizeof(libxl_device_console));
+    if (!console)
+        return ERROR_NOMEM;
+
     for (i = 0; i < num_console; i++) {
         console[i].devid = i;
         console[i].constype = CONSTYPE_IOEMU;
         console[i].domid = domid;
         if (!i)
             console[i].build_state = &state;
-        libxl_device_console_add(ctx, domid, &console[i]);
+        ret = libxl_device_console_add(ctx, domid, &console[i]);
+        if (ret) return ret;
     }
     if (libxl_create_xenpv_qemu(ctx, vfb, num_console, console, &dm_starting) < 0) {
         free(args);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

  reply	other threads:[~2010-01-13 16:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13 16:14 [PATCH 0/5] more solidification work Vincent Hanquez
2010-01-13 16:14 ` Vincent Hanquez [this message]
2010-01-13 16:14 ` [PATCH 2/5] initialize enum to 1, to prevent defaulting to the 0 values when structure when not properly initialized by the client Vincent Hanquez
2010-01-13 16:14 ` [PATCH 3/5] add fuse around generic_device_add related to invalid kinds Vincent Hanquez
2010-01-13 16:14 ` [PATCH 4/5] add error in disk_add if phystype is not recognized Vincent Hanquez
2010-01-13 16:14 ` [PATCH 5/5] fix name to domid conversion Vincent Hanquez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263399295-19453-2-git-send-email-vincent.hanquez@eu.citrix.com \
    --to=vincent.hanquez@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).