diff --git a/monitor.c b/monitor.c
index c0569d5..2bf82f3 100644
--- a/monitor.c
+++ b/monitor.c
@@ -71,11 +71,11 @@
 typedef struct mon_cmd_t {
     const char *name;
     const char *args_type;
-    void *handler;
     const char *params;
     const char *help;
     union {
         void (*info)(Monitor *mon);
+        void (*cmd)(Monitor *mon, const QDict *qdict);
     } mhandler;
 } mon_cmd_t;
 
@@ -3014,13 +3014,8 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline)
 
     cmd = monitor_parse_command(mon, cmdline, qdict);
     if (cmd) {
-        void (*handler)(Monitor *mon, const QDict *qdict);
-
         qemu_errors_to_mon(mon);
-
-        handler = cmd->handler;
-        handler(mon, qdict);
-
+        cmd->mhandler.cmd(mon, qdict);
         qemu_errors_to_previous();
     }
 
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index cdaf5b7..c689a07 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -12,9 +12,9 @@ ETEXI
     {
         .name       = "help|?",
         .args_type  = "name:s?",
-        .handler    = do_help_cmd,
         .params     = "[cmd]",
         .help       = "show the help",
+        .mhandler.cmd = do_help_cmd,
     },
 
 STEXI
@@ -25,9 +25,9 @@ ETEXI
     {
         .name       = "commit",
         .args_type  = "device:B",
-        .handler    = do_commit,
         .params     = "device|all",
         .help       = "commit changes to the disk images (if -snapshot is used) or backing files",
+        .mhandler.cmd = do_commit,
     },
 
 STEXI
@@ -38,9 +38,9 @@ ETEXI
     {
         .name       = "info",
         .args_type  = "item:s?",
-        .handler    = do_info,
         .params     = "[subcommand]",
         .help       = "show various information about the system state",
+        .mhandler.cmd = do_info,
     },
 
 STEXI
@@ -116,9 +116,9 @@ ETEXI
     {
         .name       = "q|quit",
         .args_type  = "",
-        .handler    = do_quit,
         .params     = "",
         .help       = "quit the emulator",
+        .mhandler.cmd = do_quit,
     },
 
 STEXI
@@ -129,9 +129,9 @@ ETEXI
     {
         .name       = "eject",
         .args_type  = "force:-f,filename:B",
-        .handler    = do_eject,
         .params     = "[-f] device",
         .help       = "eject a removable medium (use -f to force it)",
+        .mhandler.cmd = do_eject,
     },
 
 STEXI
@@ -142,9 +142,9 @@ ETEXI
     {
         .name       = "change",
         .args_type  = "device:B,target:F,arg:s?",
-        .handler    = do_change,
         .params     = "device filename [format]",
         .help       = "change a removable medium, optional format",
+        .mhandler.cmd = do_change,
     },
 
 STEXI
@@ -187,9 +187,9 @@ ETEXI
     {
         .name       = "screendump",
         .args_type  = "filename:F",
-        .handler    = do_screen_dump,
         .params     = "filename",
         .help       = "save screen into PPM image 'filename'",
+        .mhandler.cmd = do_screen_dump,
     },
 
 STEXI
@@ -200,9 +200,9 @@ ETEXI
     {
         .name       = "logfile",
         .args_type  = "filename:F",
-        .handler    = do_logfile,
         .params     = "filename",
         .help       = "output logs to 'filename'",
+        .mhandler.cmd = do_logfile,
     },
 
 STEXI
@@ -213,9 +213,9 @@ ETEXI
     {
         .name       = "log",
         .args_type  = "items:s",
-        .handler    = do_log,
         .params     = "item1[,...]",
         .help       = "activate logging of the specified items to '/tmp/qemu.log'",
+        .mhandler.cmd = do_log,
     },
 
 STEXI
@@ -226,9 +226,9 @@ ETEXI
     {
         .name       = "savevm",
         .args_type  = "name:s?",
-        .handler    = do_savevm,
         .params     = "[tag|id]",
         .help       = "save a VM snapshot. If no tag or id are provided, a new snapshot is created",
+        .mhandler.cmd = do_savevm,
     },
 
 STEXI
@@ -242,9 +242,9 @@ ETEXI
     {
         .name       = "loadvm",
         .args_type  = "name:s",
-        .handler    = do_loadvm,
         .params     = "tag|id",
         .help       = "restore a VM snapshot from its tag or id",
+        .mhandler.cmd = do_loadvm,
     },
 
 STEXI
