[PATCH 14/14] block: remove support for using "file" driver with block/char devices

Eric Blake eblake at redhat.com
Mon Mar 15 12:04:47 UTC 2021


On 2/24/21 7:11 AM, Daniel P. Berrangé wrote:
> The 'host_device' and 'host_cdrom' drivers must be used instead.
> 
> Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
> ---
>  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(-)
> 

>      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' driver, "
> -                       "but something else was given", bs->drv->format_name);
> +        if (!S_ISREG(st.st_mode)) {

We're testing with S_ISREG()...


> +++ b/docs/system/deprecated.rst
> @@ -21,13 +21,6 @@ deprecated.
>  System emulator command line arguments
>  --------------------------------------
>  
> -``-drive file=json:{...{'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

but documented with S_IFREG().  Thankfully, the two have semantically
equivalent purposes, so the difference doesn't invalidate the docs.

Reviewed-by: Eric Blake <eblake at redhat.com>

but I wouldn't mind if at least one other block maintainer chimes in.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




More information about the libvir-list mailing list