qemu-e2k/hw/ppc
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
..
e500-ccsr.h
e500.c
e500.h
e500plat.c
fdt.c
fw_cfg.c
Kconfig Revert "ppc4xx: Move common dependency on serial to common option" 2021-01-19 10:20:29 +11:00
mac_newworld.c macio: move OpenPIC inside macio-newworld device 2021-01-13 12:21:10 +00:00
mac_oldworld.c macio: move heathrow PIC inside macio-oldworld device 2021-01-13 12:20:37 +00:00
mac.h
meson.build
mpc8544_guts.c
mpc8544ds.c
pnv_bmc.c
pnv_core.c
pnv_homer.c
pnv_lpc.c
pnv_occ.c
pnv_pnor.c block: Separate blk_is_writable() and blk_supports_write_perm() 2021-01-27 20:45:20 +01:00
pnv_psi.c
pnv_xscom.c
pnv.c
ppc4xx_devs.c hw/ppc: Remove unused ppcuic_init() 2021-01-19 10:20:29 +11:00
ppc4xx_pci.c hw: Use the PCI_SLOT() macro from 'hw/pci/pci.h' 2021-01-04 23:24:44 +01:00
ppc405_boards.c hw/ppc/ppc405_uc: Drop use of ppcuic_init() 2021-01-19 10:20:29 +11:00
ppc405_uc.c hw/ppc/ppc405_uc: Drop use of ppcuic_init() 2021-01-19 10:20:29 +11:00
ppc405.h hw/ppc/ppc405_uc: Drop use of ppcuic_init() 2021-01-19 10:20:29 +11:00
ppc440_bamboo.c hw/ppc/ppc440_bamboo: Drop use of ppcuic_init() 2021-01-06 11:09:59 +11:00
ppc440_pcix.c ppc440_pcix: Fix up pci config access 2021-01-06 11:09:59 +11:00
ppc440_uc.c
ppc440.h
ppc_booke.c
ppc.c
ppce500_spin.c
prep_systemio.c
prep.c
rs6000_mc.c
sam460ex.c sam460ex: Use type cast macro instead of simple cast 2021-01-19 10:20:29 +11:00
spapr_caps.c
spapr_cpu_core.c spapr_cpu_core.c: use g_auto* in spapr_create_vcpu() 2021-01-19 10:20:29 +11:00
spapr_drc.c spapr: Add drc_ prefix to the DRC realize and unrealize functions 2021-01-06 11:09:59 +11:00
spapr_events.c spapr: Improve handling of memory unplug with old guests 2021-01-19 10:20:29 +11:00
spapr_hcall.c spapr_hcall.c: make do_client_architecture_support static 2021-01-19 10:20:29 +11:00
spapr_iommu.c
spapr_irq.c
spapr_numa.c
spapr_nvdimm.c
spapr_ovec.c spapr: Improve handling of memory unplug with old guests 2021-01-19 10:20:29 +11:00
spapr_pci_nvlink2.c
spapr_pci_vfio.c
spapr_pci.c
spapr_rng.c
spapr_rtas_ddw.c
spapr_rtas.c spapr_rtas.c: fix identation of rtas_ibm_suspend_me() args 2021-01-19 10:20:29 +11:00
spapr_rtc.c
spapr_tpm_proxy.c
spapr_vio.c
spapr.c spapr: Improve handling of memory unplug with old guests 2021-01-19 10:20:29 +11:00
trace-events ppc440_pcix: Fix register write trace event 2021-01-06 11:09:59 +11:00
trace.h
virtex_ml507.c hw/ppc/virtex_ml507: Drop use of ppcuic_init() 2021-01-06 11:09:59 +11:00