@@ -256,9 +256,9 @@ ETEXI
     {
         .name       = "delvm",
         .args_type  = "name:s",
-        .handler    = do_delvm,
         .params     = "tag|id",
         .help       = "delete a VM snapshot from its tag or id",
+        .mhandler.cmd = do_delvm,
     },
 
 STEXI
@@ -269,9 +269,9 @@ ETEXI
     {
         .name       = "singlestep",
         .args_type  = "option:s?",
-        .handler    = do_singlestep,
         .params     = "[on|off]",
         .help       = "run emulation in singlestep mode or switch to normal mode",
+        .mhandler.cmd = do_singlestep,
     },
 
 STEXI
@@ -283,9 +283,9 @@ ETEXI
     {
         .name       = "stop",
         .args_type  = "",
-        .handler    = do_stop,
         .params     = "",
         .help       = "stop emulation",
+        .mhandler.cmd = do_stop,
     },
 
 STEXI
@@ -296,9 +296,9 @@ ETEXI
     {
         .name       = "c|cont",
         .args_type  = "",
-        .handler    = do_cont,
         .params     = "",
         .help       = "resume emulation",
+        .mhandler.cmd = do_cont,
     },
 
 STEXI
@@ -309,9 +309,9 @@ ETEXI
     {
         .name       = "gdbserver",
         .args_type  = "device:s?",
-        .handler    = do_gdbserver,
         .params     = "[device]",
         .help       = "start gdbserver on given device (default 'tcp::1234'), stop with 'none'",
+        .mhandler.cmd = do_gdbserver,
     },
 
 STEXI
@@ -322,9 +322,9 @@ ETEXI
     {
         .name       = "x",
         .args_type  = "fmt:/,addr:l",
-        .handler    = do_memory_dump,
         .params     = "/fmt addr",
         .help       = "virtual memory dump starting at 'addr'",
+        .mhandler.cmd = do_memory_dump,
     },
 
 STEXI
@@ -335,9 +335,9 @@ ETEXI
     {
         .name       = "xp",
         .args_type  = "fmt:/,addr:l",
-        .handler    = do_physical_memory_dump,
         .params     = "/fmt addr",
         .help       = "physical memory dump starting at 'addr'",
+        .mhandler.cmd = do_physical_memory_dump,
     },
 
 STEXI
@@ -401,9 +401,9 @@ ETEXI
     {
         .name       = "p|print",
         .args_type  = "fmt:/,val:l",
-        .handler    = do_print,
         .params     = "/fmt expr",
         .help       = "print expression value (use $reg for CPU register access)",
+        .mhandler.cmd = do_print,
     },
 
 STEXI
@@ -416,9 +416,9 @@ ETEXI
     {
         .name       = "i",
         .args_type  = "fmt:/,addr:i,index:i.",
-        .handler    = do_ioport_read,
         .params     = "/fmt addr",
         .help       = "I/O port read",
+        .mhandler.cmd = do_ioport_read,
     },
 
 STEXI
@@ -428,9 +428,9 @@ ETEXI
     {
         .name       = "o",
         .args_type  = "fmt:/,addr:i,val:i",
-        .handler    = do_ioport_write,
         .params     = "/fmt addr value",
         .help       = "I/O port write",
+        .mhandler.cmd = do_ioport_write,
     },
 
 STEXI
@@ -440,9 +440,9 @@ ETEXI
     {
         .name       = "sendkey",
         .args_type  = "string:s,hold_time:i?",
-        .handler    = do_sendkey,
         .params     = "keys [hold_ms]",
         .help       = "send keys to the VM (e.g. 'sendkey ctrl-alt-f1', default hold time=100 ms)",
+        .mhandler.cmd = do_sendkey,
     },
 
 STEXI
@@ -462,9 +462,9 @@ ETEXI
     {
         .name       = "system_reset",
         .args_type  = "",
-        .handler    = do_system_reset,
         .params     = "",
         .help       = "reset the system",
+        .mhandler.cmd = do_system_reset,
     },
 
 STEXI
@@ -476,9 +476,9 @@ ETEXI
     {
         .name       = "system_powerdown",
         .args_type  = "",
-        .handler    = do_system_powerdown,
         .params     = "",
         .help       = "send system power down event",
+        .mhandler.cmd = do_system_powerdown,
     },
 
 STEXI
