From nobody Sun Nov 24 18:56:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721030893; cv=none; d=zohomail.com; s=zohoarc; b=KF4Wjeraje2OoeenMJxWa6Xx/mjJjc6RaMHBSePJ0mjT3Y9DHbUC+XGlwX5MzrzDLz0t6WYGCos0QCVwgNDOdzEG5soy1eBkyywOGsB4l0+vi+JmbDLFPUxTCmH75Or62lm1MlWq8VuryHSnNFLJbhjiodKe1t/fX7AjldjLQOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721030893; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qKLFjSFNhc5OLNCJ16Kdco3C9Qg9aYHjXUNGUWHSB+s=; b=eips/0J0PhBvtgGTs74kUUVRIvJcHyNIqDs6tkFpymq2lyo5C7ED0pI4f9NrZCqoQ4jAcJjRpAn+DG+J7rfVM1Fb4BlJaRPkcnqX8Xc2xzeT7a9M5ytOf4g3N7/5k+JoMgcFEXqNUHbp+oUXVhIkDLhapm12ZjLRcKzy8z37vfE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721030893593756.8818375727803; Mon, 15 Jul 2024 01:08:13 -0700 (PDT) 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 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 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 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" 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" From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?UTF-8?q?Philippe=20Mathieu-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721030894747116600 Content-Type: text/plain; charset="utf-8" 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 =3D NULL; uint32_t eax, ebx, ecx, edx; + Error *local_err =3D NULL; =20 - int fd =3D qemu_open_old("/dev/sgx_vepc", O_RDWR); + int fd =3D 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; } =20 --=20 2.34.1 From nobody Sun Nov 24 18:56:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721030893; cv=none; d=zohomail.com; s=zohoarc; b=W2B5WJ+e2mteA2vfhhPFEQ20AQu8jOI6o4MMeACon2M7s5KZjQ+kFjvFe40Q9T44ioy6YYeFHx1ZQ2E9Q3xIzSgcDHCGQdgsSPij3mdhJV1Grb/z0nZT8oFWS6DJ/PpO4M9zThPR43eZuNu0w8UCPDJ4u1rPX7h7+/sf0KaAytQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721030893; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ua/67R9QOTTlElNTTAMNwz0Gc1hUtKtdRcJIBNjA0XM=; b=UPA9LDC9463fNSZWlTg8OZySqjDu3qlPP/qm4oqcw8CMhGszEdkrvtHgenYtT21gqM438HtWNMKrJZ8vV908ptE4HiKN2Z+/UhAwL2+V4niCjx62csM0Qa7ICUiqTQqQrpc06XZluEQ3vXwGF4WEVMHjKVIK/q1hRcP20/wSsiM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721030893276641.063487278865; Mon, 15 Jul 2024 01:08:13 -0700 (PDT) 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 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 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 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" 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" From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?UTF-8?q?Philippe=20Mathieu-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721030894753116601 Content-Type: text/plain; charset="utf-8" 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=C3=A9 --- 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 =3D false; - fd =3D qemu_open_old(s->hostdevice, O_RDWR); + fd =3D qemu_open(s->hostdevice, O_RDWR, errp); if (fd < 0) { - error_setg_errno(errp, errno, "failed to open %s", s->hostdevi= ce); return; } rc =3D usb_host_open(s, NULL, fd); --=20 2.34.1 From nobody Sun Nov 24 18:56:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721030920; cv=none; d=zohomail.com; s=zohoarc; b=IDuQAGsdiREWSzixpSCX83FRJOODcUv8XKFwgjfbxrp3ORJ1lu6F933Xg7IuRYdbG5WAm2iWfaek0QAA95+w5HITOFlBO9+y6TLwX9ORZzpGzMHrrK1twX1BlV8a9V6zzwYG5lx8UhihG03mzJwwBT24TPGN/0WrTJ6dlRwnSW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721030920; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+SkbIkM90xYrz9iYfM3ba0R/Fk4gUKEPY7rpNjMbgx8=; b=RkldMBJwya2rX6J7uQof5DrGwpTUTsxrBcuS65Qa5niXZ77YTwEwCrRzwOYLhNS6SS4VRhkBv+IW5OJ/cu4KrOydiZgRZH5YPzoPCX5Zmc7pi9lhQRIrDQGJ7nKt28j3pBHB1XTg+WpcI375pQVhSPKVPrxm5/COzTYu6POWYmk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721030920679325.9561209944044; Mon, 15 Jul 2024 01:08:40 -0700 (PDT) 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 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 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 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" 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" From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?UTF-8?q?Philippe=20Mathieu-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721030922756116600 Content-Type: text/plain; charset="utf-8" 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=C3=A9 --- 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, Er= ror **errp) return; #endif } else { - fd =3D qemu_open_old(key->hidraw, O_RDWR); + fd =3D qemu_open(key->hidraw, O_RDWR, errp); if (fd < 0) { - error_setg(errp, "%s: Failed to open %s", TYPE_U2F_PASSTHRU, - key->hidraw); return; } =20 --=20 2.34.1 From nobody Sun Nov 24 18:56:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721030893; cv=none; d=zohomail.com; s=zohoarc; b=VpaNE5WM1irQLsr768pESWDzcISBgO+MCY/8t6ZNyTt0E/drlyOOmA8otv/Rfx98cJi9mrmQieODYsvp2UJI+/7koQVoewXcaqGrUoefLmh2j1NTIctnRPfrYsOfbDjwJP4j2Bs8k3YcOYgjHZNLIIn2vNP/ThTaJ7nhwnC3jgk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721030893; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IWHwHXJobqjT1rh9BKyDpmam1JSZGs+YkkoS7lRnS+g=; b=CL5BcwZhm23m6jTlSQzdcG4rqimuGoLfsCrVKowlsPRJIwn5qBRQWsmqwhitm2UzUKwJF4QrCl9fH8kFjlZNbuC/lewoQJfZc846eY879DVpVIFRyrUUTXzkAw0GuE01ZY0I7zsDoSV7o0X8GG2YVPtT6Hy2b261nKfsbE8udcI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721030893208412.92352554615945; Mon, 15 Jul 2024 01:08:13 -0700 (PDT) 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 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 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 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" 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" From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, qemu-devel@nongnu.org, Zhao Liu , Alex Williamson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721030894750116600 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=C3=A9dric Le Goater" Signed-off-by: Zhao Liu Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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, Ad= dressSpace *as, } } =20 - fd =3D qemu_open_old("/dev/vfio/vfio", O_RDWR); + fd =3D 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; } =20 @@ -743,9 +742,8 @@ static VFIOGroup *vfio_get_group(int groupid, AddressSp= ace *as, Error **errp) group =3D g_malloc0(sizeof(*group)); =20 snprintf(path, sizeof(path), "/dev/vfio/%d", groupid); - group->fd =3D qemu_open_old(path, O_RDWR); + group->fd =3D qemu_open(path, O_RDWR, errp); if (group->fd < 0) { - error_setg_errno(errp, errno, "failed to open %s", path); goto free_group_exit; } =20 --=20 2.34.1 From nobody Sun Nov 24 18:56:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721030897; cv=none; d=zohomail.com; s=zohoarc; b=SeufsVzYneyAVgytPc7sOae82NxTSvn6cPVJe6Fc4CS95cvgyCNebLtFjhzO4lhP++n3ZpsLS76hEv0si1lOERz0cvHnb83SiGgsC1dvhWK+Xr3xSPm/crG1w9jW7JKWQlaBBOqb/BIJoT3SZ0kq0kxX45ISeqnMQPggjgcbJVc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721030897; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HPlQbUPkLax17g314g9LxFOn7o7umlHpq0kEsFBQYjI=; b=Dyz3YtQc7LD9MzndD2tWABEVSfOTC1bXsEnhbUSI5eQNuXY270+3Z1QZ7gd7IMDVj40FxcbTat7giCvc1X4D9cMORRAkaV7AFvPe0k+sJwE3cyV6SzbH3RvaWj2Q8pkZjSH6BsqHSp5eny5RzhGzR14nZ/HoR25L7NJ6yHM9BI0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1721030897244754.1462025156482; Mon, 15 Jul 2024 01:08:17 -0700 (PDT) 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 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 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 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" 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" From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?UTF-8?q?Philippe=20Mathieu-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721030898612116600 Content-Type: text/plain; charset="utf-8" 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: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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; } =20 - fd =3D qemu_open_old("/dev/sgx_vepc", O_RDWR); + fd =3D 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; } =20 --=20 2.34.1 From nobody Sun Nov 24 18:56:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721030894; cv=none; d=zohomail.com; s=zohoarc; b=jkRebhZ5eomWYlv43k+kCDlOECdUI1fq6AL5+IgC8z9DgybCSLkbPyzjTeiwfst3F5TcrGeog0Dq1Pbj7jQ3L/PgOSRdbwY1oGlDznfVekJH4kuANjo6VIAS3ZX5xoGd9r62S0exEv25HRKDERHIAJ3RiKQe6+XjVHOfzkArekg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721030894; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DpwAha2kB/SRULjwB1Fg4dp3IjE+KZvQMuMEp4cMRRo=; b=WHXo5y6Y2EwXps+LC1xyWHJaSetvYSD7/utHzmqGblLOid0y9h4VgM7FlZZv/+ZjRIvMctnbf7jTQ1vqrP81SCGaLSCX/C1TFetA/6Ogu6Gr9j8GrLt46QlSqtievwyNp4QF2GejXsceEKi8ATcWJc9JIKNtIJtbGO+3yMaGMqk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 172103089465586.53780935439192; Mon, 15 Jul 2024 01:08:14 -0700 (PDT) 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 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 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 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" 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" From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?UTF-8?q?Philippe=20Mathieu-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721030896600116600 Content-Type: text/plain; charset="utf-8" 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=C3=A9 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; =20 if (be->owned && !be->users) { - fd =3D qemu_open_old("/dev/iommu", O_RDWR); + fd =3D qemu_open("/dev/iommu", O_RDWR, errp); if (fd < 0) { - error_setg_errno(errp, errno, "/dev/iommu opening failed"); return false; } be->fd =3D fd; --=20 2.34.1 From nobody Sun Nov 24 18:56:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1721030920; cv=none; d=zohomail.com; s=zohoarc; b=CaNVbx/Jgg7ZbQbGIIlw2cX9Lva05WcYI9bGRod9OD+3ArM9AxLbLl0ebIEqU8+MITmDY8zxNHEphL5YXcm1YiaRujooPX/w3+neK+l9vr9Yhwm1tHS03Zre2cyDeijmeUC6QgCxO9+MPEh4U6pLUI9Cvnh5ljkqdqckirCTrGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1721030920; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7yD3FXrcQ2ZG4mAhd6eGRGLG4UT8f/VOkB/ehTA46KQ=; b=LMQKs3v0EC2eMsPdBziMByvqxUqNCCDEVCqPiSPVNg3pSI5bkW6FBzhlDaloHj/LGe2vvW9XP4IpK/+zyuko4nBWjdF1AMMc75iEXvHlnql/CS1N+R9M28mpGuKJAXMx/1/z3AYc6Iba2I+54vzh2w7gvtkqntyoSdaDO6M2mLk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 172103092019378.9384597999059; Mon, 15 Jul 2024 01:08:40 -0700 (PDT) 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 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 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 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" 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" From: Zhao Liu To: Michael Tokarev , Laurent Vivier Cc: =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Markus Armbruster , Eric Blake , =?UTF-8?q?Philippe=20Mathieu-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 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1721030920743116600 Content-Type: text/plain; charset="utf-8" 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=C3=A9 --- 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 **er= rp) error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "filename", "a valid filename"); } else { - s->fd =3D qemu_open_old(s->filename, O_RDONLY | O_NONBLOCK); - if (s->fd =3D=3D -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 =3D qemu_open(s->filename, O_RDONLY | O_NONBLOCK, errp); } } =20 --=20 2.34.1