monitor: Fix and clean up around .user_print
cover monitor: Fix and clean up around .user_print
A more thorough cleanup of the area is in the works, but I want to get this out quickly, so it makes 2.3.
I think it can go via -trivial, if Luiz doesn't mind.
Markus Armbruster (2):
hmp: Fix definition of command quit
qmp: Drop unused .user_print from command definitions
hmp-commands.hx | 1 - qmp-commands.hx | 4 ---- 2 files changed, 5 deletions(-)
Signature · 1 line
1.9.3
PATCH 1/2 hmp: Fix definition of command quit
The command handler is a union of two function types. If cmd->user_print is set, handle_user_command() calls cmd->mhandler.cmd_new(), else cmd->mhandler.cmd().
Command definitions must therefore either set both user_print() and mhandler.cmd_new(), or only mhandler.cmd().
quit's sets user_print and mhandler.cmd(). handle_user_command() calls hmp_quit() through mhandler.cmd_new() rather than mhandler.cmd(), i.e. through a function pointer with a different type. Broken in commit 7a7f325, v1.0.
Works in practice because hmp_quit() doesn't use its arguments, and handle_user_command() ignores its function value.
--- hmp-commands.hx | 1 - 1 file changed, 1 deletion(-)
hmp-commands.hx +0 -1
@@ -47,7 +47,6 @@ ETEXI .args_type = "", .params = "", .help = "quit the emulator", - .user_print = monitor_user_noop, .mhandler.cmd = hmp_quit, },
Signature · 1 line
1.9.3
PATCH 2/2 qmp: Drop unused .user_print from command definitions
In reply to Markus Armbruster.user_print isn't used with QMP commands, only with HMP commands. Copied over when QMP got its own command table in commit 82a56f0. Most of them have been dropped since, but a few stragglers remain. Drop them.
--- qmp-commands.hx | 4 ---- 1 file changed, 4 deletions(-)
qmp-commands.hx +0 -4
@@ -276,7 +276,6 @@ EQMP .args_type = "device:O", .params = "driver[,prop=value][,...]", .help = "add device, like -device on the command line", - .user_print = monitor_user_noop, .mhandler.cmd_new = do_device_add, },
@@ -757,7 +756,6 @@ EQMP .args_type = "protocol:s,hostname:s,port:i?,tls-port:i?,cert-subject:s?", .params = "protocol hostname port tls-port cert-subject", .help = "send migration info to spice/vnc client", - .user_print = monitor_user_noop, .mhandler.cmd_async = client_migrate_info, .flags = MONITOR_CMD_ASYNC, },
@@ -793,7 +791,6 @@ EQMP .args_type = "paging:b,protocol:s,begin:i?,end:i?,format:s?", .params = "-p protocol [begin] [length] [format]", .help = "dump guest memory to file", - .user_print = monitor_user_noop, .mhandler.cmd_new = qmp_marshal_input_dump_guest_memory, },
@@ -1833,7 +1830,6 @@ EQMP .args_type = "", .params = "", .help = "enable QMP capabilities", - .user_print = monitor_user_noop, .mhandler.cmd_new = do_qmp_capabilities, },
Signature · 1 line
1.9.3
Quoted 8 lines · Markus Armbruster
A more thorough cleanup of the area is in the works, but I want to get this out quickly, so it makes 2.3.
I think it can go via -trivial, if Luiz doesn't mind.
Markus Armbruster (2):
hmp: Fix definition of command quit
qmp: Drop unused .user_print from command definitions
Quoted 5 lines
hmp-commands.hx | 1 - qmp-commands.hx | 4 ---- 2 files changed, 5 deletions(-)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Michael Tokarev
AppliedQuoted 4 lines · Markus Armbruster
A more thorough cleanup of the area is in the works, but I want to get this out quickly, so it makes 2.3.
I think it can go via -trivial, if Luiz doesn't mind.
Applied to -trivial for now, thank you!
/mjt