@@ -490,9 +490,9 @@ ETEXI
     {
         .name       = "sum",
         .args_type  = "start:i,size:i",
-        .handler    = do_sum,
         .params     = "addr size",
         .help       = "compute the checksum of a memory region",
+        .mhandler.cmd = do_sum,
     },
 
 STEXI
@@ -504,9 +504,9 @@ ETEXI
     {
         .name       = "usb_add",
         .args_type  = "devname:s",
-        .handler    = do_usb_add,
         .params     = "device",
         .help       = "add USB device (e.g. 'host:bus.addr' or 'host:vendor_id:product_id')",
+        .mhandler.cmd = do_usb_add,
     },
 
 STEXI
@@ -519,9 +519,9 @@ ETEXI
     {
         .name       = "usb_del",
         .args_type  = "devname:s",
-        .handler    = do_usb_del,
         .params     = "device",
         .help       = "remove USB device 'bus.addr'",
+        .mhandler.cmd = do_usb_del,
     },
 
 STEXI
@@ -535,9 +535,9 @@ ETEXI
     {
         .name       = "device_add",
         .args_type  = "config:s",
-        .handler    = do_device_add,
         .params     = "device",
         .help       = "add device, like -device on the command line",
+        .mhandler.cmd = do_device_add,
     },
 
 STEXI
@@ -549,9 +549,9 @@ ETEXI
     {
         .name       = "device_del",
         .args_type  = "id:s",
-        .handler    = do_device_del,
         .params     = "device",
         .help       = "remove device",
+        .mhandler.cmd = do_device_del,
     },
 
 STEXI
@@ -563,9 +563,9 @@ ETEXI
     {
         .name       = "cpu",
         .args_type  = "index:i",
-        .handler    = do_cpu_set,
         .params     = "index",
         .help       = "set the default CPU",
+        .mhandler.cmd = do_cpu_set,
     },
 
 STEXI
@@ -575,9 +575,9 @@ ETEXI
     {
         .name       = "mouse_move",
         .args_type  = "dx_str:s,dy_str:s,dz_str:s?",
-        .handler    = do_mouse_move,
         .params     = "dx dy [dz]",
         .help       = "send mouse move events",
+        .mhandler.cmd = do_mouse_move,
     },
 
 STEXI
@@ -589,9 +589,9 @@ ETEXI
     {
         .name       = "mouse_button",
         .args_type  = "button_state:i",
-        .handler    = do_mouse_button,
         .params     = "state",
         .help       = "change mouse button state (1=L, 2=M, 4=R)",
+        .mhandler.cmd = do_mouse_button,
     },
 
 STEXI
@@ -602,9 +602,9 @@ ETEXI
     {
         .name       = "mouse_set",
         .args_type  = "index:i",
-        .handler    = do_mouse_set,
         .params     = "index",
         .help       = "set which mouse device receives events",
+        .mhandler.cmd = do_mouse_set,
     },
 
 STEXI
@@ -620,9 +620,9 @@ ETEXI
     {
         .name       = "wavcapture",
         .args_type  = "path:F,freq:i?,bits:i?,nchannels:i?",
-        .handler    = do_wav_capture,
         .params     = "path [frequency [bits [channels]]]",
         .help       = "capture audio to a wave file (default frequency=44100 bits=16 channels=2)",
+        .mhandler.cmd = do_wav_capture,
     },
 #endif
 STEXI
@@ -642,9 +642,9 @@ ETEXI
     {
         .name       = "stopcapture",
         .args_type  = "n:i",
-        .handler    = do_stop_capture,
         .params     = "capture index",
         .help       = "stop capture",
+        .mhandler.cmd = do_stop_capture,
     },
 #endif
 STEXI
@@ -658,9 +658,9 @@ ETEXI
     {
         .name       = "memsave",
         .args_type  = "val:l,size:i,filename:s",
-        .handler    = do_memory_save,
         .params     = "addr size file",
         .help       = "save to disk virtual memory dump starting at 'addr' of size 'size'",
+        .mhandler.cmd = do_memory_save,
     },
 
 STEXI
@@ -671,9 +671,9 @@ ETEXI
     {
         .name       = "pmemsave",
         .args_type  = "val:l,size:i,filename:s",
-        .handler    = do_physical_memory_save,
         .params     = "addr size file",
         .help       = "save to disk physical memory dump starting at 'addr' of size 'size'",
+        .mhandler.cmd = do_physical_memory_save,
     },
 
 STEXI
