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,
/* 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/vifname",
+ libxl__domain_device_backend_path(gc, 0,
+ domid, nic->devid, LIBXL__DEVICE_KIND_VIF));
rc = libxl__xs_read_checked(gc, XBT_NULL, path, &vifname);
if (!rc && !vifname) {
vifname = libxl__device_nic_devname(gc, domid,
if (cons_num == 0)
*tty_path = GCSPRINTF("%s/console/tty", dom_path);
else
- *tty_path = GCSPRINTF("%s/device/console/%d/tty", dom_path,
- cons_num);
+ *tty_path = GCSPRINTF("%s/tty",
+ libxl__domain_device_frontend_path(gc, domid,
+ cons_num, LIBXL__DEVICE_KIND_CONSOLE));
rc = 0;
break;
default:
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;
libxl_channelinfo *channelinfo)
{
GC_INIT(ctx);
- char *dompath, *fe_path, *libxl_path;
+ char *fe_path, *libxl_path;
char *val;
int rc;
- dompath = libxl__xs_get_dompath(gc, domid);
channelinfo->devid = channel->devid;
- fe_path = GCSPRINTF("%s/device/console/%d", dompath,
- channelinfo->devid + 1);
- libxl_path = GCSPRINTF("%s/device/console/%d",
- libxl__xs_libxl_path(gc, domid),
- channelinfo->devid + 1);
+ fe_path = libxl__domain_device_frontend_path(gc, domid,
+ channelinfo->devid + 1,
+ LIBXL__DEVICE_KIND_CONSOLE);
+ libxl_path = libxl__domain_device_libxl_path(gc, domid,
+ channelinfo->devid + 1,
+ LIBXL__DEVICE_KIND_CONSOLE);
+
channelinfo->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path), NULL);
if (!channelinfo->backend) {
LIBXL_DEFINE_DEVICE_REMOVE(vkb)
-DEFINE_DEVICE_TYPE_STRUCT(vkb,
+DEFINE_DEVICE_TYPE_STRUCT(vkb, VKBD,
.skip_attach = 1
);
/* 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,
#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,
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;
}
/* Console 0 is a special case */
if (device->kind == LIBXL__DEVICE_KIND_CONSOLE && device->devid == 0)
- return GCSPRINTF("%s/console", dom_path);
+ return GCSPRINTF("%s/%s", dom_path,
+ libxl__device_kind_to_string(device->kind));
if (device->kind == LIBXL__DEVICE_KIND_VUART)
- return GCSPRINTF("%s/vuart/%d", dom_path, device->devid);
+ return GCSPRINTF("%s/%s/%d", dom_path,
+ libxl__device_kind_to_string(device->kind),
+ device->devid);
return GCSPRINTF("%s/device/%s/%d", dom_path,
libxl__device_kind_to_string(device->kind),
device->devid);
}
+char *libxl__domain_device_frontend_path(libxl__gc *gc, uint32_t domid, uint32_t devid,
+ libxl__device_kind device_kind)
+{
+ char *dom_path = libxl__xs_get_dompath(gc, domid);
+
+ return GCSPRINTF("%s/device/%s/%d", dom_path,
+ libxl__device_kind_to_string(device_kind), devid);
+}
+
char *libxl__device_backend_path(libxl__gc *gc, libxl__device *device)
{
char *dom_path = libxl__xs_get_dompath(gc, device->backend_domid);
device->domid, device->devid);
}
+char *libxl__domain_device_backend_path(libxl__gc *gc, uint32_t backend_domid,
+ uint32_t domid, uint32_t devid,
+ libxl__device_kind backend_kind)
+{
+ char *dom_path = libxl__xs_get_dompath(gc, backend_domid);
+
+ return GCSPRINTF("%s/backend/%s/%u/%d", dom_path,
+ libxl__device_kind_to_string(backend_kind),
+ domid, devid);
+}
+
char *libxl__device_libxl_path(libxl__gc *gc, libxl__device *device)
{
char *libxl_dom_path = libxl__xs_libxl_path(gc, device->domid);
device->devid);
}
+char *libxl__domain_device_libxl_path(libxl__gc *gc, uint32_t domid, uint32_t devid,
+ libxl__device_kind device_kind)
+{
+ char *libxl_dom_path = libxl__xs_libxl_path(gc, domid);
+
+ return GCSPRINTF("%s/device/%s/%d", libxl_dom_path,
+ libxl__device_kind_to_string(device_kind), devid);
+}
+
/* Returns 1 if device exists, 0 if not, ERROR_* (<0) on error. */
int libxl__device_exists(libxl__gc *gc, xs_transaction_t t,
libxl__device *device)
*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);
int devid = libxl__device_disk_dev_number(vdev, NULL, NULL);
- path = GCSPRINTF("%s/device/vbd/%d/eject",
- libxl__xs_get_dompath(gc, domid),
- devid);
+ path = GCSPRINTF("%s/eject",
+ libxl__domain_device_frontend_path(gc, domid, devid,
+ LIBXL__DEVICE_KIND_VBD));
if (!path) { rc = ERROR_NOMEM; goto out; }
- const char *libxl_path = GCSPRINTF("%s/device/vbd/%d",
- libxl__xs_libxl_path(gc, domid),
- devid);
+ const char *libxl_path = libxl__domain_device_frontend_path(gc, domid, devid,
+ LIBXL__DEVICE_KIND_VBD);
evg->be_ptr_path = libxl__sprintf(NOGC, "%s/backend", libxl_path);
const char *configured_vdev;
const char *vdev, libxl_device_disk *disk)
{
GC_INIT(ctx);
- char *dom_xl_path, *libxl_path;
+ char *libxl_path;
int devid = libxl__device_disk_dev_number(vdev, NULL, NULL);
int rc = ERROR_FAIL;
libxl_device_disk_init(disk);
- dom_xl_path = libxl__xs_libxl_path(gc, domid);
- if (!dom_xl_path) {
- goto out;
- }
- libxl_path = GCSPRINTF("%s/device/vbd/%d", dom_xl_path, devid);
+ libxl_path = libxl__domain_device_libxl_path(gc, domid, devid,
+ LIBXL__DEVICE_KIND_VBD);
rc = libxl__disk_from_xenstore(gc, libxl_path, devid, disk);
-out:
+
GC_FREE;
return rc;
}
libxl_device_disk *disk, libxl_diskinfo *diskinfo)
{
GC_INIT(ctx);
- char *dompath, *fe_path, *libxl_path;
+ char *fe_path, *libxl_path;
char *val;
int rc;
diskinfo->backend = NULL;
- dompath = libxl__xs_get_dompath(gc, 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 = libxl__domain_device_frontend_path(gc, domid, diskinfo->devid,
+ LIBXL__DEVICE_KIND_VBD);
+ libxl_path = libxl__domain_device_libxl_path(gc, domid, diskinfo->devid,
+ LIBXL__DEVICE_KIND_VBD);
diskinfo->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path), NULL);
if (!diskinfo->backend) {
{
const char *blkdev_start = (const char *) get_vdev_user;
int devid = 0, disk = 0, part = 0;
- char *libxl_dom_path = libxl__xs_libxl_path(gc, LIBXL_TOOLSTACK_DOMID);
libxl__device_disk_dev_number(blkdev_start, &disk, &part);
if (part != 0) {
NULL, NULL);
if (devid < 0)
return NULL;
- if (libxl__xs_read(gc, t,
- GCSPRINTF("%s/device/vbd/%d/backend",
- libxl_dom_path, devid)) == NULL) {
+ if (libxl__xs_read(gc, t, GCSPRINTF("%s/backend",
+ libxl__domain_device_libxl_path(gc,
+ LIBXL_TOOLSTACK_DOMID, devid,
+ LIBXL__DEVICE_KIND_VBD))) == NULL) {
if (errno == ENOENT)
return libxl__devid_to_vdev(gc, devid);
else
#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,
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);
libxl__device *device);
_hidden int libxl__device_generic_add(libxl__gc *gc, xs_transaction_t t,
libxl__device *device, char **bents, char **fents, char **ro_fents);
+_hidden char *libxl__domain_device_frontend_path(libxl__gc *gc, uint32_t domid, uint32_t devid,
+ libxl__device_kind device_kind);
_hidden char *libxl__device_backend_path(libxl__gc *gc, libxl__device *device);
+_hidden char *libxl__domain_device_backend_path(libxl__gc *gc, uint32_t backend_domid,
+ uint32_t domid, uint32_t devid,
+ libxl__device_kind device_kind);
_hidden char *libxl__device_libxl_path(libxl__gc *gc, libxl__device *device);
+_hidden char *libxl__domain_device_libxl_path(libxl__gc *gc, uint32_t domid, uint32_t devid,
+ libxl__device_kind device_kind);
_hidden int libxl__parse_backend_path(libxl__gc *gc, const char *path,
libxl__device *dev);
_hidden int libxl__device_destroy(libxl__gc *gc, libxl__device *dev);
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 */
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), \
__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)
/* 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/vifname",
+ libxl__domain_device_backend_path(gc, 0, domid,
+ nic->devid, LIBXL__DEVICE_KIND_VIF));
+
rc = libxl__xs_read_checked(gc, XBT_NULL, path, &vifname);
if (!rc && !vifname) {
vifname = libxl__device_nic_devname(gc, domid,
int devid, libxl_device_nic *nic)
{
GC_INIT(ctx);
- char *libxl_dom_path, *libxl_path;
+ char *libxl_path;
int rc = ERROR_FAIL;
libxl_device_nic_init(nic);
- libxl_dom_path = libxl__xs_libxl_path(gc, domid);
- if (!libxl_dom_path)
- goto out;
- libxl_path = GCSPRINTF("%s/device/vif/%d", libxl_dom_path, devid);
+ libxl_path = libxl__domain_device_libxl_path(gc, domid, devid,
+ LIBXL__DEVICE_KIND_VIF);
rc = libxl__nic_from_xenstore(gc, libxl_path, devid, nic);
if (rc) goto out;
libxl_device_nic *nic, libxl_nicinfo *nicinfo)
{
GC_INIT(ctx);
- char *dompath, *nicpath, *libxl_path;
+ char *nicpath, *libxl_path;
char *val;
int rc;
- 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 = libxl__domain_device_frontend_path(gc, domid, nicinfo->devid,
+ LIBXL__DEVICE_KIND_VIF);
+ libxl_path = libxl__domain_device_libxl_path(gc, domid, nicinfo->devid,
+ LIBXL__DEVICE_KIND_VIF);
nicinfo->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path), NULL);
if (!nicinfo->backend) {
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)
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 = libxl__domain_device_backend_path(gc, 0, domid, 0,
+ LIBXL__DEVICE_KIND_PCI);
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);
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 = libxl__domain_device_backend_path(gc, 0, domid, 0,
+ LIBXL__DEVICE_KIND_PCI);
num_devs_path = GCSPRINTF("%s/num_devs", be_path);
num_devs = libxl__xs_read(gc, XBT_NULL, num_devs_path);
if (!num_devs)
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 ) {
*num = 0;
- be_path = GCSPRINTF("%s/backend/pci/%d/0", libxl__xs_get_dompath(gc, 0), domid);
+ be_path = libxl__domain_device_backend_path(gc, 0, domid, 0,
+ LIBXL__DEVICE_KIND_PCI);
num_devs = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/num_devs", be_path));
if (!num_devs)
goto out;
#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:
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 = libxl__domain_device_libxl_path(gc, domid, usbctrl->devid,
+ LIBXL__DEVICE_KIND_VUSB);
be_path = vusb_be_from_xs_libxl_type(gc, libxl_path, usbctrl->type);
for (;;) {
*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) {
libxl_usbctrlinfo *usbctrlinfo)
{
GC_INIT(ctx);
- const char *dompath, *fe_path, *be_path, *tmp;
- const char *libxl_dom_path, *libxl_path;
+ const char *fe_path, *be_path, *tmp;
+ const char *libxl_path;
int rc;
usbctrlinfo->devid = usbctrl->devid;
tmp ? atoi(tmp) : -1; \
})
- libxl_dom_path = libxl__xs_libxl_path(gc, domid);
- libxl_path = GCSPRINTF("%s/device/vusb/%d", libxl_dom_path, usbctrl->devid);
+ libxl_path = libxl__domain_device_libxl_path(gc, domid, usbctrl->devid,
+ LIBXL__DEVICE_KIND_VUSB);
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 = libxl__domain_device_frontend_path(gc, domid, usbctrl->devid,
+ LIBXL__DEVICE_KIND_VUSB);
be_path = READ_SUBPATH(libxl_path, "backend");
usbctrlinfo->backend = libxl__strdup(NOGC, be_path);
rc = libxl__backendpath_parse_domid(gc, be_path,
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);
*usbdevs = NULL;
*num = 0;
- libxl_path = GCSPRINTF("%s/device/vusb/%d",
- libxl__xs_libxl_path(gc, domid), usbctrl);
+ libxl_path = libxl__domain_device_libxl_path(gc, domid, usbctrl,
+ LIBXL__DEVICE_KIND_VUSB);
be_path = vusb_be_from_xs_libxl(gc, libxl_path);
if (!be_path) {
*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++) {
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),
/* A controller was specified; look it up */
const char *libxl_path, *be_path, *tmp;
- libxl_path = GCSPRINTF("%s/device/vusb/%d",
- libxl__xs_libxl_path(gc, domid),
- usbdev->ctrl);
+ libxl_path = libxl__domain_device_libxl_path(gc, domid, usbdev->ctrl,
+ LIBXL__DEVICE_KIND_VUSB);
be_path = vusb_be_from_xs_libxl(gc, libxl_path);
if (!be_path) {
libxl_device_usbdev *usbdev)
{
GC_INIT(ctx);
- const char *libxl_dom_path, *libxl_path, *be_path, *busid;
+ const char *libxl_path, *be_path, *busid;
int rc;
- libxl_dom_path = libxl__xs_libxl_path(gc, domid);
-
- libxl_path = GCSPRINTF("%s/device/vusb/%d", libxl_dom_path, ctrl);
+ libxl_path = libxl__domain_device_libxl_path(gc, domid, ctrl,
+ LIBXL__DEVICE_KIND_VUSB);
be_path = vusb_be_from_xs_libxl(gc, libxl_path);
if (!be_path) {
rc = ERROR_FAIL;
#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:
libxl_vdisplinfo *info)
{
GC_INIT(ctx);
- char *libxl_path, *dompath, *devpath;
+ char *libxl_path, *devpath;
char *val;
int rc;
libxl_vdisplinfo_init(info);
- 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",
- libxl__xs_libxl_path(gc, domid),
- info->devid);
+ devpath = libxl__domain_device_frontend_path(gc, domid, info->devid,
+ LIBXL__DEVICE_KIND_VDISPL);
+ libxl_path = libxl__domain_device_libxl_path(gc, domid, info->devid,
+ LIBXL__DEVICE_KIND_VDISPL);
+
info->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path),
NULL);
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)
libxl_vtpminfo *vtpminfo)
{
GC_INIT(ctx);
- char *libxl_path, *dompath, *vtpmpath;
+ char *libxl_path, *vtpmpath;
char *val;
int rc = 0;
libxl_vtpminfo_init(vtpminfo);
- 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 = libxl__domain_device_frontend_path(gc, domid, vtpminfo->devid,
+ LIBXL__DEVICE_KIND_VTPM);
+ libxl_path = libxl__domain_device_libxl_path(gc, domid, vtpminfo->devid,
+ LIBXL__DEVICE_KIND_VTPM);
vtpminfo->backend = xs_read(ctx->xsh, XBT_NULL,
GCSPRINTF("%s/backend", libxl_path), NULL);
if (!vtpminfo->backend) {
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)