From nobody Sun Feb 8 17:21:55 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=1616059906; cv=none; d=zohomail.com; s=zohoarc; b=lGzjmaVsWtdo/VZ4ohZfJMxwjyfbWIsfOpWQ/fa2Eni1O5ewaHu5wmTVQ2Px6zGTFdQtxW0qb74na556PtFeO11xBfKbW/UGInxObQ1xBiHDyAKPS8iFOPCnwuVq4yIjyNLDBLXeH+MDmkGSyiMQ3kzFiaogdlNdr861XpILxx4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616059906; 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=OuwoOMezitus7BBNFbdAJmKNupzsz77z9WUDoTQTwOk=; b=Qk2R/qfSNu8YrPUTVYF2tARzRHcSHYO+5fKzKbVlwYjPfFRt20cvxnxi4F8EBrNGxVk9TpiFimmGQk664VYUJXqX/O8aXffDP83+BJIWqE6fLkYwFTlgNmUuiyy6IVXkZVq/HpeVWh1a5anPFS3PrXnXrhye00aOZzFCPNDY/OM= 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 1616059906371129.3118588980144; Thu, 18 Mar 2021 02:31:46 -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-301-tbY4EL_4NfaQPEZWS4siiw-1; Thu, 18 Mar 2021 05:31:42 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EEF9F190A7A3; Thu, 18 Mar 2021 09:31:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFE6C10013C1; Thu, 18 Mar 2021 09:31:35 +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 521004BB7C; Thu, 18 Mar 2021 09:31:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12I9VX2w007044 for ; Thu, 18 Mar 2021 05:31:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id BB0296A8F0; Thu, 18 Mar 2021 09:31:33 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-61.ams2.redhat.com [10.36.115.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB6CC62951; Thu, 18 Mar 2021 09:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616059905; 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=OuwoOMezitus7BBNFbdAJmKNupzsz77z9WUDoTQTwOk=; b=SCvnpvEi2lKr0JMFRYRDaLuf5H57wf6idrFDV/jHqQIK9Lp8+wQFf32aEfq9mbs6VKisGL RcUVltU3bIEPl3B+XCSN6ZU7Dl2k1QewUNwSAfID/7QBzVFRG+TqkxwPWaN2IhREtFod48 ilKFtVHYDz39Jeo50xG+6mBsdwPhTBc= X-MC-Unique: tbY4EL_4NfaQPEZWS4siiw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 13/13] block: remove support for using "file" driver with block/char devices Date: Thu, 18 Mar 2021 09:25:12 +0000 Message-Id: <20210318092512.250725-14-berrange@redhat.com> In-Reply-To: <20210318092512.250725-1-berrange@redhat.com> References: <20210318092512.250725-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.22 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 c7e80fa731..d5e80d66eb 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -21,13 +21,6 @@ deprecated. System emulator command line arguments -------------------------------------- =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 d164d3f290..bff16b7b05 100644 --- a/docs/system/removed-features.rst +++ b/docs/system/removed-features.rst @@ -57,6 +57,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