From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org, Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: Re: [PATCH v1 01/12] libxl/hotplug: add support for getting domid
Date: Wed, 2 Oct 2013 10:36:10 +0100 [thread overview]
Message-ID: <524BE90A.7050804@citrix.com> (raw)
In-Reply-To: <1380705874-58491-2-git-send-email-roger.pau@citrix.com>
On 02/10/13 10:24, Roger Pau Monne wrote:
> This patch writes Dom0 domid on xenstore (like it's done for other
> guests), and adds a libxl helper function to fetch that domid from
> xenstore.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
> ---
> tools/hotplug/Linux/init.d/xencommons | 1 +
> tools/libxl/libxl.c | 17 +++++++++++++++++
> tools/libxl/libxl_internal.h | 3 +++
> 3 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/tools/hotplug/Linux/init.d/xencommons b/tools/hotplug/Linux/init.d/xencommons
> index a2e633b..43e09bc 100644
> --- a/tools/hotplug/Linux/init.d/xencommons
> +++ b/tools/hotplug/Linux/init.d/xencommons
> @@ -110,6 +110,7 @@ do_start () {
>
> echo Setting domain 0 name...
> ${BINDIR}/xenstore-write "/local/domain/0/name" "Domain-0"
> + ${BINDIR}/xenstore-write "/local/domain/0/domid" "0"
> fi
>
> echo Starting xenconsoled...
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index 1bce4bb..5417b48 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -1688,6 +1688,23 @@ int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass)
> return ERROR_FAIL;
> }
>
> +int libxl__get_domid(libxl__gc *gc, uint32_t *domid)
> +{
> + int rc;
> + const char *xs_domid;
> +
> + rc = libxl__xs_read_checked(gc, XBT_NULL, DOMID_XS_PATH, &xs_domid);
> + if (rc || !xs_domid) {
NULL domid check should be done before xenstore read, as an xs read is
quite a long operation.
> + rc = rc ? rc : ERROR_FAIL;
> + goto out;
> + }
> +
> + *domid = atoi(xs_domid);
atoi() lacks any error reporting. Use strtoul() and perhaps even a
sanity check on the return value against the valid bounds for a domid.
~Andrew
> +
> +out:
> + return rc;
> +}
> +
> /******************************************************************************/
>
> /* generic callback for devices that only need to set ao_complete */
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index f051d91..3b74726 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -101,6 +101,7 @@
> #define STUBDOM_SPECIAL_CONSOLES 3
> #define TAP_DEVICE_SUFFIX "-emu"
> #define DISABLE_UDEV_PATH "libxl/disable_udev"
> +#define DOMID_XS_PATH "domid"
>
> #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
>
> @@ -978,6 +979,8 @@ _hidden const char *libxl__device_nic_devname(libxl__gc *gc,
> uint32_t devid,
> libxl_nic_type type);
>
> +_hidden int libxl__get_domid(libxl__gc *gc, uint32_t *domid);
> +
> /*
> * libxl__ev_devstate - waits a given time for a device to
> * reach a given state. Follows the libxl_ev_* conventions.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2013-10-02 9:37 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-02 9:24 [PATCH v1 00/12] libxl: add driver domain backend daemon Roger Pau Monne
2013-10-02 9:24 ` [PATCH v1 01/12] libxl/hotplug: add support for getting domid Roger Pau Monne
2013-10-02 9:36 ` Andrew Cooper [this message]
2013-10-10 11:32 ` Ian Campbell
2013-11-01 18:42 ` Ian Jackson
2013-11-05 13:49 ` Ian Campbell
2013-10-02 9:24 ` [PATCH v1 02/12] libxl: remove unneeded libxl_domain_info in wait_device_connection Roger Pau Monne
2013-11-01 18:43 ` Ian Jackson
2013-10-02 9:24 ` [PATCH v1 03/12] libxl: make hotplug execution conditional on backend_domid == domid Roger Pau Monne
2013-11-01 18:43 ` Ian Jackson
2013-11-05 13:49 ` Ian Campbell
2013-10-02 9:24 ` [PATCH v1 04/12] libxl: create a local xenstore libxl and device-model dir for guests Roger Pau Monne
2013-10-10 11:37 ` Ian Campbell
2013-10-30 9:14 ` Roger Pau Monné
2013-10-30 11:53 ` Ian Jackson
2013-10-31 16:09 ` Ian Campbell
2013-10-02 9:24 ` [PATCH v1 05/12] libxl: don't remove device frontend path from driver domains Roger Pau Monne
2013-11-01 18:45 ` Ian Jackson
2013-10-02 9:24 ` [PATCH v1 06/12] libxl: synchronize device removal when using " Roger Pau Monne
2013-11-01 18:48 ` Ian Jackson
2013-10-02 9:24 ` [PATCH v1 07/12] libxl: remove the Qemu bodge for driver domain devices Roger Pau Monne
2013-10-02 9:45 ` Andrew Cooper
2013-10-02 9:24 ` [PATCH v1 08/12] libxl: don't launch Qemu on Dom0 for Qdisk devices on driver domains Roger Pau Monne
2013-10-02 9:24 ` [PATCH v1 09/12] libxl: add Qdisk backend launch helper Roger Pau Monne
2013-10-02 9:24 ` [PATCH v1 10/12] xl: put daemonize code in it's own function Roger Pau Monne
2013-10-02 9:24 ` [PATCH v1 11/12] libxl: revert 326a7b74 Roger Pau Monne
2013-10-02 9:24 ` [PATCH v1 12/12] libxl: add device backend listener in order to launch backends Roger Pau Monne
2013-10-30 17:00 ` Ian Jackson
2013-11-04 17:03 ` Roger Pau Monné
2013-11-04 17:20 ` Ian Jackson
2013-11-04 17:59 ` Ian Jackson
2013-11-06 12:15 ` Roger Pau Monné
2013-11-06 14:46 ` Ian Jackson
2013-11-07 10:22 ` Ian Campbell
2013-11-07 16:35 ` Ian Jackson
2013-11-07 19:11 ` Shriram Rajagopalan
2013-11-08 11:41 ` Ian Jackson
2013-11-11 17:59 ` Shriram Rajagopalan
2013-11-12 15:29 ` Ian Campbell
2013-11-06 9:41 ` Roger Pau Monné
2013-11-11 11:37 ` Ian Jackson
2013-11-06 13:02 ` Roger Pau Monné
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=524BE90A.7050804@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.