xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: ZhouPeng <zpengxen@gmail.com>
To: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Wei Liu <liuw@liuw.name>
Subject: Re: Re: [PATCH] libxl: initialize domid to 0 in libxl__create_stubdom
Date: Tue, 21 Jun 2011 11:29:52 +0800	[thread overview]
Message-ID: <BANLkTim+5avEnTc_uy2cQY5i63g=JAvNJQ@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1106202003430.12963@kaball-desktop>

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

I think it should be both an input and output parameter,
which allows caller/user to provide a given domid,
if the given domid <= 0, it meas to request the hypervisor
to assign the next free id.

so  "assert(!libxl_domid_valid_guest(*domid));" is necessary
and '*domid = -1;' should be cut out. in libxl__domain_make

If any mistake, pls fix me

My patch for this:
---
libxl: fix domid check err.
It should meet the XEN_DOMCTL_createdomain hypercall

Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>

diff -r eca057e4475c tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Fri Jun 17 08:08:13 2011 +0100
+++ b/tools/libxl/libxl_create.c        Tue Jun 21 11:02:51 2011 +0800
@@ -295,7 +295,8 @@ int libxl__domain_make(libxl__gc *gc, li
     xs_transaction_t t = 0;
     xen_domain_handle_t handle;

-    assert(!libxl_domid_valid_guest(*domid));
+    if (*domid > 0)
+        assert(!libxl_domid_valid_guest(*domid));

     uuid_string = libxl__uuid2string(gc, info->uuid);
     if (!uuid_string) {
@@ -306,7 +307,8 @@ int libxl__domain_make(libxl__gc *gc, li
     flags = info->hvm ? XEN_DOMCTL_CDF_hvm_guest : 0;
     flags |= info->hap ? XEN_DOMCTL_CDF_hap : 0;
     flags |= info->oos ? 0 : XEN_DOMCTL_CDF_oos_off;
-    *domid = -1;
+    if (*domid < 0)
+        *domid = -1;

     /* Ultimately, handle is an array of 16 uint8_t, same as uuid */
     libxl_uuid_copy((libxl_uuid *)handle, &info->uuid);


2011/6/21 Stefano Stabellini <stefano.stabellini@eu.citrix.com>:
> If we decide to make domid an output parameter only, then
>
> uint32_t domid;
>
> isn't a bug anymore.
> Have you read http://marc.info/?l=xen-devel&m=130763064528133?

-- 
Zhou Peng
Operating System Technology Group
Institute of Software, the Chinese Academy of Sciences (ISCAS)

[-- Attachment #2: libxl-fix-domid-check-err --]
[-- Type: application/octet-stream, Size: 1088 bytes --]

libxl: fix domid check err.
It should meet the XEN_DOMCTL_createdomain hypercall

Signed-off-by: Zhou Peng <zhoupeng@nfs.iscas.ac.cn>

diff -r eca057e4475c tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Fri Jun 17 08:08:13 2011 +0100
+++ b/tools/libxl/libxl_create.c        Tue Jun 21 11:02:51 2011 +0800
@@ -295,7 +295,8 @@ int libxl__domain_make(libxl__gc *gc, li
     xs_transaction_t t = 0;
     xen_domain_handle_t handle;
 
-    assert(!libxl_domid_valid_guest(*domid));
+    if (*domid > 0)
+        assert(!libxl_domid_valid_guest(*domid));
 
     uuid_string = libxl__uuid2string(gc, info->uuid);
     if (!uuid_string) {
@@ -306,7 +307,8 @@ int libxl__domain_make(libxl__gc *gc, li
     flags = info->hvm ? XEN_DOMCTL_CDF_hvm_guest : 0;
     flags |= info->hap ? XEN_DOMCTL_CDF_hap : 0;
     flags |= info->oos ? 0 : XEN_DOMCTL_CDF_oos_off;
-    *domid = -1;
+    if (*domid < 0)
+        *domid = -1;
 
     /* Ultimately, handle is an array of 16 uint8_t, same as uuid */
     libxl_uuid_copy((libxl_uuid *)handle, &info->uuid);

[-- 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:[~2011-06-21  3:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09  5:03 [PATCH] libxl: initialize domid to 0 in libxl__create_stubdom Wei Liu
2011-06-09  7:55 ` Ian Campbell
2011-06-09  8:31   ` Wei Liu
2011-06-09 10:23     ` Ian Campbell
2011-06-09 11:03       ` Wei Liu
2011-06-09 11:35         ` Ian Campbell
2011-06-09 14:41       ` Stefano Stabellini
2011-06-09 14:43         ` Ian Campbell
2011-06-17 17:46       ` Ian Jackson
2011-06-20 19:06         ` Stefano Stabellini
2011-06-21  3:29           ` ZhouPeng [this message]
2011-06-21  7:31             ` ZhouPeng
2011-06-21 12:28             ` Ian Jackson
2011-06-21 13:31               ` ZhouPeng
2011-06-21 12:25           ` Ian Jackson
2011-06-21 14:05             ` Stefano Stabellini
2011-06-21 14:25               ` Ian Jackson
2011-06-22 17:59                 ` Stefano Stabellini
2011-06-24 14:37                   ` Ian Jackson

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='BANLkTim+5avEnTc_uy2cQY5i63g=JAvNJQ@mail.gmail.com' \
    --to=zpengxen@gmail.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=liuw@liuw.name \
    --cc=stefano.stabellini@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).