HMP: add QDict to info callback handler

This patch change all info call back function to take
additional QDict * parameter, which allow those command
take parameter. Now it is set to NULL at default case.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
Wenchao Xia 2013-01-14 14:06:25 +08:00 committed by Luiz Capitulino
parent 47f4dac3fd
commit 84f2d0ea0f
25 changed files with 84 additions and 83 deletions

36
hmp.c
View File

@ -31,7 +31,7 @@ static void hmp_handle_error(Monitor *mon, Error **errp)
}
}
void hmp_info_name(Monitor *mon)
void hmp_info_name(Monitor *mon, const QDict *qdict)
{
NameInfo *info;
@ -42,7 +42,7 @@ void hmp_info_name(Monitor *mon)
qapi_free_NameInfo(info);
}
void hmp_info_version(Monitor *mon)
void hmp_info_version(Monitor *mon, const QDict *qdict)
{
VersionInfo *info;
@ -55,7 +55,7 @@ void hmp_info_version(Monitor *mon)
qapi_free_VersionInfo(info);
}
void hmp_info_kvm(Monitor *mon)
void hmp_info_kvm(Monitor *mon, const QDict *qdict)
{
KvmInfo *info;
@ -70,7 +70,7 @@ void hmp_info_kvm(Monitor *mon)
qapi_free_KvmInfo(info);
}
void hmp_info_status(Monitor *mon)
void hmp_info_status(Monitor *mon, const QDict *qdict)
{
StatusInfo *info;
@ -89,7 +89,7 @@ void hmp_info_status(Monitor *mon)
qapi_free_StatusInfo(info);
}
void hmp_info_uuid(Monitor *mon)
void hmp_info_uuid(Monitor *mon, const QDict *qdict)
{
UuidInfo *info;
@ -98,7 +98,7 @@ void hmp_info_uuid(Monitor *mon)
qapi_free_UuidInfo(info);
}
void hmp_info_chardev(Monitor *mon)
void hmp_info_chardev(Monitor *mon, const QDict *qdict)
{
ChardevInfoList *char_info, *info;
@ -111,7 +111,7 @@ void hmp_info_chardev(Monitor *mon)
qapi_free_ChardevInfoList(char_info);
}
void hmp_info_mice(Monitor *mon)
void hmp_info_mice(Monitor *mon, const QDict *qdict)
{
MouseInfoList *mice_list, *mouse;
@ -131,7 +131,7 @@ void hmp_info_mice(Monitor *mon)
qapi_free_MouseInfoList(mice_list);
}
void hmp_info_migrate(Monitor *mon)
void hmp_info_migrate(Monitor *mon, const QDict *qdict)
{
MigrationInfo *info;
MigrationCapabilityStatusList *caps, *cap;
@ -209,7 +209,7 @@ void hmp_info_migrate(Monitor *mon)
qapi_free_MigrationCapabilityStatusList(caps);
}
void hmp_info_migrate_capabilities(Monitor *mon)
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict)
{
MigrationCapabilityStatusList *caps, *cap;
@ -228,13 +228,13 @@ void hmp_info_migrate_capabilities(Monitor *mon)
qapi_free_MigrationCapabilityStatusList(caps);
}
void hmp_info_migrate_cache_size(Monitor *mon)
void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict)
{
monitor_printf(mon, "xbzrel cache size: %" PRId64 " kbytes\n",
qmp_query_migrate_cache_size(NULL) >> 10);
}
void hmp_info_cpus(Monitor *mon)
void hmp_info_cpus(Monitor *mon, const QDict *qdict)
{
CpuInfoList *cpu_list, *cpu;
@ -272,7 +272,7 @@ void hmp_info_cpus(Monitor *mon)
qapi_free_CpuInfoList(cpu_list);
}
void hmp_info_block(Monitor *mon)
void hmp_info_block(Monitor *mon, const QDict *qdict)
{
BlockInfoList *block_list, *info;
@ -326,7 +326,7 @@ void hmp_info_block(Monitor *mon)
qapi_free_BlockInfoList(block_list);
}
void hmp_info_blockstats(Monitor *mon)
void hmp_info_blockstats(Monitor *mon, const QDict *qdict)
{
BlockStatsList *stats_list, *stats;
@ -360,7 +360,7 @@ void hmp_info_blockstats(Monitor *mon)
qapi_free_BlockStatsList(stats_list);
}
void hmp_info_vnc(Monitor *mon)
void hmp_info_vnc(Monitor *mon, const QDict *qdict)
{
VncInfo *info;
Error *err = NULL;
@ -406,7 +406,7 @@ out:
qapi_free_VncInfo(info);
}
void hmp_info_spice(Monitor *mon)
void hmp_info_spice(Monitor *mon, const QDict *qdict)
{
SpiceChannelList *chan;
SpiceInfo *info;
@ -453,7 +453,7 @@ out:
qapi_free_SpiceInfo(info);
}
void hmp_info_balloon(Monitor *mon)
void hmp_info_balloon(Monitor *mon, const QDict *qdict)
{
BalloonInfo *info;
Error *err = NULL;
@ -570,7 +570,7 @@ static void hmp_info_pci_device(Monitor *mon, const PciDeviceInfo *dev)
}
}
void hmp_info_pci(Monitor *mon)
void hmp_info_pci(Monitor *mon, const QDict *qdict)
{
PciInfoList *info_list, *info;
Error *err = NULL;
@ -593,7 +593,7 @@ void hmp_info_pci(Monitor *mon)
qapi_free_PciInfoList(info_list);
}
void hmp_info_block_jobs(Monitor *mon)
void hmp_info_block_jobs(Monitor *mon, const QDict *qdict)
{
BlockJobInfoList *list;
Error *err = NULL;

36
hmp.h
View File

@ -18,24 +18,24 @@
#include "qapi-types.h"
#include "qapi/qmp/qdict.h"
void hmp_info_name(Monitor *mon);
void hmp_info_version(Monitor *mon);
void hmp_info_kvm(Monitor *mon);
void hmp_info_status(Monitor *mon);
void hmp_info_uuid(Monitor *mon);
void hmp_info_chardev(Monitor *mon);
void hmp_info_mice(Monitor *mon);
void hmp_info_migrate(Monitor *mon);
void hmp_info_migrate_capabilities(Monitor *mon);
void hmp_info_migrate_cache_size(Monitor *mon);
void hmp_info_cpus(Monitor *mon);
void hmp_info_block(Monitor *mon);
void hmp_info_blockstats(Monitor *mon);
void hmp_info_vnc(Monitor *mon);
void hmp_info_spice(Monitor *mon);
void hmp_info_balloon(Monitor *mon);
void hmp_info_pci(Monitor *mon);
void hmp_info_block_jobs(Monitor *mon);
void hmp_info_name(Monitor *mon, const QDict *qdict);
void hmp_info_version(Monitor *mon, const QDict *qdict);
void hmp_info_kvm(Monitor *mon, const QDict *qdict);
void hmp_info_status(Monitor *mon, const QDict *qdict);
void hmp_info_uuid(Monitor *mon, const QDict *qdict);
void hmp_info_chardev(Monitor *mon, const QDict *qdict);
void hmp_info_mice(Monitor *mon, const QDict *qdict);
void hmp_info_migrate(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict);
void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict);
void hmp_info_cpus(Monitor *mon, const QDict *qdict);
void hmp_info_block(Monitor *mon, const QDict *qdict);
void hmp_info_blockstats(Monitor *mon, const QDict *qdict);
void hmp_info_vnc(Monitor *mon, const QDict *qdict);
void hmp_info_spice(Monitor *mon, const QDict *qdict);
void hmp_info_balloon(Monitor *mon, const QDict *qdict);
void hmp_info_pci(Monitor *mon, const QDict *qdict);
void hmp_info_block_jobs(Monitor *mon, const QDict *qdict);
void hmp_quit(Monitor *mon, const QDict *qdict);
void hmp_stop(Monitor *mon, const QDict *qdict);
void hmp_system_reset(Monitor *mon, const QDict *qdict);