@@ -684,9 +684,9 @@ ETEXI
     {
         .name       = "boot_set",
         .args_type  = "bootdevice:s",
-        .handler    = do_boot_set,
         .params     = "bootdevice",
         .help       = "define new values for the boot device list",
+        .mhandler.cmd = do_boot_set,
     },
 
 STEXI
@@ -703,9 +703,9 @@ ETEXI
     {
         .name       = "nmi",
         .args_type  = "cpu_index:i",
-        .handler    = do_inject_nmi,
         .params     = "cpu",
         .help       = "inject an NMI on the given CPU",
+        .mhandler.cmd = do_inject_nmi,
     },
 #endif
 STEXI
@@ -716,9 +716,9 @@ ETEXI
     {
         .name       = "migrate",
         .args_type  = "detach:-d,uri:s",
-        .handler    = do_migrate,
         .params     = "[-d] uri",
         .help       = "migrate to URI (using -d to not wait for completion)",
+        .mhandler.cmd = do_migrate,
     },
 
 STEXI
@@ -729,9 +729,9 @@ ETEXI
     {
         .name       = "migrate_cancel",
         .args_type  = "",
-        .handler    = do_migrate_cancel,
         .params     = "",
         .help       = "cancel the current VM migration",
+        .mhandler.cmd = do_migrate_cancel,
     },
 
 STEXI
@@ -742,9 +742,9 @@ ETEXI
     {
         .name       = "migrate_set_speed",
         .args_type  = "value:s",
-        .handler    = do_migrate_set_speed,
         .params     = "value",
         .help       = "set maximum speed (in bytes) for migrations",
+        .mhandler.cmd = do_migrate_set_speed,
     },
 
 STEXI
@@ -755,9 +755,9 @@ ETEXI
     {
         .name       = "migrate_set_downtime",
         .args_type  = "value:s",
-        .handler    = do_migrate_set_downtime,
         .params     = "value",
         .help       = "set maximum tolerated downtime (in seconds) for migrations",
+        .mhandler.cmd = do_migrate_set_downtime,
     },
 
 STEXI
@@ -769,13 +769,13 @@ ETEXI
     {
         .name       = "drive_add",
         .args_type  = "pci_addr:s,opts:s",
-        .handler    = drive_hot_add,
         .params     = "[[<domain>:]<bus>:]<slot>\n"
                       "[file=file][,if=type][,bus=n]\n"
                       "[,unit=m][,media=d][index=i]\n"
                       "[,cyls=c,heads=h,secs=s[,trans=t]]\n"
                       "[snapshot=on|off][,cache=on|off]",
         .help       = "add drive to PCI storage controller",
+        .mhandler.cmd = drive_hot_add,
     },
 #endif
 
@@ -788,9 +788,9 @@ ETEXI
     {
         .name       = "pci_add",
         .args_type  = "pci_addr:s,type:s,opts:s?",
-        .handler    = pci_device_hot_add,
         .params     = "auto|[[<domain>:]<bus>:]<slot> nic|storage [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]...",
         .help       = "hot-add PCI device",
+        .mhandler.cmd = pci_device_hot_add,
     },
 #endif
 
@@ -803,9 +803,9 @@ ETEXI
     {
         .name       = "pci_del",
         .args_type  = "pci_addr:s",
-        .handler    = do_pci_device_hot_remove,
         .params     = "[[<domain>:]<bus>:]<slot>",
         .help       = "hot remove PCI device",
+        .mhandler.cmd = do_pci_device_hot_remove,
     },
 #endif
 
@@ -817,9 +817,9 @@ ETEXI
     {
         .name       = "host_net_add",
         .args_type  = "device:s,opts:s?",
-        .handler    = net_host_device_add,
         .params     = "tap|user|socket|vde|dump [options]",
         .help       = "add host VLAN client",
+        .mhandler.cmd = net_host_device_add,
     },
 
 STEXI
@@ -830,9 +830,9 @@ ETEXI
     {
         .name       = "host_net_remove",
         .args_type  = "vlan_id:i,device:s",
-        .handler    = net_host_device_remove,
         .params     = "vlan_id name",
         .help       = "remove host VLAN client",
+        .mhandler.cmd = net_host_device_remove,
     },
 
 STEXI
