summary refs log tree commit diff stats
path: root/hw/char/xen_console.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw@amazon.co.uk>2025-01-10 09:07:16 +0000
committerDavid Woodhouse <dwmw@amazon.co.uk>2025-01-15 17:07:25 +0000
commitb34729aca2f18a7c277bd2903b932add21cf7796 (patch)
tree26e08662c2a074c5334a75c03cd3b89ecea79a51 /hw/char/xen_console.c
parent76f26e46ac577421e148adcedabfa12d4200ff3e (diff)
downloadfocaccia-qemu-b34729aca2f18a7c277bd2903b932add21cf7796.tar.gz
focaccia-qemu-b34729aca2f18a7c277bd2903b932add21cf7796.zip
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>
Diffstat (limited to 'hw/char/xen_console.c')
-rw-r--r--hw/char/xen_console.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c
index cb39b21504..e61902461b 100644
--- a/hw/char/xen_console.c
+++ b/hw/char/xen_console.c
@@ -367,28 +367,28 @@ static char *xen_console_get_name(XenDevice *xendev, Error **errp)
 
     if (con->dev == -1) {
         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;
+        Error *local_err = NULL;
         char *value;
 
         /* Theoretically we could go up to INT_MAX here but that's overkill */
         while (idx < 100) {
             if (!idx) {
-                snprintf(fe_path, sizeof(fe_path),
-                         "/local/domain/%u/console", xendev->frontend_id);
+                value = xs_node_read(xenbus->xsh, XBT_NULL, NULL, &local_err,
+                                     "/local/domain/%u/console",
+                                     xendev->frontend_id);
             } else {
-                snprintf(fe_path, sizeof(fe_path),
-                         "/local/domain/%u/device/console/%u",
-                         xendev->frontend_id, idx);
+                value = xs_node_read(xenbus->xsh, XBT_NULL, NULL, &local_err,
+                                     "/local/domain/%u/device/console/%u",
+                                     xendev->frontend_id, idx);
             }
-            value = qemu_xen_xs_read(xenbus->xsh, XBT_NULL, fe_path, NULL);
             if (!value) {
                 if (errno == ENOENT) {
                     con->dev = idx;
+                    error_free(local_err);
                     goto found;
                 }
-                error_setg(errp, "cannot read %s: %s", fe_path,
-                           strerror(errno));
+                error_propagate(errp, local_err);
                 return NULL;
             }
             free(value);