From nobody Sun Dec 14 11:17:17 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; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1763727329; cv=none; d=zohomail.com; s=zohoarc; b=LyaEZ13GcDXNYtl/7GWH1ntwDGX8QbRTiiSQPg+LuyLVSFS4np2rFDQvdIDlc0+pGo2a2aquMW5zkoLT/rxxIXicS+q6YuPpLJ3PkNkJql8p7GggORYNOUxY0pf/cSQ+536N8T0L9NeUNfrLHxL5dq7g9jlxPUZ6/EiIJyXss8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1763727329; h=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=jq+qsu9NDrfjYMe8jH6z7ShPmZi4eWzdQ6ZA1QbTE4A=; b=dN1R2EbmdFbJGAH5jgEAhNK7yn8Fg7kbewOxbQEXpIXxYuOoQDmhRJyueQlZgYjYQsvDWPdpM1fPQevu1KjPTbqysVnTwgfKHtc84jLCC2LdMp8hBBQ7r5BaK7tGyl3VH6FGNGN+EtN+yZDNoWBKArFcnyGEjf+eBQCBIW3fZG4= 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; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 176372732953934.30920047848531; Fri, 21 Nov 2025 04:15:29 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1168992.1494898 (Exim 4.92) (envelope-from ) id 1vMQ2V-0002GH-Jj; Fri, 21 Nov 2025 12:14:59 +0000 Received: by outflank-mailman (output) from mailman id 1168992.1494898; Fri, 21 Nov 2025 12:14:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vMQ2V-0002Ek-Bh; Fri, 21 Nov 2025 12:14:59 +0000 Received: by outflank-mailman (input) for mailman id 1168992; Fri, 21 Nov 2025 12:14:57 +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 1vMQ2T-00010q-PQ for xen-devel@lists.xenproject.org; Fri, 21 Nov 2025 12:14:57 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b0329780-c6d3-11f0-9d18-b5c5bf9af7f9; Fri, 21 Nov 2025 13:14:55 +0100 (CET) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-33-xMZFCiGKODWbluovOjm9cg-1; Fri, 21 Nov 2025 07:14:50 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6738E1956080; Fri, 21 Nov 2025 12:14:46 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.45.242.3]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 976641940E8F; Fri, 21 Nov 2025 12:14:45 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 9B3D421E668C; Fri, 21 Nov 2025 13:14:38 +0100 (CET) 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 Sender: "Xen-devel" X-Inumbo-ID: b0329780-c6d3-11f0-9d18-b5c5bf9af7f9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763727294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jq+qsu9NDrfjYMe8jH6z7ShPmZi4eWzdQ6ZA1QbTE4A=; b=FH5wVs9IKIKVm0+sta350bxaULryvppnGNMqFMH0BCnEBgSklpuqB3MXk779f+YJ/Eerrm tBcHyW/7wHirywgyJFqN7DwPGXULYe6jYKxaFYEbcuSL5g/3aS10Zs4N1WvwxqF1BJe8tH yLR+psCf5c3P1ZV4y1DCrJNg5IJQIC4= X-MC-Unique: xMZFCiGKODWbluovOjm9cg-1 X-Mimecast-MFC-AGG-ID: xMZFCiGKODWbluovOjm9cg_1763727286 From: Markus Armbruster To: qemu-devel@nongnu.org Cc: arei.gonglei@huawei.com, zhenwei.pi@linux.dev, alistair.francis@wdc.com, stefanb@linux.vnet.ibm.com, kwolf@redhat.com, hreitz@redhat.com, sw@weilnetz.de, qemu_oss@crudebyte.com, groug@kaod.org, mst@redhat.com, imammedo@redhat.com, anisinha@redhat.com, kraxel@redhat.com, shentey@gmail.com, npiggin@gmail.com, harshpb@linux.ibm.com, sstabellini@kernel.org, anthony@xenproject.org, paul@xen.org, edgar.iglesias@gmail.com, elena.ufimtseva@oracle.com, jag.raman@oracle.com, sgarzare@redhat.com, pbonzini@redhat.com, fam@euphon.net, philmd@linaro.org, alex@shazbot.org, clg@redhat.com, peterx@redhat.com, farosas@suse.de, lizhijian@fujitsu.com, dave@treblig.org, jasowang@redhat.com, samuel.thibault@ens-lyon.org, michael.roth@amd.com, kkostiuk@redhat.com, zhao1.liu@intel.com, mtosatti@redhat.com, rathc@linux.ibm.com, palmer@dabbelt.com, liwei1518@gmail.com, dbarboza@ventanamicro.com, zhiwei_liu@linux.alibaba.com, marcandre.lureau@redhat.com, qemu-block@nongnu.org, qemu-ppc@nongnu.org, xen-devel@lists.xenproject.org, kvm@vger.kernel.org, qemu-riscv@nongnu.org Subject: [PATCH v2 05/15] qga: Use error_setg_file_open() for better error messages Date: Fri, 21 Nov 2025 13:14:28 +0100 Message-ID: <20251121121438.1249498-6-armbru@redhat.com> In-Reply-To: <20251121121438.1249498-1-armbru@redhat.com> References: <20251121121438.1249498-1-armbru@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1763727331333018900 Content-Type: text/plain; charset="utf-8" Error messages change from open("FNAME"): REASON to Could not open 'FNAME': REASON Signed-off-by: Markus Armbruster Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Kostiantyn Kostiuk Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- qga/commands-linux.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/qga/commands-linux.c b/qga/commands-linux.c index 4a09ddc760..5cf76ca2d9 100644 --- a/qga/commands-linux.c +++ b/qga/commands-linux.c @@ -1502,14 +1502,15 @@ static void transfer_vcpu(GuestLogicalProcessor *vc= pu, bool sys2vcpu, =20 dirfd =3D open(dirpath, O_RDONLY | O_DIRECTORY); if (dirfd =3D=3D -1) { - error_setg_errno(errp, errno, "open(\"%s\")", dirpath); + error_setg_file_open(errp, errno, dirpath); return; } =20 fd =3D openat(dirfd, fn, sys2vcpu ? O_RDONLY : O_RDWR); if (fd =3D=3D -1) { if (errno !=3D ENOENT) { - error_setg_errno(errp, errno, "open(\"%s/%s\")", dirpath, fn); + error_setg_errno(errp, errno, "could not open %s/%s", + dirpath, fn); } else if (sys2vcpu) { vcpu->online =3D true; vcpu->can_offline =3D false; @@ -1711,7 +1712,7 @@ static void transfer_memory_block(GuestMemoryBlock *m= em_blk, bool sys2memblk, dirfd =3D open(dirpath, O_RDONLY | O_DIRECTORY); if (dirfd =3D=3D -1) { if (sys2memblk) { - error_setg_errno(errp, errno, "open(\"%s\")", dirpath); + error_setg_file_open(errp, errno, dirpath); } else { if (errno =3D=3D ENOENT) { result->response =3D GUEST_MEMORY_BLOCK_RESPONSE_TYPE_NOT_= FOUND; @@ -1936,7 +1937,7 @@ static GuestDiskStatsInfoList *guest_get_diskstats(Er= ror **errp) =20 fp =3D fopen(diskstats, "r"); if (fp =3D=3D NULL) { - error_setg_errno(errp, errno, "open(\"%s\")", diskstats); + error_setg_file_open(errp, errno, diskstats); return NULL; } =20 @@ -2047,7 +2048,7 @@ GuestCpuStatsList *qmp_guest_get_cpustats(Error **err= p) =20 fp =3D fopen(cpustats, "r"); if (fp =3D=3D NULL) { - error_setg_errno(errp, errno, "open(\"%s\")", cpustats); + error_setg_file_open(errp, errno, cpustats); return NULL; } =20 --=20 2.49.0