From nobody Sun Feb 8 22:24:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528991686634173.7314967032529; Thu, 14 Jun 2018 08:54:46 -0700 (PDT) Received: from localhost ([::1]:41427 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTUa9-0004ZS-3j for importer@patchew.org; Thu, 14 Jun 2018 11:54:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTUVM-0000j9-VR for qemu-devel@nongnu.org; Thu, 14 Jun 2018 11:49:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTUVI-0003nF-1S for qemu-devel@nongnu.org; Thu, 14 Jun 2018 11:49:44 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:37181) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fTUVH-0003jk-FW; Thu, 14 Jun 2018 11:49:39 -0400 Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1fTUVE-0004du-FG; Thu, 14 Jun 2018 17:49:36 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1fTUUv-0008NX-4n; Thu, 14 Jun 2018 18:49:17 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=fPiztnIKL24vzWoOe5dv9BKEgatFA+70o+eRQ2Vrhi4=; b=n61tLpkcDKVWbfEErDTaKoH39dFPZTbDy3MCiaXYwu+Vxf7od6C4+Cl0k2aYROtbf/2KkEqqD/pJ/Xh4gr3mdj9p33qA3btWRHEZ2cLFlLzj0FoqR+COmMTU0i0lSP3CD/NsSotmlqVCjbYJzspcf0XuZeVeF7mitsEtK/ajBCySfQDxRhxsFjtdhIwJ84wu6wUMHJSqRUEk3gCKNP9z5ilvw45RZD/RA//+2azEBWKNcpcjtvsiV2Bj9c/G+mT19LRp7NxTQcdsvpXE5QgcXxJhXCBG4W7CdVugJlBg4uczT1x+vNJIinhDy8+vqfejUfY6vIZqy0BjYRdxk2ttiA==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Thu, 14 Jun 2018 18:48:58 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [RFC PATCH 01/10] file-posix: Forbid trying to change unsupported options during reopen X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Markus Armbruster , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The file-posix code is used for the "file", "host_device" and "host_cdrom" drivers, and it allows reopening images. However the only option that is actually processed is "x-check-cache-dropped", and changes in all other options (e.g. "filename") are silently ignored. While we could allow changing some of the other options, let's keep things as they are for now but return an error if the user tries to change any of them. Signed-off-by: Alberto Garcia --- block/file-posix.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 07bb061fe4..1511a4d69d 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -813,8 +813,13 @@ static int raw_reopen_prepare(BDRVReopenState *state, goto out; } =20 - rs->check_cache_dropped =3D qemu_opt_get_bool(opts, "x-check-cache-dro= pped", - s->check_cache_dropped); + rs->check_cache_dropped =3D + qemu_opt_get_bool_del(opts, "x-check-cache-dropped", false); + + /* This driver's reopen function doesn't currently allow changing + * other options, so let's put them back in the original QDict and + * bdrv_reopen_prepare() will detect changes and complain. */ + qemu_opts_to_qdict(opts, state->options); =20 if (s->type =3D=3D FTYPE_CD) { rs->open_flags |=3D O_NONBLOCK; --=20 2.11.0