qemu-e2k/include/sysemu
Kevin Wolf 86b1cf3227 block: Separate blk_is_writable() and blk_supports_write_perm()
Currently, blk_is_read_only() tells whether a given BlockBackend can
only be used in read-only mode because its root node is read-only. Some
callers actually try to answer a slightly different question: Is the
BlockBackend configured to be writable, by taking write permissions on
the root node?

This can differ, for example, for CD-ROM devices which don't take write
permissions, but may be backed by a writable image file. scsi-cd allows
write requests to the drive if blk_is_read_only() returns false.
However, the write request will immediately run into an assertion
failure because the write permission is missing.

This patch introduces separate functions for both questions.
blk_supports_write_perm() answers the question whether the block
node/image file can support writable devices, whereas blk_is_writable()
tells whether the BlockBackend is currently configured to be writable.

All calls of blk_is_read_only() are converted to one of the two new
functions.

Fixes: https://bugs.launchpad.net/bugs/1906693
Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210118123448.307825-2-kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2021-01-27 20:45:20 +01:00
..
accel.h
arch_init.h
balloon.h
block-backend.h block: Separate blk_is_writable() and blk_supports_write_perm() 2021-01-27 20:45:20 +01:00
blockdev.h
cpu-throttle.h
cpu-timers.h cpus: prepare new CpusAccel cpu accelerator interface 2020-10-05 16:41:22 +02:00
cpus.h accel: move qtest CpusAccel functions to a common location 2020-10-24 07:23:19 +02:00
cryptodev-vhost-user.h cryptodev: Fix Lesser GPL version number 2020-10-27 16:48:49 +01:00
cryptodev-vhost.h cryptodev: Fix Lesser GPL version number 2020-10-27 16:48:49 +01:00
cryptodev.h cryptodev: Fix Lesser GPL version number 2020-10-27 16:48:49 +01:00
device_tree.h
dma.h dma: Let dma_memory_write() propagate MemTxResult 2020-12-10 12:15:02 -05:00
dump-arch.h
dump.h
hax.h hax: remove hax specific functions from global includes 2020-10-05 16:41:22 +02:00
hostmem.h
hvf.h hvf: remove hvf specific functions from global includes 2020-10-05 16:41:22 +02:00
hw_accel.h cpus: prepare new CpusAccel cpu accelerator interface 2020-10-05 16:41:22 +02:00
iothread.h
kvm_int.h
kvm.h kvm: Correct documentation of kvm_irqchip_*() 2020-10-14 15:28:54 -04:00
memory_mapping.h
numa.h
os-posix.h
os-win32.h win32: Simplify gmtime_r detection not depends on if _POSIX_C_SOURCE are defined on msys2/mingw 2020-10-14 06:05:56 +02:00
qtest.h cpu-timers, icount: new modules 2020-10-05 16:41:22 +02:00
replay.h replay: create temporary snapshot at debugger connection 2020-10-06 08:34:49 +02:00
reset.h
rng-random.h
rng.h
runstate-action.h vl: Add option to avoid stopping VM upon guest panic 2020-12-15 12:51:58 -05:00
runstate.h vl: remove separate preconfig main_loop 2020-12-15 12:51:49 -05:00
seccomp.h
sev.h sev: add sev-inject-launch-secret 2020-12-10 17:33:17 -05:00
sysemu.h qmp: generalize watchdog-set-action to -no-reboot/-no-shutdown 2020-12-15 12:51:57 -05:00
tcg.h tcg: Add --accel tcg,split-wx property 2021-01-07 05:09:41 -10:00
tpm_backend.h
tpm_util.h tpm: Fix Lesser GPL version number 2020-11-15 16:44:18 +01:00
tpm.h
vhost-user-backend.h
watchdog.h
whpx.h whpx: move internal definitions to whpx-internal.h 2021-01-12 12:38:03 +01:00
xen-mapcache.h
xen.h