@@ -844,17 +844,17 @@ ETEXI
     {
         .name       = "hostfwd_add",
         .args_type  = "arg1:s,arg2:s?,arg3:s?",
-        .handler    = net_slirp_hostfwd_add,
         .params     = "[vlan_id name] [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport",
         .help       = "redirect TCP or UDP connections from host to guest (requires -net user)",
+        .mhandler.cmd = net_slirp_hostfwd_add,
     },
 
     {
         .name       = "hostfwd_remove",
         .args_type  = "arg1:s,arg2:s?,arg3:s?",
-        .handler    = net_slirp_hostfwd_remove,
         .params     = "[vlan_id name] [tcp|udp]:[hostaddr]:hostport",
         .help       = "remove host-to-guest TCP or UDP redirection",
+        .mhandler.cmd = net_slirp_hostfwd_remove,
     },
 
 #endif
@@ -866,9 +866,9 @@ ETEXI
     {
         .name       = "balloon",
         .args_type  = "value:i",
-        .handler    = do_balloon,
         .params     = "target",
         .help       = "request VM to change it's memory allocation (in MB)",
+        .mhandler.cmd = do_balloon,
     },
 
 STEXI
@@ -879,9 +879,9 @@ ETEXI
     {
         .name       = "set_link",
         .args_type  = "name:s,up_or_down:s",
-        .handler    = do_set_link,
         .params     = "name up|down",
         .help       = "change the link status of a network adapter",
+        .mhandler.cmd = do_set_link,
     },
 
 STEXI
@@ -892,9 +892,9 @@ ETEXI
     {
         .name       = "watchdog_action",
         .args_type  = "action:s",
-        .handler    = do_watchdog_action,
         .params     = "[reset|shutdown|poweroff|pause|debug|none]",
         .help       = "change watchdog action",
+        .mhandler.cmd = do_watchdog_action,
     },
 
 STEXI
@@ -905,9 +905,9 @@ ETEXI
     {
         .name       = "acl_show",
         .args_type  = "aclname:s",
-        .handler    = do_acl_show,
         .params     = "aclname",
         .help       = "list rules in the access control list",
+        .mhandler.cmd = do_acl_show,
     },
 
 STEXI
@@ -921,9 +921,9 @@ ETEXI
     {
         .name       = "acl_policy",
         .args_type  = "aclname:s,policy:s",
-        .handler    = do_acl_policy,
         .params     = "aclname allow|deny",
         .help       = "set default access control list policy",
+        .mhandler.cmd = do_acl_policy,
     },
 
 STEXI
@@ -936,9 +936,9 @@ ETEXI
     {
         .name       = "acl_add",
         .args_type  = "aclname:s,match:s,policy:s,index:i?",
-        .handler    = do_acl_add,
         .params     = "aclname match allow|deny [index]",
         .help       = "add a match rule to the access control list",
+        .mhandler.cmd = do_acl_add,
     },
 
 STEXI
@@ -954,9 +954,9 @@ ETEXI
     {
         .name       = "acl_remove",
         .args_type  = "aclname:s,match:s",
-        .handler    = do_acl_remove,
         .params     = "aclname match",
         .help       = "remove a match rule from the access control list",
+        .mhandler.cmd = do_acl_remove,
     },
 
 STEXI
@@ -967,9 +967,9 @@ ETEXI
     {
         .name       = "acl_reset",
         .args_type  = "aclname:s",
-        .handler    = do_acl_reset,
         .params     = "aclname",
         .help       = "reset the access control list",
+        .mhandler.cmd = do_acl_reset,
     },
 
 STEXI
@@ -983,9 +983,9 @@ ETEXI
     {
         .name       = "mce",
         .args_type  = "cpu_index:i,bank:i,status:l,mcg_status:l,addr:l,misc:l",
-        .handler    = do_inject_mce,
         .params     = "cpu bank status mcgstatus addr misc",
         .help       = "inject a MCE on the given CPU",
+        .mhandler.cmd = do_inject_mce,
     },
 
 #endif
@@ -997,9 +997,9 @@ ETEXI
     {
         .name       = "getfd",
         .args_type  = "fdname:s",
-        .handler    = do_getfd,
         .params     = "getfd name",
         .help       = "receive a file descriptor via SCM rights and assign it a name",
+        .mhandler.cmd = do_getfd,
     },
 
 STEXI
@@ -1012,9 +1012,9 @@ ETEXI
     {
         .name       = "closefd",
         .args_type  = "fdname:s",
-        .handler    = do_closefd,
         .params     = "closefd name",
         .help       = "close a file descriptor previously passed via SCM rights",
+        .mhandler.cmd = do_closefd,
     },
 
 STEXI
