Now that all handlers are converted to cmd_new_ret(), we can rename
it back to cmd_new(). But now it returns a value.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
const char *params;
const char *help;
void (*user_print)(Monitor *mon, const QObject *data);
const char *params;
const char *help;
void (*user_print)(Monitor *mon, const QObject *data);
- int (*cmd_new_ret)(Monitor *mon, const QDict *params, QObject **ret_data);
union {
void (*info)(Monitor *mon);
void (*info_new)(Monitor *mon, QObject **ret_data);
int (*info_async)(Monitor *mon, MonitorCompletion *cb, void *opaque);
void (*cmd)(Monitor *mon, const QDict *qdict);
union {
void (*info)(Monitor *mon);
void (*info_new)(Monitor *mon, QObject **ret_data);
int (*info_async)(Monitor *mon, MonitorCompletion *cb, void *opaque);
void (*cmd)(Monitor *mon, const QDict *qdict);
- void (*cmd_new)(Monitor *mon, const QDict *params, QObject **ret_data);
+ int (*cmd_new)(Monitor *mon, const QDict *params, QObject **ret_data);
int (*cmd_async)(Monitor *mon, const QDict *params,
MonitorCompletion *cb, void *opaque);
} mhandler;
int (*cmd_async)(Monitor *mon, const QDict *params,
MonitorCompletion *cb, void *opaque);
} mhandler;
- if (cmd->cmd_new_ret) {
- cmd->cmd_new_ret(mon, params, &data);
- } else {
- cmd->mhandler.cmd_new(mon, params, &data);
- }
+ cmd->mhandler.cmd_new(mon, params, &data);
if (is_async_return(data)) {
/*
if (is_async_return(data)) {
/*
.params = "[subcommand]",
.help = "show various information about the system state",
.user_print = monitor_user_noop,
.params = "[subcommand]",
.help = "show various information about the system state",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_info,
+ .mhandler.cmd_new = do_info,
.params = "",
.help = "quit the emulator",
.user_print = monitor_user_noop,
.params = "",
.help = "quit the emulator",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_quit,
+ .mhandler.cmd_new = do_quit,
.params = "[-f] device",
.help = "eject a removable medium (use -f to force it)",
.user_print = monitor_user_noop,
.params = "[-f] device",
.help = "eject a removable medium (use -f to force it)",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_eject,
+ .mhandler.cmd_new = do_eject,
.params = "device filename [format]",
.help = "change a removable medium, optional format",
.user_print = monitor_user_noop,
.params = "device filename [format]",
.help = "change a removable medium, optional format",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_change,
+ .mhandler.cmd_new = do_change,
.params = "",
.help = "stop emulation",
.user_print = monitor_user_noop,
.params = "",
.help = "stop emulation",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_stop,
+ .mhandler.cmd_new = do_stop,
.params = "",
.help = "resume emulation",
.user_print = monitor_user_noop,
.params = "",
.help = "resume emulation",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_cont,
+ .mhandler.cmd_new = do_cont,
.params = "",
.help = "reset the system",
.user_print = monitor_user_noop,
.params = "",
.help = "reset the system",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_system_reset,
+ .mhandler.cmd_new = do_system_reset,
.params = "",
.help = "send system power down event",
.user_print = monitor_user_noop,
.params = "",
.help = "send system power down event",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_system_powerdown,
+ .mhandler.cmd_new = do_system_powerdown,
.params = "index",
.help = "set the default CPU",
.user_print = monitor_user_noop,
.params = "index",
.help = "set the default CPU",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_cpu_set,
+ .mhandler.cmd_new = do_cpu_set,
.params = "addr size file",
.help = "save to disk virtual memory dump starting at 'addr' of size 'size'",
.user_print = monitor_user_noop,
.params = "addr size file",
.help = "save to disk virtual memory dump starting at 'addr' of size 'size'",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_memory_save,
+ .mhandler.cmd_new = do_memory_save,
.params = "addr size file",
.help = "save to disk physical memory dump starting at 'addr' of size 'size'",
.user_print = monitor_user_noop,
.params = "addr size file",
.help = "save to disk physical memory dump starting at 'addr' of size 'size'",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_physical_memory_save,
+ .mhandler.cmd_new = do_physical_memory_save,
"shared storage with incremental copy of disk "
"(base image shared between src and destination)",
.user_print = monitor_user_noop,
"shared storage with incremental copy of disk "
"(base image shared between src and destination)",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_migrate,
+ .mhandler.cmd_new = do_migrate,
.params = "",
.help = "cancel the current VM migration",
.user_print = monitor_user_noop,
.params = "",
.help = "cancel the current VM migration",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_migrate_cancel,
+ .mhandler.cmd_new = do_migrate_cancel,
.params = "value",
.help = "set maximum speed (in bytes) for migrations",
.user_print = monitor_user_noop,
.params = "value",
.help = "set maximum speed (in bytes) for migrations",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_migrate_set_speed,
+ .mhandler.cmd_new = do_migrate_set_speed,
.params = "value",
.help = "set maximum tolerated downtime (in seconds) for migrations",
.user_print = monitor_user_noop,
.params = "value",
.help = "set maximum tolerated downtime (in seconds) for migrations",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_migrate_set_downtime,
+ .mhandler.cmd_new = do_migrate_set_downtime,
.params = "auto|[[<domain>:]<bus>:]<slot> nic|storage [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]...",
.help = "hot-add PCI device",
.user_print = pci_device_hot_add_print,
.params = "auto|[[<domain>:]<bus>:]<slot> nic|storage [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]...",
.help = "hot-add PCI device",
.user_print = pci_device_hot_add_print,
- .cmd_new_ret = pci_device_hot_add,
+ .mhandler.cmd_new = pci_device_hot_add,
.params = "[[<domain>:]<bus>:]<slot>",
.help = "hot remove PCI device",
.user_print = monitor_user_noop,
.params = "[[<domain>:]<bus>:]<slot>",
.help = "hot remove PCI device",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_pci_device_hot_remove,
+ .mhandler.cmd_new = do_pci_device_hot_remove,
.params = "getfd name",
.help = "receive a file descriptor via SCM rights and assign it a name",
.user_print = monitor_user_noop,
.params = "getfd name",
.help = "receive a file descriptor via SCM rights and assign it a name",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_getfd,
+ .mhandler.cmd_new = do_getfd,
.params = "closefd name",
.help = "close a file descriptor previously passed via SCM rights",
.user_print = monitor_user_noop,
.params = "closefd name",
.help = "close a file descriptor previously passed via SCM rights",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_closefd,
+ .mhandler.cmd_new = do_closefd,
.params = "block_passwd device password",
.help = "set the password of encrypted block devices",
.user_print = monitor_user_noop,
.params = "block_passwd device password",
.help = "set the password of encrypted block devices",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_block_set_passwd,
+ .mhandler.cmd_new = do_block_set_passwd,
.params = "",
.help = "enable QMP capabilities",
.user_print = monitor_user_noop,
.params = "",
.help = "enable QMP capabilities",
.user_print = monitor_user_noop,
- .cmd_new_ret = do_qmp_capabilities,
+ .mhandler.cmd_new = do_qmp_capabilities,