From patchwork Mon Jul 15 08:21:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 13733047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F0A29C2BD09 for ; Mon, 15 Jul 2024 08:08:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTGjN-00022v-8d; Mon, 15 Jul 2024 04:06:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGjI-0001xB-Cc; Mon, 15 Jul 2024 04:06:41 -0400 Received: from mgamail.intel.com ([192.198.163.8]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGjD-00044A-9p; Mon, 15 Jul 2024 04:06:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721030795; x=1752566795; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7YV0Vz0c/N4ySWCieuwbaL0Lj+whTDjZLEl2lUjUcMU=; b=JVkPcinJdy+kNu4a2RGqLZ9BHZ4Nt/tRED9nBSkx7BPIy05hUZpKSlm6 p/3jCNVJ2k51uv/SD86qtF2qec45og8xow2O4U/N3WTFiwPmkrTetLbdc xJpEOmenNInIjEYzHs7P6ubpZDlnvxFecOI93cITc97fdcF1H2+ULZXE+ GHS2BQfC847AxvyVt/FO0UvaJkKwEGA5Fw6CDuSwFa1rdROFij+ehsqRz zSVyFdHf9ft0ff3paN6qCo7NV19yHqB5qBYWhApIa3sW3y8C8VcjKyM44 9pDwZfkzR3nLhSyB/79IJBn42i2aUTAeS6okeSckSOtyNPBvU/nUOc66C g==; X-CSE-ConnectionGUID: 5lxK2CWiSw+MCdp7xTF3mQ== X-CSE-MsgGUID: E175ywqMRQCakc/Y74qoqw== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35935629" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35935629" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2024 01:06:33 -0700 X-CSE-ConnectionGUID: /ONSoJKQQfqkKewi6bxDHg== X-CSE-MsgGUID: 61QyDX41Tuy+dgqopHQDig== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="49512573" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa009.fm.intel.com with ESMTP; 15 Jul 2024 01:06:30 -0700 From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Zhao Liu , Paolo Bonzini , Richard Henderson , Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum Subject: [PATCH 1/7] hw/i386/sgx: Get rid of qemu_open_old() Date: Mon, 15 Jul 2024 16:21:49 +0800 Message-Id: <20240715082155.28771-2-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715082155.28771-1-zhao1.liu@intel.com> References: <20240715082155.28771-1-zhao1.liu@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.198.163.8; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org For qemu_open_old(), osdep.h said: > Don't introduce new usage of this function, prefer the following > qemu_open/qemu_create that take an "Error **errp". So replace qemu_open_old() with qemu_open(). And considering the SGX enablement description is useful, convert it into a error message hint. Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: "Michael S. Tsirkin" Cc: Marcel Apfelbaum Signed-off-by: Zhao Liu --- hw/i386/sgx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index de76397bcfb3..a14a84bc6f69 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -157,10 +157,12 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp) { SGXInfo *info = NULL; uint32_t eax, ebx, ecx, edx; + Error *local_err = NULL; - int fd = qemu_open_old("/dev/sgx_vepc", O_RDWR); + int fd = qemu_open("/dev/sgx_vepc", O_RDWR, &local_err); if (fd < 0) { - error_setg(errp, "SGX is not enabled in KVM"); + error_append_hint(&local_err, "SGX is not enabled in KVM"); + error_propagate(errp, local_err); return NULL; } From patchwork Mon Jul 15 08:21:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 13733051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 411C4C3DA4A for ; Mon, 15 Jul 2024 08:08:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTGjg-0002VG-Cb; Mon, 15 Jul 2024 04:07:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGjd-0002SS-Cs; Mon, 15 Jul 2024 04:07:01 -0400 Received: from mgamail.intel.com ([192.198.163.8]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGja-00047o-QE; Mon, 15 Jul 2024 04:07:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721030819; x=1752566819; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cr4JZh2ySHCLoxlwCyTJncZxcFpDBYjniajzxyU5f7w=; b=X65XGRPwa3e72+NIh9GKlcmQ1Nt04zWpRH/ZdS0pDvytslJaS0yJwUo3 Rqq82GPwVzLJ8fZ570WYOlzudSDibomrKVUVI27HtEvnh+zkVmfh20AkP fYZrfQH5AdXj97FiMNTyPAnfER+n55OV8C39avBKaxBcHW6sJ3AVu/gso P3r/zTkBuiqs4Eee1s6OG45truttfAXBgvNOqKmIzpScv35LieG8TRaEW 7eqQS341CfNb0R7G7IFds7SC1wMk13Zg+Rhs4yQwrepvoy3fG4C89tFpG AudTGtB9ijSIp6u/2XTV6he3GqCvXbjEFfj/L3K+6Hm+VRhUlDpAU35GS A==; X-CSE-ConnectionGUID: 3pRdSiAuQr2tHeqKj2Ei/w== X-CSE-MsgGUID: EZ+sMNkDTqSzMK6Ec+EpZA== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35935645" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35935645" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2024 01:06:36 -0700 X-CSE-ConnectionGUID: 98Xu5bW2SkmFPUCdK1+h/w== X-CSE-MsgGUID: aO1aHOwzTyKIcfBKFXYx6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="49512580" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa009.fm.intel.com with ESMTP; 15 Jul 2024 01:06:33 -0700 From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 2/7] hw/usb/host-libusb: Get rid of qemu_open_old() Date: Mon, 15 Jul 2024 16:21:50 +0800 Message-Id: <20240715082155.28771-3-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715082155.28771-1-zhao1.liu@intel.com> References: <20240715082155.28771-1-zhao1.liu@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.198.163.8; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org For qemu_open_old(), osdep.h said: > Don't introduce new usage of this function, prefer the following > qemu_open/qemu_create that take an "Error **errp". So replace qemu_open_old() with qemu_open(). Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé --- hw/usb/host-libusb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index 80122b41259a..691bc881fbcd 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -1212,9 +1212,8 @@ static void usb_host_realize(USBDevice *udev, Error **errp) if (s->hostdevice) { int fd; s->needs_autoscan = false; - fd = qemu_open_old(s->hostdevice, O_RDWR); + fd = qemu_open(s->hostdevice, O_RDWR, errp); if (fd < 0) { - error_setg_errno(errp, errno, "failed to open %s", s->hostdevice); return; } rc = usb_host_open(s, NULL, fd); From patchwork Mon Jul 15 08:21:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 13733054 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8671AC3DA45 for ; Mon, 15 Jul 2024 08:08:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTGjt-00037p-Ij; Mon, 15 Jul 2024 04:07:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGjq-0002tT-8J; Mon, 15 Jul 2024 04:07:15 -0400 Received: from mgamail.intel.com ([192.198.163.8]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGjb-000480-7J; Mon, 15 Jul 2024 04:07:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721030819; x=1752566819; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HrFJ7iXMOj+koRtwzVVA42PVliIsg/v/+/zhFzszICU=; b=BT5wFazLX2Bp5AszeQn+v2HUGZUhXvQVh+VAIwWl9hcVIPEwx74slhv3 eX4h+MgDZmPMIEvnPSBZ+bO0UDT0qN41MzVKWNV5GtaI0IPiZjFZvsQqZ NJWprRRMYhfn3broxQj8xMFYPnX0gQCIXn27JTGgRMoopbjjjIxBuDP4F wWVuMbYBQL10Lzjza/1BX7kdz4Oy/8XZAkkdTyh4/PILzE+QBQ0EgqVAh r4lgak2kJw/jb7Cp+oKidBMHGcEILc4M2OYx+Q5VRIgQ2SXZxlgHDjJB4 ysbLB/YzUFzRkzut3ZMw7WcVQGWslfo91HzdDSkbebjcvdJK3iuy3io/Q Q==; X-CSE-ConnectionGUID: uWaEtX05TDib9hr+TmCWrA== X-CSE-MsgGUID: R3YOPtvdSne89wOGUTDwsA== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35935657" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35935657" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2024 01:06:38 -0700 X-CSE-ConnectionGUID: k3q6YKbDQQSt3G/wXp0Sow== X-CSE-MsgGUID: Ar3bYWEbR1OycwaGZSU/lA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="49512585" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa009.fm.intel.com with ESMTP; 15 Jul 2024 01:06:35 -0700 From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Zhao Liu Subject: [PATCH 3/7] hw/usb/u2f-passthru: Get rid of qemu_open_old() Date: Mon, 15 Jul 2024 16:21:51 +0800 Message-Id: <20240715082155.28771-4-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715082155.28771-1-zhao1.liu@intel.com> References: <20240715082155.28771-1-zhao1.liu@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.198.163.8; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org For qemu_open_old(), osdep.h said: > Don't introduce new usage of this function, prefer the following > qemu_open/qemu_create that take an "Error **errp". So replace qemu_open_old() with qemu_open(). Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé --- hw/usb/u2f-passthru.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/usb/u2f-passthru.c b/hw/usb/u2f-passthru.c index b7025d303d07..c4a783d12864 100644 --- a/hw/usb/u2f-passthru.c +++ b/hw/usb/u2f-passthru.c @@ -482,10 +482,8 @@ static void u2f_passthru_realize(U2FKeyState *base, Error **errp) return; #endif } else { - fd = qemu_open_old(key->hidraw, O_RDWR); + fd = qemu_open(key->hidraw, O_RDWR, errp); if (fd < 0) { - error_setg(errp, "%s: Failed to open %s", TYPE_U2F_PASSTHRU, - key->hidraw); return; } From patchwork Mon Jul 15 08:21:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 13733049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 446B5C3DA50 for ; Mon, 15 Jul 2024 08:08:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTGju-0003BE-HL; Mon, 15 Jul 2024 04:07:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGjr-0002zt-Ve; Mon, 15 Jul 2024 04:07:15 -0400 Received: from mgamail.intel.com ([192.198.163.8]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGje-00047o-F9; Mon, 15 Jul 2024 04:07:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721030823; x=1752566823; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RoxEAFvBU5+co7FmGTVK5jcrRDDIG8H4tO5qqtRbR/E=; b=Wk4H1Pqx70/XgCfcrto4U/fja5o1M/wpFRHgNkb8g6Pa0l5AHzkNIvxY NmUZrZdiu9+H0unYWIZTOzDNgfWCZCNEdlZcr90v1GCyDM7FGmosCF4M9 7KbvVpV+qKT8DkjtNZDA+/i5jrgYHR/F4leSKiV9KdYaIVqYWPxoqRFEy ouTjnuSEdVJzn4CFrPFivRRL5EyyD90uFsiBmzu1vhj5ihcheTbqOQevo kIkwZ+z6cIwYvWoIVyTYZdEx9yVqVDMBC+35wF4J1QXoKm/XnT69wotiF hjV8iAB/xqkKMhj2S0etHOp54q92ra2AX1Z+zkvgKV8gBKH9RP25aKwfX g==; X-CSE-ConnectionGUID: W52Pe4r3ToGkiUy6A62JXw== X-CSE-MsgGUID: ofT8bXUYTmC9rXXgdWs32Q== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35935662" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35935662" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2024 01:06:41 -0700 X-CSE-ConnectionGUID: tGq/A5TPS++20uYbEXwzJQ== X-CSE-MsgGUID: EeHdx6fcQkKDznH5VelWjg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="49512588" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa009.fm.intel.com with ESMTP; 15 Jul 2024 01:06:38 -0700 From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Zhao Liu , Alex Williamson , =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PATCH 4/7] hw/vfio/container: Get rid of qemu_open_old() Date: Mon, 15 Jul 2024 16:21:52 +0800 Message-Id: <20240715082155.28771-5-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715082155.28771-1-zhao1.liu@intel.com> References: <20240715082155.28771-1-zhao1.liu@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.198.163.8; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org For qemu_open_old(), osdep.h said: > Don't introduce new usage of this function, prefer the following > qemu_open/qemu_create that take an "Error **errp". So replace qemu_open_old() with qemu_open(). Cc: Alex Williamson Cc: "Cédric Le Goater" Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater --- hw/vfio/container.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/vfio/container.c b/hw/vfio/container.c index 425db1a14c07..38a9df34964a 100644 --- a/hw/vfio/container.c +++ b/hw/vfio/container.c @@ -600,9 +600,8 @@ static bool vfio_connect_container(VFIOGroup *group, AddressSpace *as, } } - fd = qemu_open_old("/dev/vfio/vfio", O_RDWR); + fd = qemu_open("/dev/vfio/vfio", O_RDWR, errp); if (fd < 0) { - error_setg_errno(errp, errno, "failed to open /dev/vfio/vfio"); goto put_space_exit; } @@ -743,9 +742,8 @@ static VFIOGroup *vfio_get_group(int groupid, AddressSpace *as, Error **errp) group = g_malloc0(sizeof(*group)); snprintf(path, sizeof(path), "/dev/vfio/%d", groupid); - group->fd = qemu_open_old(path, O_RDWR); + group->fd = qemu_open(path, O_RDWR, errp); if (group->fd < 0) { - error_setg_errno(errp, errno, "failed to open %s", path); goto free_group_exit; } From patchwork Mon Jul 15 08:21:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 13733052 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E9AEC2BD09 for ; Mon, 15 Jul 2024 08:08:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTGk0-0003Uq-AT; Mon, 15 Jul 2024 04:07:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGjs-0002zz-0Q; Mon, 15 Jul 2024 04:07:16 -0400 Received: from mgamail.intel.com ([192.198.163.8]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGjf-00048k-7H; Mon, 15 Jul 2024 04:07:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721030823; x=1752566823; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YCLpBmWyjqRhCjA5if9DiWPaQGLwQuPCOoB+ZMle+lg=; b=eUiwbEVkEttximvioDk5HKPZ181bDzrQy9u9XiA+WFyk8ZMMyJ/MKmJc fizEYwsoGrW7WApDE7tpE2CJ7hLmWwmsLt2t+xab4abwhMThxgy8pxhYW sKXMANU+qTw1qQcg2qNKSYYtkZ3lTwrQCvPZrs5ydy2OL64lbwbqoCjvj JjmzYWtk3uQCqW+wdRevuf3bNiuNIjrgABvQal1FfpN8FotlENu3QTGB1 x35G2MQbFkQrV9APVdH69drHqw1KTAn1t6BkRu3Bf6UVsL95vnp2TEgkz mOwjJyXN2NBaFBOrX7gMFyg/Ph8AhUp8BHNeU72mzxaX+sMJ4A561ObaD A==; X-CSE-ConnectionGUID: 7FIRPCbBRKGHK0FUk60cyQ== X-CSE-MsgGUID: lewdhUpdQAmWexGF2y0ZnA== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35935677" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35935677" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2024 01:06:43 -0700 X-CSE-ConnectionGUID: 8UsliN5GRZm4uaQMhPB0zQ== X-CSE-MsgGUID: UZm0wjTYSNCAuQKMMZKugw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="49512591" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa009.fm.intel.com with ESMTP; 15 Jul 2024 01:06:40 -0700 From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Zhao Liu , David Hildenbrand , Igor Mammedov Subject: [PATCH 5/7] backends/hostmem-epc: Get rid of qemu_open_old() Date: Mon, 15 Jul 2024 16:21:53 +0800 Message-Id: <20240715082155.28771-6-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715082155.28771-1-zhao1.liu@intel.com> References: <20240715082155.28771-1-zhao1.liu@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.198.163.8; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org For qemu_open_old(), osdep.h said: > Don't introduce new usage of this function, prefer the following > qemu_open/qemu_create that take an "Error **errp". So replace qemu_open_old() with qemu_open(). Cc: David Hildenbrand Cc: Igor Mammedov Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Igor Mammedov --- backends/hostmem-epc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/backends/hostmem-epc.c b/backends/hostmem-epc.c index f58fcf00a10b..6c024d6217d2 100644 --- a/backends/hostmem-epc.c +++ b/backends/hostmem-epc.c @@ -29,10 +29,8 @@ sgx_epc_backend_memory_alloc(HostMemoryBackend *backend, Error **errp) return false; } - fd = qemu_open_old("/dev/sgx_vepc", O_RDWR); + fd = qemu_open("/dev/sgx_vepc", O_RDWR, errp); if (fd < 0) { - error_setg_errno(errp, errno, - "failed to open /dev/sgx_vepc to alloc SGX EPC"); return false; } From patchwork Mon Jul 15 08:21:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 13733050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81E21C3DA52 for ; Mon, 15 Jul 2024 08:08:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTGjw-0003KH-OI; Mon, 15 Jul 2024 04:07:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGju-0003AU-6p; Mon, 15 Jul 2024 04:07:18 -0400 Received: from mgamail.intel.com ([192.198.163.8]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGjr-000480-Aw; Mon, 15 Jul 2024 04:07:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721030835; x=1752566835; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZVM8m5lTvskYcDVaIB47aX485qUonoxl/4+eSxCJAec=; b=WkGlAoSjdA3J+kRXcgzhy3X8DGEhLRjtBiUOEQhUXwsIMmeCDXIHJb+4 +M/ea4Ek4Q7SILRWizz6rc8qAsk4BYLJ/ec+D3vXtJ6Ee83rzK6omNpBI yUES8USsLFsjWxtz6xI0pZYDXpGey8mMKYm+jlfci+gn+IJEI/YH7aUUx s+n4dkHvl/4TFmNIz/Kl3WQA156KWSxUrMjSMWFcekCmv82neF3UayYik sJ3+VkqLDx8mqdbHKxsDNMi2EFkIm0LZPfvqvCuv8z4vhxkexrmALsx6W cP8jentPrURFUGFfFUT/X+KPXbFevJkFy7WzY6ynRgiGUT9f1phFgspIO w==; X-CSE-ConnectionGUID: tX4jCJXvRKSqI8kVraRB+g== X-CSE-MsgGUID: 65SU5QyLREWZph4bv/EyHQ== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35935684" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35935684" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2024 01:06:46 -0700 X-CSE-ConnectionGUID: YlH62MMRRxiJ14Hvk5ZgqA== X-CSE-MsgGUID: esDv1OQKSPW76zLsMkw5Fw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="49512596" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa009.fm.intel.com with ESMTP; 15 Jul 2024 01:06:43 -0700 From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Zhao Liu , Yi Liu , Eric Auger , Zhenzhong Duan Subject: [PATCH 6/7] backends/iommufd: Get rid of qemu_open_old() Date: Mon, 15 Jul 2024 16:21:54 +0800 Message-Id: <20240715082155.28771-7-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715082155.28771-1-zhao1.liu@intel.com> References: <20240715082155.28771-1-zhao1.liu@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.198.163.8; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org For qemu_open_old(), osdep.h said: > Don't introduce new usage of this function, prefer the following > qemu_open/qemu_create that take an "Error **errp". So replace qemu_open_old() with qemu_open(). Cc: Yi Liu Cc: Eric Auger Cc: Zhenzhong Duan Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Yi Liu --- backends/iommufd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/backends/iommufd.c b/backends/iommufd.c index 84fefbc9ee7a..cabd1b50025d 100644 --- a/backends/iommufd.c +++ b/backends/iommufd.c @@ -77,9 +77,8 @@ bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp) int fd; if (be->owned && !be->users) { - fd = qemu_open_old("/dev/iommu", O_RDWR); + fd = qemu_open("/dev/iommu", O_RDWR, errp); if (fd < 0) { - error_setg_errno(errp, errno, "/dev/iommu opening failed"); return false; } be->fd = fd; From patchwork Mon Jul 15 08:21:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 13733053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B5C5C2BD09 for ; Mon, 15 Jul 2024 08:08:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sTGk3-0003mO-9c; Mon, 15 Jul 2024 04:07:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGjy-0003SX-Ke; Mon, 15 Jul 2024 04:07:23 -0400 Received: from mgamail.intel.com ([192.198.163.8]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sTGjv-00047o-UK; Mon, 15 Jul 2024 04:07:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721030840; x=1752566840; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AUweKSJwgobCBfsS0jl8OUFwzF71UTUB1h8wPvccVGE=; b=Ed/LFSUR98JZBOXPqgF+rWEHXU5JqjV9AJd3+sP5soadpNTChq0vGUg6 /NnRC9lZCDucxefQtH85e+pzG1bkdKvFHrihMK5bLT/usmMsf7frvEoqI dCX2aLCzZ0ZeVHHSz0WgmzgXjXTfSBcNqnrqh6tWNI5JDB1dSvlwS/pCM yyrtS0CkwQrJPIgF59BXuQLJoTH8VLWRmq0ZwUTtniiOlfSYMyVnjJpMq zhQvDa9o0HxuvYzO4JmsAnRL114m4yKCcWmxpRh0Q6BGwGsL9Fbez2vOr B+8F8lML/OOLbNqFZQfFSbb5OpiPO0YCqGzMrgbBMHlpbH23dZ8cu9369 w==; X-CSE-ConnectionGUID: R7RBiu2pS4e15JLVkKC29Q== X-CSE-MsgGUID: 7G2RSkDnSgOwTyvdXCtfRg== X-IronPort-AV: E=McAfee;i="6700,10204,11133"; a="35935689" X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="35935689" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2024 01:06:48 -0700 X-CSE-ConnectionGUID: HX7aRI4/Sr6AHG25S6Fugg== X-CSE-MsgGUID: e4veaGYOSp+tlQMQRI9OfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,209,1716274800"; d="scan'208";a="49512601" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa009.fm.intel.com with ESMTP; 15 Jul 2024 01:06:46 -0700 From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Zhao Liu , Laurent Vivier , Amit Shah Subject: [PATCH 7/7] backends/rng-random: Get rid of qemu_open_old() Date: Mon, 15 Jul 2024 16:21:55 +0800 Message-Id: <20240715082155.28771-8-zhao1.liu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240715082155.28771-1-zhao1.liu@intel.com> References: <20240715082155.28771-1-zhao1.liu@intel.com> MIME-Version: 1.0 Received-SPF: pass client-ip=192.198.163.8; envelope-from=zhao1.liu@intel.com; helo=mgamail.intel.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org For qemu_open_old(), osdep.h said: > Don't introduce new usage of this function, prefer the following > qemu_open/qemu_create that take an "Error **errp". So replace qemu_open_old() with qemu_open(). And considering rng_random_opened() will lose its obvious error handling case after removing error_setg_file_open(), add comment to remind here. Cc: Laurent Vivier Cc: Amit Shah Signed-off-by: Zhao Liu Reviewed-by: Philippe Mathieu-Daudé --- backends/rng-random.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backends/rng-random.c b/backends/rng-random.c index 80eb5be138ce..3cdb982533b5 100644 --- a/backends/rng-random.c +++ b/backends/rng-random.c @@ -75,10 +75,11 @@ static void rng_random_opened(RngBackend *b, Error **errp) error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "filename", "a valid filename"); } else { - s->fd = qemu_open_old(s->filename, O_RDONLY | O_NONBLOCK); - if (s->fd == -1) { - error_setg_file_open(errp, errno, s->filename); - } + /* + * Once the open fails, the error message is integrated into + * the *errp object by qemu_open(). + */ + s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK, errp); } }