mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
libxl/hotplug: add support for getting domid
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>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
[ ijc -- dropped xencommons hunk, same change was made independently
in 02ebea7768 ]
This commit is contained in:
1 parent
9d95466111
commit
d6bc83a531
2 files changed
+20
No files matched your search
@@ -1692,6 +1692,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) {
|
||||
rc = rc ? rc : ERROR_FAIL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
*domid = atoi(xs_domid);
|
||||
|
||||
out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* generic callback for devices that only need to set ao_complete */
|
||||
|
||||
@@ -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.
|
||||
|
||||