From nobody Wed Feb 5 14:48:37 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1737017065; cv=none; d=zohomail.com; s=zohoarc; b=hvIbcyhMlH56uwS+JKG7piqHSPBupCliSEUi6Vxda9HGqWoy8ztvrGqgs33+IO++y+pGvXVz/ArkxbEcVV8TK31C/ce1cEHP7VGXtsVuDddE5cgpfXNVt6GSBH6X6jMCJgA7KBFGK4cei4FLfXa8Unk3wvr+HjY1rCXmkBpt2jk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737017065; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9nRlgfR/HkbXdsVZN1RJ5s3wIYDMgIRx7AVyt9JqyRI=; b=lhqKFLKrnOpypb28O35BJ4BoGk6VIXZ16RaoiguiHIip4E7FNgnIbKjCxorvcvhV7ZBpR/8zBj/TZhwEEI0wcIVVNHkIrCkmNqShPbUJe7sLRuvTz+IEUviOMTFz7ODKW7u6n0IIK8SFM0aoxc4TORRgp/g+yBVVzrR1sboezgA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1737017065812173.95689798325077; Thu, 16 Jan 2025 00:44:25 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.873235.1284184 (Exim 4.92) (envelope-from ) id 1tYLTk-0004FA-DG; Thu, 16 Jan 2025 08:43:52 +0000 Received: by outflank-mailman (output) from mailman id 873235.1284184; Thu, 16 Jan 2025 08:43:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYLTk-0004E3-4P; Thu, 16 Jan 2025 08:43:52 +0000 Received: by outflank-mailman (input) for mailman id 873235; Thu, 16 Jan 2025 08:43:50 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tYLTi-0004BI-7o for xen-devel@lists.xenproject.org; Thu, 16 Jan 2025 08:43:50 +0000 Received: from casper.infradead.org (casper.infradead.org [2001:8b0:10b:1236::1]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ff9ddd88-d3e5-11ef-a0e2-8be0dac302b0; Thu, 16 Jan 2025 09:43:46 +0100 (CET) Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by casper.infradead.org with esmtpsa (Exim 4.98 #2 (Red Hat Linux)) id 1tYLTc-0000000AkbM-452f; Thu, 16 Jan 2025 08:43:45 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tYLTc-00000007pHw-2j0P; Thu, 16 Jan 2025 08:43:44 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list X-Inumbo-ID: ff9ddd88-d3e5-11ef-a0e2-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description; bh=9nRlgfR/HkbXdsVZN1RJ5s3wIYDMgIRx7AVyt9JqyRI=; b=GV4GsiKfcPaha4Yfg/SPTwsYVB VXyP5feW8Uhc+l6Y1k5Sx/MHGVdLm4y7dVanuxoy+bz9LmSQ4o1b1F/FZ2Proo9odrcvD7p2BBiDU D7owT//iz7tqe9F3dxW+m19/t/cDaJzaIm/92hrv5dsFy86rW+1kOkVWDTC9VOds/TgE7exako0lU hckl7d9vFnB73icw7IWpAMAcZRVFVXhd4+HgEvfYTGLfzdjkZ1QNwAFrEHcnfOAi9/ILYoM/JPQ/+ Cet8xQcgTObu1BR7oNJwHrk9qF8pLPegEQQ/yVbXMjO/dGU45nDyBpueNecte2Z5oAWRkkUcA6t+o cHxn96pw==; From: David Woodhouse To: Stefan Hajnoczi , qemu-devel@nongnu.org Cc: Stefano Stabellini , Anthony PERARD , Paul Durrant , "Edgar E. Iglesias" , Kevin Wolf , Hanna Reitz , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , Jason Wang , xen-devel@lists.xenproject.org, qemu-block@nongnu.org, Phil Dennis-Jordan , David Woodhouse , Anthony PERARD , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PULL 4/8] hw/xen: Use xs_node_read() from xen_console_get_name() Date: Thu, 16 Jan 2025 08:43:28 +0000 Message-ID: <20250116084332.1864967-5-dwmw2@infradead.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250116084332.1864967-1-dwmw2@infradead.org> References: <20250116084332.1864967-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html X-ZohoMail-DKIM: pass (identity @infradead.org) X-ZM-MESSAGEID: 1737017067797019000 From: David Woodhouse Now that xs_node_read() can construct a node path, no need to open-code it. Signed-off-by: David Woodhouse Reviewed-by: Anthony PERARD Acked-by: Roger Pau Monn=C3=A9 --- hw/char/xen_console.c | 18 +++++++++--------- 1 file 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) =20 if (con->dev =3D=3D -1) { XenBus *xenbus =3D XEN_BUS(qdev_get_parent_bus(DEVICE(xendev))); - char fe_path[XENSTORE_ABS_PATH_MAX + 1]; int idx =3D (xen_mode =3D=3D XEN_EMULATE) ? 0 : 1; + Error *local_err =3D NULL; char *value; =20 /* Theoretically we could go up to INT_MAX here but that's overkil= l */ while (idx < 100) { if (!idx) { - snprintf(fe_path, sizeof(fe_path), - "/local/domain/%u/console", xendev->frontend_id); + value =3D 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 =3D xs_node_read(xenbus->xsh, XBT_NULL, NULL, &local= _err, + "/local/domain/%u/device/console/%u", + xendev->frontend_id, idx); } - value =3D qemu_xen_xs_read(xenbus->xsh, XBT_NULL, fe_path, NUL= L); if (!value) { if (errno =3D=3D ENOENT) { con->dev =3D 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); --=20 2.47.0