The null driver is very usefull for testing and benchmarking, but it can not
emulate an image full of zeroes or an image full of non-zero bytes. Such images
are needed for testing computing a blkhash via qemu-nbd or qemu-storage-daemon.
This change adds `read-pattern` option allowing emulution of image full of
zeroes and image for of non-zero bytes.
I used this for testing
https://lists.gnu.org/archive/html/qemu-devel/2025-04/msg05096.html
Changes since v1:
- Make read-zeroes and read-pattern mutual exclusive [Eric, Markus]
- Narrow read-pattern type to uint8 [Eric, Markus]
- Update the doc comment to explain that read-zeroes emulates a sparsse image,
and read-pattern emulates an allocated image. [Markus]
- Validate that read-pattern value is within range
- Update secure-coding-practices guide with read-pattern option
v1 was here:
https://lists.gnu.org/archive/html/qemu-devel/2025-04/msg05098.html
Nir Soffer (2):
block/null: Report DATA if not reading zeroes
block/null: Add read-pattern option
block/null.c | 38 +++++++++++++++++++++++---
docs/devel/secure-coding-practices.rst | 3 +-
qapi/block-core.json | 17 ++++++++++--
3 files changed, 50 insertions(+), 8 deletions(-)
--
2.39.5 (Apple Git-154)