@@ -58,7 +58,7 @@ static int libxl__set_xenstore_p9(libxl__gc *gc, uint32_t domid,
LIBXL_DEFINE_DEVICE_REMOVE(p9)
-DEFINE_DEVICE_TYPE_STRUCT(p9,
+DEFINE_DEVICE_TYPE_STRUCT(p9, 9PFS,
.skip_attach = 1,
.set_xenstore_config = (device_set_xenstore_config_fn_t)
libxl__set_xenstore_p9,
@@ -60,8 +60,10 @@ static const char *get_vifname(libxl__checkpoint_device *dev,
/* Convenience aliases */
const uint32_t domid = dev->cds->domid;
- path = GCSPRINTF("%s/backend/vif/%d/%d/vifname",
- libxl__xs_get_dompath(gc, 0), domid, nic->devid);
+ path = GCSPRINTF("%s/backend/%s/%d/%d/vifname",
+ libxl__xs_get_dompath(gc, 0),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VIF),
+ domid, nic->devid);
rc = libxl__xs_read_checked(gc, XBT_NULL, path, &vifname);
if (!rc && !vifname) {
vifname = libxl__device_nic_devname(gc, domid,
@@ -37,7 +37,9 @@ static int libxl__console_tty_path(libxl__gc *gc, uint32_t domid, int cons_num,
if (cons_num == 0)
*tty_path = GCSPRINTF("%s/console/tty", dom_path);
else
- *tty_path = GCSPRINTF("%s/device/console/%d/tty", dom_path,
+ *tty_path = GCSPRINTF("%s/device/%s/%d/tty", dom_path,
+ libxl__device_kind_to_string(
+ LIBXL__DEVICE_KIND_CONSOLE),
cons_num);
rc = 0;
break;
@@ -450,8 +452,10 @@ static int libxl__append_channel_list(libxl__gc *gc,
libxl_device_channel *next = NULL;
int rc = 0, i;
- libxl_dir_path = GCSPRINTF("%s/device/console",
- libxl__xs_libxl_path(gc, domid));
+ libxl_dir_path = GCSPRINTF("%s/device/%s",
+ libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(
+ LIBXL__DEVICE_KIND_CONSOLE));
dir = libxl__xs_directory(gc, XBT_NULL, libxl_dir_path, &n);
if (!dir || !n)
goto out;
@@ -523,10 +527,12 @@ int libxl_device_channel_getinfo(libxl_ctx *ctx, uint32_t domid,
dompath = libxl__xs_get_dompath(gc, domid);
channelinfo->devid = channel->devid;
- fe_path = GCSPRINTF("%s/device/console/%d", dompath,
+ fe_path = GCSPRINTF("%s/device/%s/%d", dompath,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_CONSOLE),
channelinfo->devid + 1);
- libxl_path = GCSPRINTF("%s/device/console/%d",
+ libxl_path = GCSPRINTF("%s/device/%s/%d",
libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_CONSOLE),
channelinfo->devid + 1);
channelinfo->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path), NULL);
@@ -682,7 +688,7 @@ static int libxl__set_xenstore_vfb(libxl__gc *gc, uint32_t domid,
/* vfb */
LIBXL_DEFINE_DEVICE_REMOVE(vfb)
-DEFINE_DEVICE_TYPE_STRUCT(vfb,
+DEFINE_DEVICE_TYPE_STRUCT(vfb, VFB,
.skip_attach = 1,
.set_xenstore_config = (device_set_xenstore_config_fn_t)
libxl__set_xenstore_vfb,
@@ -1442,7 +1442,7 @@ out:
#define libxl__device_from_dtdev NULL
#define libxl__device_dtdev_setdefault NULL
#define libxl__device_dtdev_update_devid NULL
-static DEFINE_DEVICE_TYPE_STRUCT(dtdev);
+static DEFINE_DEVICE_TYPE_STRUCT(dtdev, NONE);
const struct libxl_device_type *device_type_tbl[] = {
&libxl__disk_devtype,
@@ -1469,7 +1469,7 @@ static void domcreate_attach_devices(libxl__egc *egc,
if (ret) {
LOGD(ERROR, domid, "unable to add %s devices",
- device_type_tbl[dcs->device_type_idx]->type);
+ libxl__device_kind_to_string(device_type_tbl[dcs->device_type_idx]->type));
goto error_out;
}
@@ -2002,7 +2002,8 @@ void *libxl__device_list(libxl__gc *gc, const struct libxl_device_type *dt,
*num = 0;
libxl_path = GCSPRINTF("%s/device/%s",
- libxl__xs_libxl_path(gc, domid), dt->entry);
+ libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(dt->type));
dir = libxl__xs_directory(gc, XBT_NULL, libxl_path, &ndirs);
@@ -97,12 +97,14 @@ int libxl_evenable_disk_eject(libxl_ctx *ctx, uint32_t guest_domid,
int devid = libxl__device_disk_dev_number(vdev, NULL, NULL);
- path = GCSPRINTF("%s/device/vbd/%d/eject",
+ path = GCSPRINTF("%s/device/%s/%d/eject",
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VBD),
libxl__xs_get_dompath(gc, domid),
devid);
if (!path) { rc = ERROR_NOMEM; goto out; }
- const char *libxl_path = GCSPRINTF("%s/device/vbd/%d",
+ const char *libxl_path = GCSPRINTF("%s/device/%s/%d",
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VBD),
libxl__xs_libxl_path(gc, domid),
devid);
evg->be_ptr_path = libxl__sprintf(NOGC, "%s/backend", libxl_path);
@@ -614,7 +616,9 @@ int libxl_vdev_to_device_disk(libxl_ctx *ctx, uint32_t domid,
if (!dom_xl_path) {
goto out;
}
- libxl_path = GCSPRINTF("%s/device/vbd/%d", dom_xl_path, devid);
+ libxl_path = GCSPRINTF("%s/device/%s/%d", dom_xl_path,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VBD),
+ devid);
rc = libxl__disk_from_xenstore(gc, libxl_path, devid, disk);
out:
@@ -636,9 +640,13 @@ int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,
diskinfo->devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
/* tap devices entries in xenstore are written as vbd devices. */
- fe_path = GCSPRINTF("%s/device/vbd/%d", dompath, diskinfo->devid);
- libxl_path = GCSPRINTF("%s/device/vbd/%d",
- libxl__xs_libxl_path(gc, domid), diskinfo->devid);
+ fe_path = GCSPRINTF("%s/device/%s/%d", dompath,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VBD),
+ diskinfo->devid);
+ libxl_path = GCSPRINTF("%s/device/%s/%d",
+ libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VBD),
+ diskinfo->devid);
diskinfo->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path), NULL);
if (!diskinfo->backend) {
@@ -893,8 +901,10 @@ static char * libxl__alloc_vdev(libxl__gc *gc, void *get_vdev_user,
if (devid < 0)
return NULL;
if (libxl__xs_read(gc, t,
- GCSPRINTF("%s/device/vbd/%d/backend",
- libxl_dom_path, devid)) == NULL) {
+ GCSPRINTF("%s/device/%s/%d/backend",
+ libxl_dom_path,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VBD),
+ devid)) == NULL) {
if (errno == ENOENT)
return libxl__devid_to_vdev(gc, devid);
else
@@ -1187,7 +1197,7 @@ LIBXL_DEFINE_DEVICE_LIST(disk)
#define libxl__device_disk_update_devid NULL
-DEFINE_DEVICE_TYPE_STRUCT_X(disk, disk, vbd,
+DEFINE_DEVICE_TYPE_STRUCT(disk, VBD,
.merge = libxl_device_disk_merge,
.dm_needed = libxl_device_disk_dm_needed,
.from_xenstore = (device_from_xenstore_fn_t)libxl__disk_from_xenstore,
@@ -1686,7 +1686,7 @@ int libxl_retrieve_domain_configuration(libxl_ctx *ctx, uint32_t domid,
p = libxl__device_list(gc, dt, domid, &num);
if (p == NULL) {
LOGD(DEBUG, domid, "No %s from xenstore",
- dt->type);
+ libxl__device_kind_to_string(dt->type));
}
devs = libxl__device_type_get_ptr(dt, d_config);
@@ -3500,8 +3500,7 @@ typedef int (*device_set_xenstore_config_fn_t)(libxl__gc *, uint32_t, void *,
flexarray_t *);
struct libxl_device_type {
- char *type;
- char *entry;
+ libxl__device_kind type;
int skip_attach; /* Skip entry in domcreate_attach_devices() if 1 */
int ptr_offset; /* Offset of device array ptr in libxl_domain_config */
int num_offset; /* Offset of # of devices in libxl_domain_config */
@@ -3521,10 +3520,9 @@ struct libxl_device_type {
device_set_xenstore_config_fn_t set_xenstore_config;
};
-#define DEFINE_DEVICE_TYPE_STRUCT_X(name, sname, sentry, ...) \
+#define DEFINE_DEVICE_TYPE_STRUCT_X(name, sname, kind, ...) \
const struct libxl_device_type libxl__ ## name ## _devtype = { \
- .type = #sname, \
- .entry = #sentry, \
+ .type = LIBXL__DEVICE_KIND_ ## kind, \
.ptr_offset = offsetof(libxl_domain_config, name ## s), \
.num_offset = offsetof(libxl_domain_config, num_ ## name ## s), \
.dev_elem_size = sizeof(libxl_device_ ## sname), \
@@ -3543,8 +3541,8 @@ struct libxl_device_type {
__VA_ARGS__ \
}
-#define DEFINE_DEVICE_TYPE_STRUCT(name, ...) \
- DEFINE_DEVICE_TYPE_STRUCT_X(name, name, name, __VA_ARGS__)
+#define DEFINE_DEVICE_TYPE_STRUCT(name, kind, ...) \
+ DEFINE_DEVICE_TYPE_STRUCT_X(name, name, kind, __VA_ARGS__)
static inline void **libxl__device_type_get_ptr(
const struct libxl_device_type *dt, const libxl_domain_config *d_config)
@@ -126,8 +126,10 @@ static const char *get_vifname(libxl__checkpoint_device *dev,
/* Convenience aliases */
const uint32_t domid = dev->cds->domid;
- path = GCSPRINTF("%s/backend/vif/%d/%d/vifname",
- libxl__xs_get_dompath(gc, 0), domid, nic->devid);
+ path = GCSPRINTF("%s/backend/%s/%d/%d/vifname",
+ libxl__xs_get_dompath(gc, 0),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VIF),
+ domid, nic->devid);
rc = libxl__xs_read_checked(gc, XBT_NULL, path, &vifname);
if (!rc && !vifname) {
vifname = libxl__device_nic_devname(gc, domid,
@@ -409,7 +409,9 @@ int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid,
if (!libxl_dom_path)
goto out;
- libxl_path = GCSPRINTF("%s/device/vif/%d", libxl_dom_path, devid);
+ libxl_path = GCSPRINTF("%s/device/%s/%d", libxl_dom_path,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VIF),
+ devid);
rc = libxl__nic_from_xenstore(gc, libxl_path, devid, nic);
if (rc) goto out;
@@ -449,9 +451,13 @@ int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
dompath = libxl__xs_get_dompath(gc, domid);
nicinfo->devid = nic->devid;
- nicpath = GCSPRINTF("%s/device/vif/%d", dompath, nicinfo->devid);
- libxl_path = GCSPRINTF("%s/device/vif/%d",
- libxl__xs_libxl_path(gc, domid), nicinfo->devid);
+ nicpath = GCSPRINTF("%s/device/%s/%d", dompath,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VIF),
+ nicinfo->devid);
+ libxl_path = GCSPRINTF("%s/device/%s/%d",
+ libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VIF),
+ nicinfo->devid);
nicinfo->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path), NULL);
if (!nicinfo->backend) {
@@ -540,7 +546,7 @@ LIBXL_DEFINE_DEVICE_ADD(nic)
LIBXL_DEFINE_DEVICES_ADD(nic)
LIBXL_DEFINE_DEVICE_REMOVE(nic)
-DEFINE_DEVICE_TYPE_STRUCT_X(nic, nic, vif,
+DEFINE_DEVICE_TYPE_STRUCT(nic, VIF,
.update_config = libxl_device_nic_update_config,
.from_xenstore = (device_from_xenstore_fn_t)libxl__nic_from_xenstore,
.set_xenstore_config = (device_set_xenstore_config_fn_t)
@@ -125,7 +125,9 @@ static int libxl__device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl_d
libxl_device_pci_init(&pcidev_saved);
libxl_device_pci_copy(CTX, &pcidev_saved, pcidev);
- be_path = GCSPRINTF("%s/backend/pci/%d/0", libxl__xs_get_dompath(gc, 0), domid);
+ be_path = GCSPRINTF("%s/backend/%s/%d/0", libxl__xs_get_dompath(gc, 0),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_PCI),
+ domid);
num_devs = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/num_devs", be_path));
if (!num_devs)
return libxl__create_pci_backend(gc, domid, pcidev, 1);
@@ -195,7 +197,9 @@ static int libxl__device_pci_remove_xenstore(libxl__gc *gc, uint32_t domid, libx
int num, i, j;
xs_transaction_t t;
- be_path = GCSPRINTF("%s/backend/pci/%d/0", libxl__xs_get_dompath(gc, 0), domid);
+ be_path = GCSPRINTF("%s/backend/%s/%d/0", libxl__xs_get_dompath(gc, 0),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_PCI),
+ domid);
num_devs_path = GCSPRINTF("%s/num_devs", be_path);
num_devs = libxl__xs_read(gc, XBT_NULL, num_devs_path);
if (!num_devs)
@@ -315,14 +319,17 @@ static int get_all_assigned_devices(libxl__gc *gc, libxl_device_pci **list, int
for(i = 0; i < nd; i++) {
char *path, *num_devs;
- path = GCSPRINTF("/local/domain/0/backend/pci/%s/0/num_devs", domlist[i]);
+ path = GCSPRINTF("/local/domain/0/backend/%s/%s/0/num_devs",
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_PCI),
+ domlist[i]);
num_devs = libxl__xs_read(gc, XBT_NULL, path);
if ( num_devs ) {
int ndev = atoi(num_devs), j;
char *devpath, *bdf;
for(j = 0; j < ndev; j++) {
- devpath = GCSPRINTF("/local/domain/0/backend/pci/%s/0/dev-%u",
+ devpath = GCSPRINTF("/local/domain/0/backend/%s/%s/0/dev-%u",
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_PCI),
domlist[i], j);
bdf = libxl__xs_read(gc, XBT_NULL, devpath);
if ( bdf ) {
@@ -1589,7 +1596,9 @@ libxl_device_pci *libxl_device_pci_list(libxl_ctx *ctx, uint32_t domid, int *num
*num = 0;
- be_path = GCSPRINTF("%s/backend/pci/%d/0", libxl__xs_get_dompath(gc, 0), domid);
+ be_path = GCSPRINTF("%s/backend/%s/%d/0", libxl__xs_get_dompath(gc, 0),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_PCI),
+ domid);
num_devs = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/num_devs", be_path));
if (!num_devs)
goto out;
@@ -1682,7 +1691,7 @@ static int libxl_device_pci_compare(libxl_device_pci *d1,
#define libxl__device_pci_update_devid NULL
-DEFINE_DEVICE_TYPE_STRUCT_X(pcidev, pci, pci);
+DEFINE_DEVICE_TYPE_STRUCT_X(pcidev, pci, PCI);
/*
* Local variables:
@@ -310,8 +310,10 @@ static void libxl__device_usbctrl_del_xenstore(libxl__gc *gc, uint32_t domid,
xs_transaction_t t = XBT_NULL;
int rc;
- libxl_path = GCSPRINTF("%s/device/vusb/%d",
- libxl__xs_libxl_path(gc, domid), usbctrl->devid);
+ libxl_path = GCSPRINTF("%s/device/%s/%d",
+ libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VUSB),
+ usbctrl->devid);
be_path = vusb_be_from_xs_libxl_type(gc, libxl_path, usbctrl->type);
for (;;) {
@@ -574,8 +576,9 @@ libxl_device_usbctrl_list(libxl_ctx *ctx, uint32_t domid, int *num)
*num = 0;
- libxl_vusbs_path = GCSPRINTF("%s/device/vusb",
- libxl__xs_libxl_path(gc, domid));
+ libxl_vusbs_path = GCSPRINTF("%s/device/%s",
+ libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VUSB));
entry = libxl__xs_directory(gc, XBT_NULL, libxl_vusbs_path, &nentries);
if (entry && nentries) {
@@ -667,13 +670,17 @@ int libxl_device_usbctrl_getinfo(libxl_ctx *ctx, uint32_t domid,
})
libxl_dom_path = libxl__xs_libxl_path(gc, domid);
- libxl_path = GCSPRINTF("%s/device/vusb/%d", libxl_dom_path, usbctrl->devid);
+ libxl_path = GCSPRINTF("%s/device/%s/%d", libxl_dom_path,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VUSB),
+ usbctrl->devid);
libxl_usbctrl_type_from_string(READ_SUBPATH(libxl_path, "type"),
&usbctrlinfo->type);
if (usbctrlinfo->type != LIBXL_USBCTRL_TYPE_DEVICEMODEL) {
dompath = libxl__xs_get_dompath(gc, domid);
- fe_path = GCSPRINTF("%s/device/vusb/%d", dompath, usbctrl->devid);
+ fe_path = GCSPRINTF("%s/device/%s/%d", dompath,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VUSB),
+ usbctrl->devid);
be_path = READ_SUBPATH(libxl_path, "backend");
usbctrlinfo->backend = libxl__strdup(NOGC, be_path);
rc = libxl__backendpath_parse_domid(gc, be_path,
@@ -821,8 +828,9 @@ static int get_assigned_devices(libxl__gc *gc,
unsigned int nc = 0;
uint32_t domid = atoi(domlist[i]);
- libxl_vusbs_path = GCSPRINTF("%s/device/vusb",
- libxl__xs_libxl_path(gc, domid));
+ libxl_vusbs_path = GCSPRINTF("%s/device/%s",
+ libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VUSB));
usbctrls = libxl__xs_directory(gc, XBT_NULL,
libxl_vusbs_path, &nc);
@@ -900,8 +908,10 @@ libxl__device_usbdev_list_for_usbctrl(libxl__gc *gc,
*usbdevs = NULL;
*num = 0;
- libxl_path = GCSPRINTF("%s/device/vusb/%d",
- libxl__xs_libxl_path(gc, domid), usbctrl);
+ libxl_path = GCSPRINTF("%s/device/%s/%d",
+ libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VUSB),
+ usbctrl);
be_path = vusb_be_from_xs_libxl(gc, libxl_path);
if (!be_path) {
@@ -959,8 +969,10 @@ libxl_device_usbdev_list(libxl_ctx *ctx, uint32_t domid, int *num)
*num = 0;
- libxl_vusbs_path = GCSPRINTF("%s/device/vusb",
- libxl__xs_libxl_path(gc, domid));
+ libxl_vusbs_path = GCSPRINTF("%s/device/%s",
+ libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(
+ LIBXL__DEVICE_KIND_VUSB));
usbctrls = libxl__xs_directory(gc, XBT_NULL, libxl_vusbs_path, &nc);
for (i = 0; i < nc; i++) {
@@ -990,7 +1002,8 @@ static char *vusb_get_port_path(libxl__gc *gc, uint32_t domid,
char *path;
if (type == LIBXL_USBCTRL_TYPE_DEVICEMODEL)
- path = GCSPRINTF("%s/device/vusb", libxl__xs_libxl_path(gc, domid));
+ path = GCSPRINTF("%s/device/%s", libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VUSB));
else
path = GCSPRINTF("%s/backend/%s/%d",
libxl__xs_get_dompath(gc, LIBXL_TOOLSTACK_DOMID),
@@ -1096,8 +1109,9 @@ static int libxl__device_usbdev_setdefault(libxl__gc *gc,
/* A controller was specified; look it up */
const char *libxl_path, *be_path, *tmp;
- libxl_path = GCSPRINTF("%s/device/vusb/%d",
+ libxl_path = GCSPRINTF("%s/device/%s/%d",
libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VUSB),
usbdev->ctrl);
be_path = vusb_be_from_xs_libxl(gc, libxl_path);
@@ -1893,7 +1907,9 @@ int libxl_ctrlport_to_device_usbdev(libxl_ctx *ctx,
libxl_dom_path = libxl__xs_libxl_path(gc, domid);
- libxl_path = GCSPRINTF("%s/device/vusb/%d", libxl_dom_path, ctrl);
+ libxl_path = GCSPRINTF("%s/device/%s/%d", libxl_dom_path,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VUSB),
+ ctrl);
be_path = vusb_be_from_xs_libxl(gc, libxl_path);
if (!be_path) {
rc = ERROR_FAIL;
@@ -1962,14 +1978,14 @@ void libxl_device_usbdev_list_free(libxl_device_usbdev *list, int nr)
#define libxl__device_usbctrl_update_devid NULL
-DEFINE_DEVICE_TYPE_STRUCT(usbctrl,
+DEFINE_DEVICE_TYPE_STRUCT(usbctrl, VUSB,
.dm_needed = libxl_device_usbctrl_dm_needed
);
#define libxl__device_from_usbdev NULL
#define libxl__device_usbdev_update_devid NULL
-DEFINE_DEVICE_TYPE_STRUCT(usbdev);
+DEFINE_DEVICE_TYPE_STRUCT(usbdev, VUSB);
/*
* Local variables:
@@ -176,9 +176,12 @@ int libxl_device_vdispl_getinfo(libxl_ctx *ctx, uint32_t domid,
dompath = libxl__xs_get_dompath(gc, domid);
info->devid = vdispl->devid;
- devpath = GCSPRINTF("%s/device/vdispl/%d", dompath, info->devid);
- libxl_path = GCSPRINTF("%s/device/vdispl/%d",
+ devpath = GCSPRINTF("%s/device/%s/%d", dompath,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VDISPL),
+ info->devid);
+ libxl_path = GCSPRINTF("%s/device/%s/%d",
libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VDISPL),
info->devid);
info->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path),
@@ -249,7 +252,7 @@ LIBXL_DEFINE_DEVICE_REMOVE(vdispl)
static LIBXL_DEFINE_UPDATE_DEVID(vdispl, "vdispl")
LIBXL_DEFINE_DEVICE_LIST(vdispl)
-DEFINE_DEVICE_TYPE_STRUCT(vdispl,
+DEFINE_DEVICE_TYPE_STRUCT(vdispl, VDISPL,
.update_config = (device_update_config_fn_t)libxl__update_config_vdispl,
.from_xenstore = (device_from_xenstore_fn_t)libxl__vdispl_from_xenstore,
.set_xenstore_config = (device_set_xenstore_config_fn_t)
@@ -122,9 +122,12 @@ int libxl_device_vkb_getinfo(libxl_ctx *ctx, uint32_t domid,
dompath = libxl__xs_get_dompath(gc, domid);
info->devid = vkb->devid;
- devpath = GCSPRINTF("%s/device/vkbd/%d", dompath, info->devid);
- libxl_path = GCSPRINTF("%s/device/vkbd/%d",
+ devpath = GCSPRINTF("%s/device/%s/%d", dompath,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VKBD),
+ info->devid);
+ libxl_path = GCSPRINTF("%s/device/%s/%d",
libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VKBD),
info->devid);
info->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path),
@@ -165,7 +168,7 @@ static LIBXL_DEFINE_UPDATE_DEVID(vkb, "vkbd")
LIBXL_DEFINE_DEVICE_LIST(vkb)
LIBXL_DEFINE_DEVICE_REMOVE(vkb)
-DEFINE_DEVICE_TYPE_STRUCT_X(vkb, vkb, vkbd,
+DEFINE_DEVICE_TYPE_STRUCT(vkb, VKBD,
.skip_attach = 1,
.dm_needed = (device_dm_needed_fn_t)libxl__device_vkb_dm_needed,
.from_xenstore = (device_from_xenstore_fn_t)libxl__vkb_from_xenstore
@@ -573,11 +573,14 @@ int libxl_device_vsnd_getinfo(libxl_ctx *ctx, uint32_t domid,
dompath = libxl__xs_get_dompath(gc, domid);
info->devid = vsnd->devid;
- devpath = GCSPRINTF("%s/device/%s/%d", dompath, libxl__vsnd_devtype.entry,
+ devpath = GCSPRINTF("%s/device/%s/%d", dompath,
+ libxl__device_kind_to_string(
+ LIBXL__DEVICE_KIND_VSND),
info->devid);
libxl_path = GCSPRINTF("%s/device/%s/%d",
libxl__xs_libxl_path(gc, domid),
- libxl__vsnd_devtype.entry, info->devid);
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VSND),
+ info->devid);
info->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path), NULL);
@@ -644,7 +647,7 @@ LIBXL_DEFINE_DEVICE_REMOVE(vsnd)
static LIBXL_DEFINE_UPDATE_DEVID(vsnd, "vsnd")
LIBXL_DEFINE_DEVICE_LIST(vsnd)
-DEFINE_DEVICE_TYPE_STRUCT(vsnd,
+DEFINE_DEVICE_TYPE_STRUCT(vsnd, VSND,
.update_config = (device_update_config_fn_t) libxl__update_config_vsnd,
.from_xenstore = (device_from_xenstore_fn_t) libxl__vsnd_from_xenstore,
.set_xenstore_config = (device_set_xenstore_config_fn_t)
@@ -118,9 +118,13 @@ int libxl_device_vtpm_getinfo(libxl_ctx *ctx,
dompath = libxl__xs_get_dompath(gc, domid);
vtpminfo->devid = vtpm->devid;
- vtpmpath = GCSPRINTF("%s/device/vtpm/%d", dompath, vtpminfo->devid);
- libxl_path = GCSPRINTF("%s/device/vtpm/%d",
- libxl__xs_libxl_path(gc, domid), vtpminfo->devid);
+ vtpmpath = GCSPRINTF("%s/device/%s/%d", dompath,
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VTPM),
+ vtpminfo->devid);
+ libxl_path = GCSPRINTF("%s/device/%s/%d",
+ libxl__xs_libxl_path(gc, domid),
+ libxl__device_kind_to_string(LIBXL__DEVICE_KIND_VTPM),
+ vtpminfo->devid);
vtpminfo->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path), NULL);
if (!vtpminfo->backend) {
@@ -244,7 +248,7 @@ static LIBXL_DEFINE_DEVICES_ADD(vtpm)
LIBXL_DEFINE_DEVICE_REMOVE(vtpm)
LIBXL_DEFINE_DEVICE_LIST(vtpm)
-DEFINE_DEVICE_TYPE_STRUCT(vtpm,
+DEFINE_DEVICE_TYPE_STRUCT(vtpm, VTPM,
.update_config = libxl_device_vtpm_update_config,
.from_xenstore = (device_from_xenstore_fn_t)libxl__vtpm_from_xenstore,
.set_xenstore_config = (device_set_xenstore_config_fn_t)