The 'change' QMP and HMP command allows replacing the medium in drives which support this, e.g. floppy disk drives. For some drives, the medium carries information about whether it can be written to or not (again, floppy drives). Therefore, it should be possible to change the read-only state of block devices when changing the loaded medium.
This series adds an optional additional parameter to the 'change' QMP and HMP command which allows changing the read-only state in four ways: - 'retain': Just keep the status as it was before; this is the current behavior and thus this will be the default. - 'ro': Force read-only access - 'rw': Force writable access - 'auto': This opens the new file R/W first, if that fails, the file is opened read-only. Max Reitz (3): blockdev: Add read-only option to change-blockdev qmp: Expose read-only option for 'change' hmp: Expose read-only option for 'change' blockdev.c | 41 ++++++++++++++++++++++++++++++++++++++--- hmp-commands.hx | 24 +++++++++++++++++++++--- hmp.c | 17 ++++++++++++++++- include/sysemu/blockdev.h | 3 ++- qapi-schema.json | 27 ++++++++++++++++++++++++++- qmp-commands.hx | 24 +++++++++++++++++++++++- qmp.c | 14 ++++++++++++-- 7 files changed, 138 insertions(+), 12 deletions(-) -- 1.9.3