Make 'qemu-img commit' work on Windows.
Command 'commit' requires reopening backing file in RW mode. So,
add reopen prepare/commit/abort handlers and change dwShareMode
for CreateFile call in order to allow further read/write reopening.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/418
Suggested-by: Hanna Reitz <hreitz@redhat.com>
Signed-off-by: Viktor Prutyanov <viktor.prutyanov@phystech.edu>
Tested-by: Helge Konetzka <hk@zapateado.de>
---
v2:
- fix indentation in raw_reopen_prepare
- free rs if raw_reopen_prepare fails
v3:
- restore suggested-by field missed in v2
v4:
- add file type check
- add comment about options
- replace rs check with assert in raw_reopen_commit
v5:
- add CloseHandle at AIO attach fail
block/file-win32.c | 101 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 100 insertions(+), 1 deletion(-)