mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 18:44:58 -06:00
hw/xen: Use xs_node_read() from xen_console_get_name()
Now that xs_node_read() can construct a node path, no need to open-code it. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Reviewed-by: Anthony PERARD <anthony.perard@vates.tech> Acked-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
parent
76f26e46ac
commit
b34729aca2
1 changed files with 9 additions and 9 deletions
|
@ -367,28 +367,28 @@ static char *xen_console_get_name(XenDevice *xendev, Error **errp)
|
||||||
|
|
||||||
if (con->dev == -1) {
|
if (con->dev == -1) {
|
||||||
XenBus *xenbus = XEN_BUS(qdev_get_parent_bus(DEVICE(xendev)));
|
XenBus *xenbus = XEN_BUS(qdev_get_parent_bus(DEVICE(xendev)));
|
||||||
char fe_path[XENSTORE_ABS_PATH_MAX + 1];
|
|
||||||
int idx = (xen_mode == XEN_EMULATE) ? 0 : 1;
|
int idx = (xen_mode == XEN_EMULATE) ? 0 : 1;
|
||||||
|
Error *local_err = NULL;
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
/* Theoretically we could go up to INT_MAX here but that's overkill */
|
/* Theoretically we could go up to INT_MAX here but that's overkill */
|
||||||
while (idx < 100) {
|
while (idx < 100) {
|
||||||
if (!idx) {
|
if (!idx) {
|
||||||
snprintf(fe_path, sizeof(fe_path),
|
value = xs_node_read(xenbus->xsh, XBT_NULL, NULL, &local_err,
|
||||||
"/local/domain/%u/console", xendev->frontend_id);
|
"/local/domain/%u/console",
|
||||||
|
xendev->frontend_id);
|
||||||
} else {
|
} else {
|
||||||
snprintf(fe_path, sizeof(fe_path),
|
value = xs_node_read(xenbus->xsh, XBT_NULL, NULL, &local_err,
|
||||||
"/local/domain/%u/device/console/%u",
|
"/local/domain/%u/device/console/%u",
|
||||||
xendev->frontend_id, idx);
|
xendev->frontend_id, idx);
|
||||||
}
|
}
|
||||||
value = qemu_xen_xs_read(xenbus->xsh, XBT_NULL, fe_path, NULL);
|
|
||||||
if (!value) {
|
if (!value) {
|
||||||
if (errno == ENOENT) {
|
if (errno == ENOENT) {
|
||||||
con->dev = idx;
|
con->dev = idx;
|
||||||
|
error_free(local_err);
|
||||||
goto found;
|
goto found;
|
||||||
}
|
}
|
||||||
error_setg(errp, "cannot read %s: %s", fe_path,
|
error_propagate(errp, local_err);
|
||||||
strerror(errno));
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
free(value);
|
free(value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue