aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/tools/qemu-img.rst2
-rw-r--r--hw/display/artist.c2
-rw-r--r--hw/display/ati.c2
-rw-r--r--hw/display/next-fb.c2
-rw-r--r--hw/display/ramfb-standalone.c12
-rw-r--r--hw/display/ramfb.c79
-rw-r--r--hw/vfio/display.c4
-rw-r--r--include/hw/display/ramfb.h2
-rw-r--r--qemu-img-cmds.hx4
-rw-r--r--qemu-img.c115
-rw-r--r--qemu-nbd.c6
-rw-r--r--stubs/ramfb.c2
-rw-r--r--tests/qemu-iotests/049.out8
-rwxr-xr-xtests/qemu-iotests/2236
-rw-r--r--tests/qemu-iotests/223.out3
15 files changed, 124 insertions, 125 deletions
diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst
index 0080f83a76..f4ffe528ea 100644
--- a/docs/tools/qemu-img.rst
+++ b/docs/tools/qemu-img.rst
@@ -519,7 +519,7 @@ Command description:
``ImageInfoSpecific*`` QAPI object (e.g. ``ImageInfoSpecificQCow2``
for qcow2 images).
-.. option:: map [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [-U] FILENAME
+.. option:: map [--object OBJECTDEF] [--image-opts] [-f FMT] [--start-offset=OFFSET] [--max-length=LEN] [--output=OFMT] [-U] FILENAME
Dump the metadata of image *FILENAME* and its backing file chain.
In particular, this commands dumps the allocation state of every sector
diff --git a/hw/display/artist.c b/hw/display/artist.c
index 7e2a4556bd..6261bfe65b 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -21,7 +21,7 @@
#include "migration/vmstate.h"
#include "ui/console.h"
#include "trace.h"
-#include "hw/display/framebuffer.h"
+#include "framebuffer.h"
#define TYPE_ARTIST "artist"
#define ARTIST(obj) OBJECT_CHECK(ARTISTState, (obj), TYPE_ARTIST)
diff --git a/hw/display/ati.c b/hw/display/ati.c
index 58ec8291d4..065f197678 100644
--- a/hw/display/ati.c
+++ b/hw/display/ati.c
@@ -511,7 +511,7 @@ static void ati_mm_write(void *opaque, hwaddr addr,
}
switch (addr) {
case MM_INDEX:
- s->regs.mm_index = data;
+ s->regs.mm_index = data & ~3;
break;
case MM_DATA ... MM_DATA + 3:
/* indexed access to regs or memory */
diff --git a/hw/display/next-fb.c b/hw/display/next-fb.c
index 2b726a10f8..b0513a8fba 100644
--- a/hw/display/next-fb.c
+++ b/hw/display/next-fb.c
@@ -27,7 +27,7 @@
#include "hw/hw.h"
#include "hw/boards.h"
#include "hw/loader.h"
-#include "hw/display/framebuffer.h"
+#include "framebuffer.h"
#include "ui/pixel_ops.h"
#include "hw/m68k/next-cube.h"
diff --git a/hw/display/ramfb-standalone.c b/hw/display/ramfb-standalone.c
index d76a9d0fe2..b18db97eeb 100644
--- a/hw/display/ramfb-standalone.c
+++ b/hw/display/ramfb-standalone.c
@@ -3,7 +3,6 @@
#include "qemu/module.h"
#include "hw/loader.h"
#include "hw/qdev-properties.h"
-#include "hw/isa/isa.h"
#include "hw/display/ramfb.h"
#include "ui/console.h"
@@ -13,8 +12,6 @@ typedef struct RAMFBStandaloneState {
SysBusDevice parent_obj;
QemuConsole *con;
RAMFBState *state;
- uint32_t xres;
- uint32_t yres;
} RAMFBStandaloneState;
static void display_update_wrapper(void *dev)
@@ -37,22 +34,15 @@ static void ramfb_realizefn(DeviceState *dev, Error **errp)
RAMFBStandaloneState *ramfb = RAMFB(dev);
ramfb->con = graphic_console_init(dev, 0, &wrapper_ops, dev);
- ramfb->state = ramfb_setup(dev, errp);
+ ramfb->state = ramfb_setup(errp);
}
-static Property ramfb_properties[] = {
- DEFINE_PROP_UINT32("xres", RAMFBStandaloneState, xres, 0),
- DEFINE_PROP_UINT32("yres", RAMFBStandaloneState, yres, 0),
- DEFINE_PROP_END_OF_LIST(),
-};
-
static void ramfb_class_initfn(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->realize = ramfb_realizefn;
- device_class_set_props(dc, ramfb_properties);
dc->desc = "ram framebuffer standalone device";
dc->user_creatable = true;
}
diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c
index 7ba07c80f6..79b9754a58 100644
--- a/hw/display/ramfb.c
+++ b/hw/display/ramfb.c
@@ -13,9 +13,9 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
-#include "qemu/option.h"
#include "hw/loader.h"
#include "hw/display/ramfb.h"
+#include "hw/display/bochs-vbe.h" /* for limits */
#include "ui/console.h"
#include "sysemu/reset.h"
@@ -31,9 +31,7 @@ struct QEMU_PACKED RAMFBCfg {
struct RAMFBState {
DisplaySurface *ds;
uint32_t width, height;
- uint32_t starting_width, starting_height;
struct RAMFBCfg cfg;
- bool locked;
};
static void ramfb_unmap_display_surface(pixman_image_t *image, void *unused)
@@ -46,25 +44,31 @@ static void ramfb_unmap_display_surface(pixman_image_t *image, void *unused)
static DisplaySurface *ramfb_create_display_surface(int width, int height,
pixman_format_code_t format,
- int linesize, uint64_t addr)
+ hwaddr stride, hwaddr addr)
{
DisplaySurface *surface;
- hwaddr size;
+ hwaddr size, mapsize, linesize;
void *data;
- if (linesize == 0) {
- linesize = width * PIXMAN_FORMAT_BPP(format) / 8;
+ if (width < 16 || width > VBE_DISPI_MAX_XRES ||
+ height < 16 || height > VBE_DISPI_MAX_YRES ||
+ format == 0 /* unknown format */)
+ return NULL;
+
+ linesize = width * PIXMAN_FORMAT_BPP(format) / 8;
+ if (stride == 0) {
+ stride = linesize;
}
- size = (hwaddr)linesize * height;
- data = cpu_physical_memory_map(addr, &size, false);
- if (size != (hwaddr)linesize * height) {
- cpu_physical_memory_unmap(data, size, 0, 0);
+ mapsize = size = stride * (height - 1) + linesize;
+ data = cpu_physical_memory_map(addr, &mapsize, false);
+ if (size != mapsize) {
+ cpu_physical_memory_unmap(data, mapsize, 0, 0);
return NULL;
}
surface = qemu_create_displaysurface_from(width, height,
- format, linesize, data);
+ format, stride, data);
pixman_image_set_destroy_function(surface->image,
ramfb_unmap_display_surface, NULL);
@@ -74,27 +78,26 @@ static DisplaySurface *ramfb_create_display_surface(int width, int height,
static void ramfb_fw_cfg_write(void *dev, off_t offset, size_t len)
{
RAMFBState *s = dev;
+ DisplaySurface *surface;
uint32_t fourcc, format, width, height;
hwaddr stride, addr;
- width = be32_to_cpu(s->cfg.width);
- height = be32_to_cpu(s->cfg.height);
- stride = be32_to_cpu(s->cfg.stride);
- fourcc = be32_to_cpu(s->cfg.fourcc);
- addr = be64_to_cpu(s->cfg.addr);
- format = qemu_drm_format_to_pixman(fourcc);
-
- fprintf(stderr, "%s: %dx%d @ 0x%" PRIx64 "\n", __func__,
- width, height, addr);
- if (s->locked) {
- fprintf(stderr, "%s: resolution locked, change rejected\n", __func__);
+ width = be32_to_cpu(s->cfg.width);
+ height = be32_to_cpu(s->cfg.height);
+ stride = be32_to_cpu(s->cfg.stride);
+ fourcc = be32_to_cpu(s->cfg.fourcc);
+ addr = be64_to_cpu(s->cfg.addr);
+ format = qemu_drm_format_to_pixman(fourcc);
+
+ surface = ramfb_create_display_surface(width, height,
+ format, stride, addr);
+ if (!surface) {
return;
}
- s->locked = true;
+
s->width = width;
s->height = height;
- s->ds = ramfb_create_display_surface(s->width, s->height,
- format, stride, addr);
+ s->ds = surface;
}
void ramfb_display_update(QemuConsole *con, RAMFBState *s)
@@ -112,16 +115,7 @@ void ramfb_display_update(QemuConsole *con, RAMFBState *s)
dpy_gfx_update_full(con);
}
-static void ramfb_reset(void *opaque)
-{
- RAMFBState *s = (RAMFBState *)opaque;
- s->locked = false;
- memset(&s->cfg, 0, sizeof(s->cfg));
- s->cfg.width = s->starting_width;
- s->cfg.height = s->starting_height;
-}
-
-RAMFBState *ramfb_setup(DeviceState* dev, Error **errp)
+RAMFBState *ramfb_setup(Error **errp)
{
FWCfgState *fw_cfg = fw_cfg_find();
RAMFBState *s;
@@ -133,22 +127,9 @@ RAMFBState *ramfb_setup(DeviceState* dev, Error **errp)
s = g_new0(RAMFBState, 1);
- const char *s_fb_width = qemu_opt_get(dev->opts, "xres");
- const char *s_fb_height = qemu_opt_get(dev->opts, "yres");
- if (s_fb_width) {
- s->cfg.width = atoi(s_fb_width);
- s->starting_width = s->cfg.width;
- }
- if (s_fb_height) {
- s->cfg.height = atoi(s_fb_height);
- s->starting_height = s->cfg.height;
- }
- s->locked = false;
-
rom_add_vga("vgabios-ramfb.bin");
fw_cfg_add_file_callback(fw_cfg, "etc/ramfb",
NULL, ramfb_fw_cfg_write, s,
&s->cfg, sizeof(s->cfg), false);
- qemu_register_reset(ramfb_reset, s);
return s;
}
diff --git a/hw/vfio/display.c b/hw/vfio/display.c
index f4977c66e1..a57a22674d 100644
--- a/hw/vfio/display.c
+++ b/hw/vfio/display.c
@@ -353,7 +353,7 @@ static int vfio_display_dmabuf_init(VFIOPCIDevice *vdev, Error **errp)
&vfio_display_dmabuf_ops,
vdev);
if (vdev->enable_ramfb) {
- vdev->dpy->ramfb = ramfb_setup(DEVICE(vdev), errp);
+ vdev->dpy->ramfb = ramfb_setup(errp);
}
vfio_display_edid_init(vdev);
return 0;
@@ -479,7 +479,7 @@ static int vfio_display_region_init(VFIOPCIDevice *vdev, Error **errp)
&vfio_display_region_ops,
vdev);
if (vdev->enable_ramfb) {
- vdev->dpy->ramfb = ramfb_setup(DEVICE(vdev), errp);
+ vdev->dpy->ramfb = ramfb_setup(errp);
}
return 0;
}
diff --git a/include/hw/display/ramfb.h b/include/hw/display/ramfb.h
index f6c2de93b2..b33a2c467b 100644
--- a/include/hw/display/ramfb.h
+++ b/include/hw/display/ramfb.h
@@ -4,7 +4,7 @@
/* ramfb.c */
typedef struct RAMFBState RAMFBState;
void ramfb_display_update(QemuConsole *con, RAMFBState *s);
-RAMFBState *ramfb_setup(DeviceState *dev, Error **errp);
+RAMFBState *ramfb_setup(Error **errp);
/* ramfb-standalone.c */
#define TYPE_RAMFB_DEVICE "ramfb"
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
index c9c54de1df..35f832816f 100644
--- a/qemu-img-cmds.hx
+++ b/qemu-img-cmds.hx
@@ -63,9 +63,9 @@ SRST
ERST
DEF("map", img_map,
- "map [--object objectdef] [--image-opts] [-f fmt] [--output=ofmt] [-U] filename")
+ "map [--object objectdef] [--image-opts] [-f fmt] [--start-offset=offset] [--max-length=len] [--output=ofmt] [-U] filename")
SRST
-.. option:: map [--object OBJECTDEF] [--image-opts] [-f FMT] [--output=OFMT] [-U] FILENAME
+.. option:: map [--object OBJECTDEF] [--image-opts] [-f FMT] [--start-offset=OFFSET] [--max-length=LEN] [--output=OFMT] [-U] FILENAME
ERST
DEF("measure", img_measure,
diff --git a/qemu-img.c b/qemu-img.c
index f1795c788c..2a9186139d 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -470,19 +470,31 @@ static int add_old_style_options(const char *fmt, QemuOpts *opts,
return 0;
}
-static int64_t cvtnum(const char *s)
+static int64_t cvtnum_full(const char *name, const char *value, int64_t min,
+ int64_t max)
{
int err;
- uint64_t value;
-
- err = qemu_strtosz(s, NULL, &value);
- if (err < 0) {
+ uint64_t res;
+
+ err = qemu_strtosz(value, NULL, &res);
+ if (err < 0 && err != -ERANGE) {
+ error_report("Invalid %s specified. You may use "
+ "k, M, G, T, P or E suffixes for", name);
+ error_report("kilobytes, megabytes, gigabytes, terabytes, "
+ "petabytes and exabytes.");
return err;
}
- if (value > INT64_MAX) {
+ if (err == -ERANGE || res > max || res < min) {
+ error_report("Invalid %s specified. Must be between %" PRId64
+ " and %" PRId64 ".", name, min, max);
return -ERANGE;
}
- return value;
+ return res;
+}
+
+static int64_t cvtnum(const char *name, const char *value)
+{
+ return cvtnum_full(name, value, 0, INT64_MAX);
}
static int img_create(int argc, char **argv)
@@ -572,16 +584,8 @@ static int img_create(int argc, char **argv)
if (optind < argc) {
int64_t sval;
- sval = cvtnum(argv[optind++]);
+ sval = cvtnum("image size", argv[optind++]);
if (sval < 0) {
- if (sval == -ERANGE) {
- error_report("Image size must be less than 8 EiB!");
- } else {
- error_report("Invalid image size specified! You may use k, M, "
- "G, T, P or E suffixes for ");
- error_report("kilobytes, megabytes, gigabytes, terabytes, "
- "petabytes and exabytes.");
- }
goto fail;
}
img_size = (uint64_t)sval;
@@ -2196,8 +2200,10 @@ static int img_convert(int argc, char **argv)
{
int64_t sval;
- sval = cvtnum(optarg);
- if (sval < 0 || !QEMU_IS_ALIGNED(sval, BDRV_SECTOR_SIZE) ||
+ sval = cvtnum("buffer size for sparse output", optarg);
+ if (sval < 0) {
+ goto fail_getopt;
+ } else if (!QEMU_IS_ALIGNED(sval, BDRV_SECTOR_SIZE) ||
sval / BDRV_SECTOR_SIZE > MAX_BUF_SECTORS) {
error_report("Invalid buffer size for sparse output specified. "
"Valid sizes are multiples of %llu up to %llu. Select "
@@ -2905,9 +2911,8 @@ static int dump_map_entry(OutputFormat output_format, MapEntry *e,
}
break;
case OFORMAT_JSON:
- printf("%s{ \"start\": %"PRId64", \"length\": %"PRId64","
+ printf("{ \"start\": %"PRId64", \"length\": %"PRId64","
" \"depth\": %"PRId64", \"zero\": %s, \"data\": %s",
- (e->start == 0 ? "[" : ",\n"),
e->start, e->length, e->depth,
e->zero ? "true" : "false",
e->data ? "true" : "false");
@@ -2916,8 +2921,8 @@ static int dump_map_entry(OutputFormat output_format, MapEntry *e,
}
putchar('}');
- if (!next) {
- printf("]\n");
+ if (next) {
+ puts(",");
}
break;
}
@@ -3013,6 +3018,8 @@ static int img_map(int argc, char **argv)
int ret = 0;
bool image_opts = false;
bool force_share = false;
+ int64_t start_offset = 0;
+ int64_t max_length = -1;
fmt = NULL;
output = NULL;
@@ -3025,9 +3032,11 @@ static int img_map(int argc, char **argv)
{"object", required_argument, 0, OPTION_OBJECT},
{"image-opts", no_argument, 0, OPTION_IMAGE_OPTS},
{"force-share", no_argument, 0, 'U'},
+ {"start-offset", required_argument, 0, 's'},
+ {"max-length", required_argument, 0, 'l'},
{0, 0, 0, 0}
};
- c = getopt_long(argc, argv, ":f:hU",
+ c = getopt_long(argc, argv, ":f:s:l:hU",
long_options, &option_index);
if (c == -1) {
break;
@@ -3051,6 +3060,18 @@ static int img_map(int argc, char **argv)
case OPTION_OUTPUT:
output = optarg;
break;
+ case 's':
+ start_offset = cvtnum("start offset", optarg);
+ if (start_offset < 0) {
+ return 1;
+ }
+ break;
+ case 'l':
+ max_length = cvtnum("max length", optarg);
+ if (max_length < 0) {
+ return 1;
+ }
+ break;
case OPTION_OBJECT: {
QemuOpts *opts;
opts = qemu_opts_parse_noisily(&qemu_object_opts,
@@ -3092,9 +3113,20 @@ static int img_map(int argc, char **argv)
if (output_format == OFORMAT_HUMAN) {
printf("%-16s%-16s%-16s%s\n", "Offset", "Length", "Mapped to", "File");
+ } else if (output_format == OFORMAT_JSON) {
+ putchar('[');
}
length = blk_getlength(blk);
+ if (length < 0) {
+ error_report("Failed to get size for '%s'", filename);
+ return 1;
+ }
+ if (max_length != -1) {
+ length = MIN(start_offset + max_length, length);
+ }
+
+ curr.start = start_offset;
while (curr.start + curr.length < length) {
int64_t offset = curr.start + curr.length;
int64_t n;
@@ -3123,6 +3155,9 @@ static int img_map(int argc, char **argv)
}
ret = dump_map_entry(output_format, &curr, NULL);
+ if (output_format == OFORMAT_JSON) {
+ puts("]");
+ }
out:
blk_unref(blk);
@@ -4300,9 +4335,8 @@ static int img_bench(int argc, char **argv)
break;
case 'o':
{
- offset = cvtnum(optarg);
+ offset = cvtnum("offset", optarg);
if (offset < 0) {
- error_report("Invalid offset specified");
return 1;
}
break;
@@ -4315,9 +4349,8 @@ static int img_bench(int argc, char **argv)
{
int64_t sval;
- sval = cvtnum(optarg);
- if (sval < 0 || sval > INT_MAX) {
- error_report("Invalid buffer size specified");
+ sval = cvtnum_full("buffer size", optarg, 0, INT_MAX);
+ if (sval < 0) {
return 1;
}
@@ -4328,9 +4361,8 @@ static int img_bench(int argc, char **argv)
{
int64_t sval;
- sval = cvtnum(optarg);
- if (sval < 0 || sval > INT_MAX) {
- error_report("Invalid step size specified");
+ sval = cvtnum_full("step_size", optarg, 0, INT_MAX);
+ if (sval < 0) {
return 1;
}
@@ -4500,10 +4532,9 @@ static int img_dd_bs(const char *arg,
{
int64_t res;
- res = cvtnum(arg);
+ res = cvtnum_full("bs", arg, 1, INT_MAX);
- if (res <= 0 || res > INT_MAX) {
- error_report("invalid number: '%s'", arg);
+ if (res < 0) {
return 1;
}
in->bsz = out->bsz = res;
@@ -4515,10 +4546,9 @@ static int img_dd_count(const char *arg,
struct DdIo *in, struct DdIo *out,
struct DdInfo *dd)
{
- dd->count = cvtnum(arg);
+ dd->count = cvtnum("count", arg);
if (dd->count < 0) {
- error_report("invalid number: '%s'", arg);
return 1;
}
@@ -4547,10 +4577,9 @@ static int img_dd_skip(const char *arg,
struct DdIo *in, struct DdIo *out,
struct DdInfo *dd)
{
- in->offset = cvtnum(arg);
+ in->offset = cvtnum("skip", arg);
if (in->offset < 0) {
- error_report("invalid number: '%s'", arg);
return 1;
}
@@ -4932,16 +4961,8 @@ static int img_measure(int argc, char **argv)
{
int64_t sval;
- sval = cvtnum(optarg);
+ sval = cvtnum("image size", optarg);
if (sval < 0) {
- if (sval == -ERANGE) {
- error_report("Image size must be less than 8 EiB!");
- } else {
- error_report("Invalid image size specified! You may use "
- "k, M, G, T, P or E suffixes for ");
- error_report("kilobytes, megabytes, gigabytes, terabytes, "
- "petabytes and exabytes.");
- }
goto out;
}
img_size = (uint64_t)sval;
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 4aa005004e..306e44fb0a 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -916,7 +916,11 @@ int main(int argc, char **argv)
} else if (pid == 0) {
close(stderr_fd[0]);
- old_stderr = dup(STDERR_FILENO);
+ /* Remember parent's stderr if we will be restoring it. */
+ if (fork_process) {
+ old_stderr = dup(STDERR_FILENO);
+ }
+
ret = qemu_daemon(1, 0);
/* Temporarily redirect stderr to the parent's pipe... */
diff --git a/stubs/ramfb.c b/stubs/ramfb.c
index 0799093a5d..48143f3354 100644
--- a/stubs/ramfb.c
+++ b/stubs/ramfb.c
@@ -6,7 +6,7 @@ void ramfb_display_update(QemuConsole *con, RAMFBState *s)
{
}
-RAMFBState *ramfb_setup(DeviceState* dev, Error **errp)
+RAMFBState *ramfb_setup(Error **errp)
{
error_setg(errp, "ramfb support not available");
return NULL;
diff --git a/tests/qemu-iotests/049.out b/tests/qemu-iotests/049.out
index a5cfba1756..c54ae21b86 100644
--- a/tests/qemu-iotests/049.out
+++ b/tests/qemu-iotests/049.out
@@ -92,19 +92,19 @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=1649267441664 cluster_size=65536 l
== 3. Invalid sizes ==
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- -1024
-qemu-img: Image size must be less than 8 EiB!
+qemu-img: Invalid image size specified. Must be between 0 and 9223372036854775807.
qemu-img create -f qcow2 -o size=-1024 TEST_DIR/t.qcow2
qemu-img: TEST_DIR/t.qcow2: Value '-1024' is out of range for parameter 'size'
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- -1k
-qemu-img: Image size must be less than 8 EiB!
+qemu-img: Invalid image size specified. Must be between 0 and 9223372036854775807.
qemu-img create -f qcow2 -o size=-1k TEST_DIR/t.qcow2
qemu-img: TEST_DIR/t.qcow2: Value '-1k' is out of range for parameter 'size'
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- 1kilobyte
-qemu-img: Invalid image size specified! You may use k, M, G, T, P or E suffixes for
+qemu-img: Invalid image size specified. You may use k, M, G, T, P or E suffixes for
qemu-img: kilobytes, megabytes, gigabytes, terabytes, petabytes and exabytes.
qemu-img create -f qcow2 -o size=1kilobyte TEST_DIR/t.qcow2
@@ -113,7 +113,7 @@ Optional suffix k, M, G, T, P or E means kilo-, mega-, giga-, tera-, peta-
and exabytes, respectively.
qemu-img create -f qcow2 TEST_DIR/t.qcow2 -- foobar
-qemu-img: Invalid image size specified! You may use k, M, G, T, P or E suffixes for
+qemu-img: Invalid image size specified. You may use k, M, G, T, P or E suffixes for
qemu-img: kilobytes, megabytes, gigabytes, terabytes, petabytes and exabytes.
qemu-img create -f qcow2 -o size=foobar TEST_DIR/t.qcow2
diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
index 56fbc5fb09..d68bc3cb6f 100755
--- a/tests/qemu-iotests/223
+++ b/tests/qemu-iotests/223
@@ -2,7 +2,7 @@
#
# Test reading dirty bitmap over NBD
#
-# Copyright (C) 2018-2019 Red Hat, Inc.
+# Copyright (C) 2018-2020 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -206,7 +206,9 @@ $QEMU_IMG map --output=json --image-opts \
nbd_server_start_unix_socket -f $IMGFMT -B b2 "$TEST_IMG"
IMG="driver=nbd,server.type=unix,server.path=$nbd_unix_socket"
-$QEMU_IMG map --output=json --image-opts \
+$QEMU_IMG map --output=json --image-opts --max-length=12345 \
+ "$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b2" | _filter_qemu_img_map
+$QEMU_IMG map --output=json --image-opts --start-offset=12345 \
"$IMG,x-dirty-bitmap=qemu:dirty-bitmap:b2" | _filter_qemu_img_map
# success, all done
diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out
index 80c0cf6509..e1eaaedb55 100644
--- a/tests/qemu-iotests/223.out
+++ b/tests/qemu-iotests/223.out
@@ -201,6 +201,7 @@ read 2097152/2097152 bytes at offset 2097152
{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
[{ "start": 0, "length": 512, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
{ "start": 512, "length": 512, "depth": 0, "zero": false, "data": false},
-{ "start": 1024, "length": 2096128, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
+{ "start": 1024, "length": 11321, "depth": 0, "zero": false, "data": true, "offset": OFFSET}]
+[{ "start": 12345, "length": 2084807, "depth": 0, "zero": false, "data": true, "offset": OFFSET},
{ "start": 2097152, "length": 2097152, "depth": 0, "zero": false, "data": false}]
*** done