QTestState *qts;
/* Start with a drive used by a device that unplugs instantaneously */
- qts = qtest_initf("-drive if=none,id=drive0,file=null-co://,format=raw"
+ qts = qtest_initf("-drive if=none,id=drive0,file=null-co://,"
+ "file.read-zeroes=on,format=raw"
" -device virtio-scsi-%s"
" -device scsi-hd,drive=drive0,id=dev0",
qvirtio_get_dev_type());
};
QOSGraphEdgeOptions opts = {
- .before_cmd_line = "-drive id=drv0,if=none,file=null-co://,format=raw",
+ .before_cmd_line = "-drive id=drv0,if=none,file=null-co://,"
+ "file.read-zeroes=on,format=raw",
.after_cmd_line = "-device scsi-hd,bus=vs0.0,drive=drv0",
};
{
QOSGraphEdgeOptions opts = {
.extra_device_opts = "addr=04.0,id=scsi0",
- .before_cmd_line = "-drive id=drv0,if=none,file=null-co://,format=raw",
+ .before_cmd_line = "-drive id=drv0,if=none,file=null-co://,"
+ "file.read-zeroes=on,format=raw",
.after_cmd_line = "-device scsi-hd,bus=scsi0.0,drive=drv0",
};
{
QOSGraphEdgeOptions opts = {
.extra_device_opts = "addr=04.0,drive=drv0,serial=foo",
- .before_cmd_line = "-drive id=drv0,if=none,file=null-co://,format=raw",
+ .before_cmd_line = "-drive id=drv0,if=none,file=null-co://,"
+ "file.read-zeroes=on,format=raw",
};
add_qpci_address(&opts, &(QPCIAddress) { .devfn = QPCI_DEVFN(4, 0) });
" 'arguments': {"
" 'driver': 'blkdebug', 'node-name': %s,"
" 'config': %s,"
- " 'image': { 'driver': 'null-co' } } }",
+ " 'image': { 'driver': 'null-co', 'read-zeroes': true } } }",
id, id, fifo_name);
}
#include "qemu/main-loop.h"
#include "block/blockjob_int.h"
#include "sysemu/block-backend.h"
+#include "qapi/qmp/qdict.h"
typedef struct {
BlockJob common;
data = g_new0(TestBlockJobCBData, 1);
- bs = bdrv_open("null-co://", NULL, NULL, 0, &error_abort);
+ QDict *opt = qdict_new();
+ qdict_put_str(opt, "file.read-zeroes", "on");
+ bs = bdrv_open("null-co://", NULL, opt, 0, &error_abort);
g_assert_nonnull(bs);
snprintf(job_id, sizeof(job_id), "job%u", counter++);
#include "qemu/main-loop.h"
#include "block/blockjob_int.h"
#include "sysemu/block-backend.h"
+#include "qapi/qmp/qdict.h"
static const BlockJobDriver test_block_job_driver = {
.job_driver = {
BlockBackend *blk = blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL);
BlockDriverState *bs;
- bs = bdrv_open("null-co://", NULL, NULL, 0, &error_abort);
+ QDict *opt = qdict_new();
+ qdict_put_str(opt, "file.read-zeroes", "on");
+ bs = bdrv_open("null-co://", NULL, opt, 0, &error_abort);
g_assert_nonnull(bs);
blk_insert_bs(blk, bs, &error_abort);
{
const char *arch = qtest_get_arch();
const char *cmd = "-device piix3-usb-uhci,id=uhci,addr=1d.0"
- " -drive id=drive0,if=none,file=null-co://,format=raw"
+ " -drive id=drive0,if=none,file=null-co://,"
+ "file.read-zeroes=on,format=raw"
" -device usb-tablet,bus=uhci.0,port=1";
int ret;
qtest_add_func("/xhci/pci/hotplug/usb-ccid", test_usb_ccid_hotplug);
qtest_start("-device nec-usb-xhci,id=xhci"
- " -drive id=drive0,if=none,file=null-co://,format=raw");
+ " -drive id=drive0,if=none,file=null-co://,"
+ "file.read-zeroes=on,format=raw");
ret = g_test_run();
qtest_end();
char *tmp_path = drive_create();
g_string_append_printf(cmd_line,
- " -drive if=none,id=drive0,file=%s,format=raw,auto-read-only=off "
- "-drive if=none,id=drive1,file=null-co://,format=raw ",
+ " -drive if=none,id=drive0,file=%s,"
+ "format=raw,auto-read-only=off "
+ "-drive if=none,id=drive1,file=null-co://,"
+ "file.read-zeroes=on,format=raw ",
tmp_path);
return arg;
static void virtio_blk_nop(void)
{
- global_qtest = qtest_initf("-drive if=none,id=drv0,file=null-co://,format=raw "
+ global_qtest = qtest_initf("-drive if=none,id=drv0,file=null-co://,"
+ "file.read-zeroes=on,format=raw "
"-device virtio-blk-ccw,drive=drv0");
qtest_end();
}
static void virtio_scsi_hotplug(void)
{
- global_qtest = qtest_initf("-drive if=none,id=drv0,file=null-co://,format=raw "
- "-drive if=none,id=drv1,file=null-co://,format=raw "
+ global_qtest = qtest_initf("-drive if=none,id=drv0,file=null-co://,"
+ "file.read-zeroes=on,format=raw "
+ "-drive if=none,id=drv1,file=null-co://,"
+ "file.read-zeroes=on,format=raw "
"-device virtio-scsi-ccw "
"-device scsi-hd,drive=drv0");
qtest_qmp_device_add("scsi-hd", "scsihd", "{'drive': 'drv1'}");
static void *virtio_scsi_hotplug_setup(GString *cmd_line, void *arg)
{
g_string_append(cmd_line,
- " -drive id=drv1,if=none,file=null-co://,format=raw");
+ " -drive id=drv1,if=none,file=null-co://,"
+ "file.read-zeroes=on,format=raw");
return arg;
}
{
g_string_append(cmd_line,
" -drive file=blkdebug::null-co://,"
+ "file.image.read-zeroes=on,"
"if=none,id=dr1,format=raw,file.align=4k "
"-device scsi-hd,drive=dr1,lun=0,scsi-id=1");
return arg;
{
g_string_append(cmd_line,
" -object iothread,id=thread0"
- " -blockdev driver=null-co,node-name=null0"
+ " -blockdev driver=null-co,read-zeroes=on,node-name=null0"
" -device scsi-hd,drive=null0");
return arg;
}