block: remove support for using "file" driver with block/char devices
The 'host_device' and 'host_cdrom' drivers must be used instead. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
e67d8e2928
commit
8d17adf34f
@ -719,15 +719,9 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!device) {
|
if (!device) {
|
||||||
if (S_ISBLK(st.st_mode)) {
|
if (!S_ISREG(st.st_mode)) {
|
||||||
warn_report("Opening a block device as a file using the '%s' "
|
error_setg(errp, "'%s' driver requires '%s' to be a regular file",
|
||||||
"driver is deprecated", bs->drv->format_name);
|
bs->drv->format_name, bs->filename);
|
||||||
} 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);
|
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
} else {
|
} else {
|
||||||
@ -736,8 +730,9 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!(S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))) {
|
if (!(S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))) {
|
||||||
error_setg(errp, "'%s' driver expects either "
|
error_setg(errp, "'%s' driver requires '%s' to be either "
|
||||||
"a character or block device", bs->drv->format_name);
|
"a character or block device",
|
||||||
|
bs->drv->format_name, bs->filename);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,6 @@ deprecated.
|
|||||||
System emulator command line arguments
|
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
|
|
||||||
for these file types is 'host_cdrom' or 'host_device' as appropriate.
|
|
||||||
|
|
||||||
``QEMU_AUDIO_`` environment variables and ``-audio-help`` (since 4.0)
|
``QEMU_AUDIO_`` environment variables and ``-audio-help`` (since 4.0)
|
||||||
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
|
||||||
|
|
||||||
|
@ -57,6 +57,13 @@ by the ``tls-authz`` and ``sasl-authz`` options.
|
|||||||
The ``pretty=on|off`` switch has no effect for HMP monitors and
|
The ``pretty=on|off`` switch has no effect for HMP monitors and
|
||||||
its use is rejected.
|
its use is rejected.
|
||||||
|
|
||||||
|
``-drive file=json:{...{'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
|
QEMU Machine Protocol (QMP) commands
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
|
@ -3,23 +3,23 @@ QA output created by 226
|
|||||||
=== Testing with driver:file ===
|
=== Testing with driver:file ===
|
||||||
|
|
||||||
== Testing RO ==
|
== Testing RO ==
|
||||||
qemu-io: can't open: A regular file was expected by the 'file' driver, but something else was given
|
qemu-io: can't open: 'file' driver requires 'TEST_DIR/t.IMGFMT' to be a regular file
|
||||||
qemu-io: warning: Opening a character device as a file using the 'file' driver is deprecated
|
qemu-io: can't open: 'file' driver requires '/dev/null' to be a regular file
|
||||||
== Testing RW ==
|
== Testing RW ==
|
||||||
qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory
|
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' driver is deprecated
|
qemu-io: can't open: 'file' driver requires '/dev/null' to be a regular file
|
||||||
|
|
||||||
=== Testing with driver:host_device ===
|
=== Testing with driver:host_device ===
|
||||||
|
|
||||||
== Testing RO ==
|
== Testing RO ==
|
||||||
qemu-io: can't open: 'host_device' driver expects either a character or block device
|
qemu-io: can't open: 'host_device' driver requires 'TEST_DIR/t.IMGFMT' to be either a character or block device
|
||||||
== Testing RW ==
|
== Testing RW ==
|
||||||
qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory
|
qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory
|
||||||
|
|
||||||
=== Testing with driver:host_cdrom ===
|
=== Testing with driver:host_cdrom ===
|
||||||
|
|
||||||
== Testing RO ==
|
== Testing RO ==
|
||||||
qemu-io: can't open: 'host_cdrom' driver expects either a character or block device
|
qemu-io: can't open: 'host_cdrom' driver requires 'TEST_DIR/t.IMGFMT' to be either a character or block device
|
||||||
== Testing RW ==
|
== Testing RW ==
|
||||||
qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory
|
qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user