From nobody Sun Feb 8 05:40:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1615830737; cv=none; d=zohomail.com; s=zohoarc; b=FMiTVQGb4SDtUuxGABsylWxkMb6a+iWp5V4XTNcRjnFknvostLdN9Y7zrIcwECg1/IeqkPtkYHwHpQ0zf1hJWYSAcui1XOxgYBx+IujqivgadTVmXS/WLltwyLg/qL/KSJjZc/S/8lHFH/rYcfpPLJF5bVMxBTa/vol1Tw2ldM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615830737; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=blO1xiHJi/OjF6G5B0XA6MfWyvjKLXxmmhxTSX6kEXs=; b=cFts+LU/evFKtfwwQE1sWbcrPrUIE5V7s3fPjeUX7lmrsb89NHTs1dkLiHt83r69y/DCoIhO1LWa8QOpOcMVvhO5l3xa4sP9BMqJ05rWtr7g5kktnT5TEfxwJJAuJmRU2wtZud7H2rlV92znn46lrLKpKqrqNXD0MF6WIIU5OMA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 16158307372781007.1616129870705; Mon, 15 Mar 2021 10:52:17 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-431-15mTyFuAP9aEmlJQ74RFaA-1; Mon, 15 Mar 2021 13:52:13 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 73948192D786; Mon, 15 Mar 2021 17:52:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 45B026060F; Mon, 15 Mar 2021 17:52:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C245E18155DE; Mon, 15 Mar 2021 17:52:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12FHq48h006418 for ; Mon, 15 Mar 2021 13:52:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id CBFED10246F1; Mon, 15 Mar 2021 17:52:04 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-81.ams2.redhat.com [10.36.115.81]) by smtp.corp.redhat.com (Postfix) with ESMTP id 352EF1042A66; Mon, 15 Mar 2021 17:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615830736; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=blO1xiHJi/OjF6G5B0XA6MfWyvjKLXxmmhxTSX6kEXs=; b=d7kpj61yciOTn4IUx3LK9X+W42brb2YAQdm0MHKtE5aROjwdoIg1itbRSddUAIqjYL4z2B FCbVNDMb/+KBBSyOs9hGp+oLEbF+bd0F/pNgs7kfllACvcZi4Ln0rxeHfNc9Vn7C0gwk5c 0LhILobny7kVInncHpIUSPVyRX36M0A= X-MC-Unique: 15mTyFuAP9aEmlJQ74RFaA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 13/13] block: remove support for using "file" driver with block/char devices Date: Mon, 15 Mar 2021 17:45:23 +0000 Message-Id: <20210315174523.979666-14-berrange@redhat.com> In-Reply-To: <20210315174523.979666-1-berrange@redhat.com> References: <20210315174523.979666-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Fam Zheng , "Michael S. Tsirkin" , libvir-list@redhat.com, Mark Cave-Ayland , Gerd Hoffmann , qemu-block@nongnu.org, Juan Quintela , Wainer dos Santos Moschetta , Marcel Apfelbaum , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Artyom Tarasenko , Laurent Vivier , Thomas Huth , Eduardo Habkost , Richard Henderson , "Dr. David Alan Gilbert" , Greg Kurz , Cleber Rosa , John Snow , David Gibson , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Max Reitz , qemu-ppc@nongnu.org, Paolo Bonzini X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The 'host_device' and 'host_cdrom' drivers must be used instead. Reviewed-by: Eric Blake Signed-off-by: Daniel P. Berrang=C3=A9 --- block/file-posix.c | 17 ++++++----------- docs/system/deprecated.rst | 7 ------- docs/system/removed-features.rst | 7 +++++++ tests/qemu-iotests/226.out | 10 +++++----- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index 05079b40ca..20e14f8e96 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -719,15 +719,9 @@ static int raw_open_common(BlockDriverState *bs, QDict= *options, } =20 if (!device) { - if (S_ISBLK(st.st_mode)) { - warn_report("Opening a block device as a file using the '%s' " - "driver is deprecated", bs->drv->format_name); - } else if (S_ISCHR(st.st_mode)) { - warn_report("Opening a character device as a file using the '%= s' " - "driver is deprecated", bs->drv->format_name); - } else if (!S_ISREG(st.st_mode)) { - error_setg(errp, "A regular file was expected by the '%s' driv= er, " - "but something else was given", bs->drv->format_nam= e); + if (!S_ISREG(st.st_mode)) { + error_setg(errp, "'%s' driver requires '%s' to be a regular fi= le", + bs->drv->format_name, bs->filename); ret =3D -EINVAL; goto fail; } else { @@ -736,8 +730,9 @@ static int raw_open_common(BlockDriverState *bs, QDict = *options, } } else { if (!(S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))) { - error_setg(errp, "'%s' driver expects either " - "a character or block device", bs->drv->format_name= ); + error_setg(errp, "'%s' driver requires '%s' to be either " + "a character or block device", + bs->drv->format_name, bs->filename); ret =3D -EINVAL; goto fail; } diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index f6d0b16579..176b837a42 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -30,13 +30,6 @@ would automatically enable USB support on the machine ty= pe. If using the new syntax, USB support must be explicitly enabled via the ``-machine usb=3Don`` argument. =20 -``-drive file=3Djson:{...{'driver':'file'}}`` (since 3.0) -''''''''''''''''''''''''''''''''''''''''''''''''''''''' - -The 'file' driver for drives is no longer appropriate for character or host -devices and will only accept regular files (S_IFREG). The correct driver -for these file types is 'host_cdrom' or 'host_device' as appropriate. - ``QEMU_AUDIO_`` environment variables and ``-audio-help`` (since 4.0) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' =20 diff --git a/docs/system/removed-features.rst b/docs/system/removed-feature= s.rst index eb4b71750c..7b7bf7214e 100644 --- a/docs/system/removed-features.rst +++ b/docs/system/removed-features.rst @@ -50,6 +50,13 @@ by the ``tls-authz`` and ``sasl-authz`` options. The ``pretty=3Don|off`` switch has no effect for HMP monitors and its use is rejected. =20 +``-drive file=3Djson:{...{'driver':'file'}}`` (removed 6.0) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +The 'file' driver for drives is no longer appropriate for character or host +devices and will only accept regular files (S_IFREG). The correct driver +for these file types is 'host_cdrom' or 'host_device' as appropriate. + QEMU Machine Protocol (QMP) commands ------------------------------------ =20 diff --git a/tests/qemu-iotests/226.out b/tests/qemu-iotests/226.out index 42be973ff2..55504d29c4 100644 --- a/tests/qemu-iotests/226.out +++ b/tests/qemu-iotests/226.out @@ -3,23 +3,23 @@ QA output created by 226 =3D=3D=3D Testing with driver:file =3D=3D=3D =20 =3D=3D Testing RO =3D=3D -qemu-io: can't open: A regular file was expected by the 'file' driver, but= something else was given -qemu-io: warning: Opening a character device as a file using the 'file' dr= iver is deprecated +qemu-io: can't open: 'file' driver requires 'TEST_DIR/t.IMGFMT' to be a re= gular file +qemu-io: can't open: 'file' driver requires '/dev/null' to be a regular fi= le =3D=3D Testing RW =3D=3D qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory -qemu-io: warning: Opening a character device as a file using the 'file' dr= iver is deprecated +qemu-io: can't open: 'file' driver requires '/dev/null' to be a regular fi= le =20 =3D=3D=3D Testing with driver:host_device =3D=3D=3D =20 =3D=3D Testing RO =3D=3D -qemu-io: can't open: 'host_device' driver expects either a character or bl= ock device +qemu-io: can't open: 'host_device' driver requires 'TEST_DIR/t.IMGFMT' to = be either a character or block device =3D=3D Testing RW =3D=3D qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory =20 =3D=3D=3D Testing with driver:host_cdrom =3D=3D=3D =20 =3D=3D Testing RO =3D=3D -qemu-io: can't open: 'host_cdrom' driver expects either a character or blo= ck device +qemu-io: can't open: 'host_cdrom' driver requires 'TEST_DIR/t.IMGFMT' to b= e either a character or block device =3D=3D Testing RW =3D=3D qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory =20 --=20 2.30.2