From nobody Wed Nov 5 18:43:36 2025 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 1535985775260934.1991600327596; Mon, 3 Sep 2018 07:42:55 -0700 (PDT) Received: from localhost ([::1]:45435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwq41-0003an-Gt for importer@patchew.org; Mon, 03 Sep 2018 10:42:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwpwh-0004G8-TE for qemu-devel@nongnu.org; Mon, 03 Sep 2018 10:35:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwpwc-0000Z1-Nh for qemu-devel@nongnu.org; Mon, 03 Sep 2018 10:35:15 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:38247) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fwpwc-0000OL-0M; Mon, 03 Sep 2018 10:35:10 -0400 Received: from 91-158-71-53.elisa-laajakaista.fi ([91.158.71.53] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1fwpvz-0007gZ-OH; Mon, 03 Sep 2018 16:34:31 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1fwpvk-0002z3-7s; Mon, 03 Sep 2018 17:34:16 +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=g0yeizXw22aVEbGSgxZQQQMYnevWLptyviOHfesip4A=; b=RWNThVaDf+Z0mGE++ZW+/fsXoeqbKRCTgbMTt+DMOd4Xkr7ts8XGIEgNlxIwBQZubwtm2U9+okdZuDs1IozOIBSLsOqugdc658kwKEvGf5loD3W9acO4lf/rdjMbzNAOh4ja2MBOlrIU83f52IXnI8Fj1Je7+V07ljl+tGEC0ygirTkZkkaiD6zxUfY5LFlr1aB4ugyNw70d2Uq+mQVVLzwQJBF/KNNNkykH3et4gC1DgDOudJY/6/jm7H5ZCgzyPvpHVs9yqsC8rjqxDAawq+nLc3wxmIHkCCrzyApFXIwdqpTL/LvRRGhAQRTmDd76Vf3Z55JMX0/MjdekTBCH/Q==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 3 Sep 2018 17:34:05 +0300 Message-Id: <5e84c28e4ed8ac259665c7e0c0baa028668ac0b2.1535983918.git.berto@igalia.com> 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] [PATCH v2 07/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, 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: (qemu) qemu-io virtio0 "reopen -o file.filename=3Dno-such-file" 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 Reviewed-by: Max Reitz --- 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 ddac0cc3e6..d4ec2cb3dd 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -850,8 +850,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", - false); + 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