Revision 587da2c3

b/Makefile
186 186

  
187 187
qemu-img$(EXESUF): qemu-img.o $(block-obj-y) libqemuutil.a libqemustub.a
188 188
qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) libqemuutil.a libqemustub.a
189
qemu-io$(EXESUF): qemu-io.o qemu-io-cmds.o $(block-obj-y) libqemuutil.a libqemustub.a
189
qemu-io$(EXESUF): qemu-io.o $(block-obj-y) libqemuutil.a libqemustub.a
190 190

  
191 191
qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
192 192

  
b/Makefile.objs
13 13
block-obj-$(CONFIG_WIN32) += aio-win32.o
14 14
block-obj-y += block/
15 15
block-obj-y += qapi-types.o qapi-visit.o
16
block-obj-y += qemu-io-cmds.o
16 17

  
17 18
block-obj-y += qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o
18 19
block-obj-y += qemu-coroutine-sleep.o
b/hmp-commands.hx
1553 1553
ETEXI
1554 1554

  
1555 1555
    {
1556
        .name       = "qemu-io",
1557
        .args_type  = "device:B,command:s",
1558
        .params     = "[device] \"[command]\"",
1559
        .help       = "run a qemu-io command on a block device",
1560
        .mhandler.cmd = hmp_qemu_io,
1561
    },
1562

  
1563
STEXI
1564
@item qemu-io @var{device} @var{command}
1565
@findex qemu-io
1566

  
1567
Executes a qemu-io command on the given block device.
1568

  
1569
ETEXI
1570

  
1571
    {
1556 1572
        .name       = "info",
1557 1573
        .args_type  = "item:s?",
1558 1574
        .params     = "[subcommand]",
b/hmp.c
22 22
#include "qemu/sockets.h"
23 23
#include "monitor/monitor.h"
24 24
#include "ui/console.h"
25
#include "qemu-io.h"
25 26

  
26 27
static void hmp_handle_error(Monitor *mon, Error **errp)
27 28
{
......
1425 1426
    qmp_chardev_remove(qdict_get_str(qdict, "id"), &local_err);
1426 1427
    hmp_handle_error(mon, &local_err);
1427 1428
}
1429

  
1430
void hmp_qemu_io(Monitor *mon, const QDict *qdict)
1431
{
1432
    BlockDriverState *bs;
1433
    const char* device = qdict_get_str(qdict, "device");
1434
    const char* command = qdict_get_str(qdict, "command");
1435
    Error *err = NULL;
1436

  
1437
    bs = bdrv_find(device);
1438
    if (bs) {
1439
        qemuio_command(bs, command);
1440
    } else {
1441
        error_set(&err, QERR_DEVICE_NOT_FOUND, device);
1442
    }
1443

  
1444
    hmp_handle_error(mon, &err);
1445
}
b/hmp.h
85 85
void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict);
86 86
void hmp_chardev_add(Monitor *mon, const QDict *qdict);
87 87
void hmp_chardev_remove(Monitor *mon, const QDict *qdict);
88
void hmp_qemu_io(Monitor *mon, const QDict *qdict);
88 89

  
89 90
#endif

Also available in: Unified diff