View File

@ -407,7 +407,7 @@ static void pic_init(PICCommonState *s)
qdev_init_gpio_in(&s->dev.qdev, pic_set_irq, 8);
}
void pic_info(Monitor *mon)
void pic_info(Monitor *mon, const QDict *qdict)
{
int i;
PICCommonState *s;
@ -425,7 +425,7 @@ void pic_info(Monitor *mon)
}
}
void irq_info(Monitor *mon)
void irq_info(Monitor *mon, const QDict *qdict)
{
#ifndef DEBUG_IRQ_COUNT
monitor_printf(mon, "irq statistic code not compiled.\n");

View File

@ -39,7 +39,7 @@ struct LM32PicState {
typedef struct LM32PicState LM32PicState;
static LM32PicState *pic;
void lm32_do_pic_info(Monitor *mon)
void lm32_do_pic_info(Monitor *mon, const QDict *qdict)
{
if (pic == NULL) {
return;
@ -49,7 +49,7 @@ void lm32_do_pic_info(Monitor *mon)
pic->im, pic->ip, pic->irq_state);
}
void lm32_irq_info(Monitor *mon)
void lm32_irq_info(Monitor *mon, const QDict *qdict)
{
int i;
uint32_t count;

View File

@ -8,7 +8,7 @@ uint32_t lm32_pic_get_im(DeviceState *d);
void lm32_pic_set_ip(DeviceState *d, uint32_t ip);
void lm32_pic_set_im(DeviceState *d, uint32_t im);
void lm32_do_pic_info(Monitor *mon);
void lm32_irq_info(Monitor *mon);
void lm32_do_pic_info(Monitor *mon, const QDict *qdict);
void lm32_irq_info(Monitor *mon, const QDict *qdict);
#endif /* QEMU_HW_LM32_PIC_H */

View File

@ -778,7 +778,7 @@ void *rom_ptr(hwaddr addr)
return rom->data + (addr - rom->addr);
}
void do_info_roms(Monitor *mon)
void do_info_roms(Monitor *mon, const QDict *qdict)
{
Rom *rom;

View File

@ -1,5 +1,6 @@
#ifndef LOADER_H
#define LOADER_H
#include "qapi/qmp/qdict.h"
/* loader.c */
int get_image_size(const char *filename);
@ -30,7 +31,7 @@ int rom_load_all(void);
void rom_set_fw(void *f);
int rom_copy(uint8_t *dest, hwaddr addr, size_t size);
void *rom_ptr(hwaddr addr);
void do_info_roms(Monitor *mon);
void do_info_roms(Monitor *mon, const QDict *qdict);
#define rom_add_file_fixed(_f, _a, _i) \
rom_add_file(_f, NULL, _a, _i)

View File

@ -40,8 +40,8 @@ qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq);
qemu_irq *kvm_i8259_init(ISABus *bus);
int pic_read_irq(DeviceState *d);
int pic_get_output(DeviceState *d);
void pic_info(Monitor *mon);
void irq_info(Monitor *mon);
void pic_info(Monitor *mon, const QDict *qdict);
void irq_info(Monitor *mon, const QDict *qdict);
/* Global System Interrupts */

View File

@ -14,7 +14,7 @@ typedef struct {
void pcmcia_socket_register(PCMCIASocket *socket);
void pcmcia_socket_unregister(PCMCIASocket *socket);
void pcmcia_info(Monitor *mon);
void pcmcia_info(Monitor *mon, const QDict *qdict);
struct PCMCIACardState {
void *state;

View File

@ -564,13 +564,13 @@ static void qbus_print(Monitor *mon, BusState *bus, int indent)
}
#undef qdev_printf
void do_info_qtree(Monitor *mon)
void do_info_qtree(Monitor *mon, const QDict *qdict)
{
if (sysbus_get_default())
qbus_print(mon, sysbus_get_default(), 0);
}
void do_info_qdm(Monitor *mon)
void do_info_qdm(Monitor *mon, const QDict *qdict)
{
object_class_foreach(qdev_print_devinfo, TYPE_DEVICE, false, NULL);
}

View File

@ -6,8 +6,8 @@
/*** monitor commands ***/
void do_info_qtree(Monitor *mon);
void do_info_qdm(Monitor *mon);
void do_info_qtree(Monitor *mon, const QDict *qdict);
void do_info_qdm(Monitor *mon, const QDict *qdict);
int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data);
int do_device_del(Monitor *mon, const QDict *qdict, QObject **ret_data);
int qdev_device_help(QemuOpts *opts);

View File

@ -216,13 +216,13 @@ static void nvram_init(M48t59State *nvram, uint8_t *macaddr,
static DeviceState *slavio_intctl;
void sun4m_pic_info(Monitor *mon)
void sun4m_pic_info(Monitor *mon, const QDict *qdict)
{
if (slavio_intctl)
slavio_pic_info(mon, slavio_intctl);
}
void sun4m_irq_info(Monitor *mon)
void sun4m_irq_info(Monitor *mon, const QDict *qdict)
{
if (slavio_intctl)
slavio_irq_info(mon, slavio_intctl);

View File

@ -27,8 +27,8 @@ void slavio_pic_info(Monitor *mon, DeviceState *dev);
void slavio_irq_info(Monitor *mon, DeviceState *dev);
/* sun4m.c */
void sun4m_pic_info(Monitor *mon);
void sun4m_irq_info(Monitor *mon);
void sun4m_pic_info(Monitor *mon, const QDict *qdict);
void sun4m_irq_info(Monitor *mon, const QDict *qdict);
/* sparc32_dma.c */
#include "sparc32_dma.h"

View File

@ -435,7 +435,7 @@ int set_usb_string(uint8_t *buf, const char *str);
/* usb-linux.c */
USBDevice *usb_host_device_open(USBBus *bus, const char *devname);
int usb_host_device_close(const char *devname);
void usb_host_info(Monitor *mon);
void usb_host_info(Monitor *mon, const QDict *qdict);
/* usb-bt.c */
USBDevice *usb_bt_init(USBBus *bus, HCIInfo *hci);

View File

@ -542,7 +542,7 @@ static char *usb_get_fw_dev_path(DeviceState *qdev)
return fw_path;
}
void usb_info(Monitor *mon)
void usb_info(Monitor *mon, const QDict *qdict)
{
USBBus *bus;
USBDevice *dev;

View File

@ -633,7 +633,7 @@ static int usb_host_info_device(void *opaque,
return 0;
}
void usb_host_info(Monitor *mon)
void usb_host_info(Monitor *mon, const QDict *qdict)
{
usb_host_scan(mon, usb_host_info_device);
}

View File

@ -1998,7 +1998,7 @@ static void hex2str(int val, char *str, size_t size)
}
}
void usb_host_info(Monitor *mon)
void usb_host_info(Monitor *mon, const QDict *qdict)
{
struct USBAutoFilter *f;
struct USBHostDevice *s;

View File

@ -112,7 +112,7 @@ ssize_t qemu_deliver_packet_iov(NetClientState *sender,
void *opaque);
void print_net_client(Monitor *mon, NetClientState *nc);
void do_info_network(Monitor *mon);
void do_info_network(Monitor *mon, const QDict *qdict);
/* NIC info */

View File

@ -40,7 +40,7 @@ int net_slirp_parse_legacy(QemuOptsList *opts_list, const char *optarg, int *ret
int net_slirp_smb(const char *exported_dir);
void do_info_usernet(Monitor *mon);
void do_info_usernet(Monitor *mon, const QDict *qdict);
#endif

View File

@ -68,7 +68,7 @@ void qemu_add_machine_init_done_notifier(Notifier *notify);
void do_savevm(Monitor *mon, const QDict *qdict);
int load_vmstate(const char *name);
void do_delvm(Monitor *mon, const QDict *qdict);
void do_info_snapshots(Monitor *mon);
void do_info_snapshots(Monitor *mon, const QDict *qdict);
void qemu_announce_self(void);
@ -171,7 +171,7 @@ extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
void do_usb_add(Monitor *mon, const QDict *qdict);
void do_usb_del(Monitor *mon, const QDict *qdict);
void usb_info(Monitor *mon);
void usb_info(Monitor *mon, const QDict *qdict);
void rtc_change_mon_event(struct tm *tm);

View File

@ -123,7 +123,7 @@ typedef struct mon_cmd_t {
const char *help;
void (*user_print)(Monitor *mon, const QObject *data);
union {
void (*info)(Monitor *mon);
void (*info)(Monitor *mon, const QDict *qdict);
void (*cmd)(Monitor *mon, const QDict *qdict);
int (*cmd_new)(Monitor *mon, const QDict *params, QObject **ret_data);
int (*cmd_async)(Monitor *mon, const QDict *params,
@ -825,7 +825,7 @@ static void do_info(Monitor *mon, const QDict *qdict)
goto help;
}
cmd->mhandler.info(mon);
cmd->mhandler.info(mon, NULL);
return;
help:
@ -899,19 +899,19 @@ int monitor_get_cpu_index(void)
return cpu->cpu_index;
}
static void do_info_registers(Monitor *mon)
static void do_info_registers(Monitor *mon, const QDict *qdict)
{
CPUArchState *env;
env = mon_get_cpu();
cpu_dump_state(env, (FILE *)mon, monitor_fprintf, CPU_DUMP_FPU);
}
static void do_info_jit(Monitor *mon)
static void do_info_jit(Monitor *mon, const QDict *qdict)
{
dump_exec_info((FILE *)mon, monitor_fprintf);
}
static void do_info_history(Monitor *mon)
static void do_info_history(Monitor *mon, const QDict *qdict)
{
int i;
const char *str;
@ -930,7 +930,7 @@ static void do_info_history(Monitor *mon)
#if defined(TARGET_PPC)
/* XXX: not implemented in other targets */
static void do_info_cpu_stats(Monitor *mon)
static void do_info_cpu_stats(Monitor *mon, const QDict *qdict)
{
CPUArchState *env;
@ -939,7 +939,7 @@ static void do_info_cpu_stats(Monitor *mon)
}
#endif
static void do_trace_print_events(Monitor *mon)
static void do_trace_print_events(Monitor *mon, const QDict *qdict)
{
trace_print_events((FILE *)mon, &monitor_fprintf);
}
@ -1491,7 +1491,7 @@ static void tlb_info_64(Monitor *mon, CPUArchState *env)
}
#endif
static void tlb_info(Monitor *mon)
static void tlb_info(Monitor *mon, const QDict *qdict)
{
CPUArchState *env;
@ -1714,7 +1714,7 @@ static void mem_info_64(Monitor *mon, CPUArchState *env)
}
#endif
static void mem_info(Monitor *mon)
static void mem_info(Monitor *mon, const QDict *qdict)
{
CPUArchState *env;
@ -1753,7 +1753,7 @@ static void print_tlb(Monitor *mon, int idx, tlb_t *tlb)
tlb->d, tlb->wt);
}
static void tlb_info(Monitor *mon)
static void tlb_info(Monitor *mon, const QDict *qdict)
{
CPUArchState *env = mon_get_cpu();
int i;
@ -1769,7 +1769,7 @@ static void tlb_info(Monitor *mon)
#endif
#if defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_XTENSA)
static void tlb_info(Monitor *mon)
static void tlb_info(Monitor *mon, const QDict *qdict)
{
CPUArchState *env1 = mon_get_cpu();
@ -1777,12 +1777,12 @@ static void tlb_info(Monitor *mon)
}
#endif
static void do_info_mtree(Monitor *mon)
static void do_info_mtree(Monitor *mon, const QDict *qdict)
{
mtree_info((fprintf_function)monitor_printf, mon);
}
static void do_info_numa(Monitor *mon)
static void do_info_numa(Monitor *mon, const QDict *qdict)
{
int i;
CPUArchState *env;
@ -1808,7 +1808,7 @@ static void do_info_numa(Monitor *mon)
int64_t qemu_time;
int64_t dev_time;
static void do_info_profile(Monitor *mon)
static void do_info_profile(Monitor *mon, const QDict *qdict)
{
int64_t total;
total = qemu_time;
@ -1822,7 +1822,7 @@ static void do_info_profile(Monitor *mon)
dev_time = 0;
}
#else
static void do_info_profile(Monitor *mon)
static void do_info_profile(Monitor *mon, const QDict *qdict)
{
monitor_printf(mon, "Internal profiler not compiled\n");
}
@ -1831,7 +1831,7 @@ static void do_info_profile(Monitor *mon)
/* Capture support */
static QLIST_HEAD (capture_list_head, CaptureState) capture_head;
static void do_info_capture(Monitor *mon)
static void do_info_capture(Monitor *mon, const QDict *qdict)
{
int i;
CaptureState *s;

View File

@ -852,7 +852,7 @@ void print_net_client(Monitor *mon, NetClientState *nc)
NetClientOptionsKind_lookup[nc->info->type], nc->info_str);
}
void do_info_network(Monitor *mon)
void do_info_network(Monitor *mon, const QDict *qdict)
{
NetClientState *nc, *peer;
NetClientOptionsKind type;

View File

@ -670,7 +670,7 @@ static int slirp_guestfwd(SlirpState *s, const char *config_str,
return -1;
}
void do_info_usernet(Monitor *mon)
void do_info_usernet(Monitor *mon, const QDict *qdict)
{
SlirpState *s;

View File

@ -2307,7 +2307,7 @@ void do_delvm(Monitor *mon, const QDict *qdict)
}
}
void do_info_snapshots(Monitor *mon)
void do_info_snapshots(Monitor *mon, const QDict *qdict)
{
BlockDriverState *bs, *bs1;
QEMUSnapshotInfo *sn_tab, *sn, s, *sn_info = &s;

2
vl.c
View File

@ -1449,7 +1449,7 @@ void pcmcia_socket_unregister(PCMCIASocket *socket)
}
}
void pcmcia_info(Monitor *mon)
void pcmcia_info(Monitor *mon, const QDict *qdict)
{
struct pcmcia_socket_entry_s *iter;