Re: [PATCH v3 31/49] monitor: change HMPCommand cmd to take MonitorHMP

Daniel P. Berrangé <[email protected]>
Newsgroups org.kernel.vger.kvm,org.nongnu.qemu-devel,org.nongnu.qemu-riscv
Message-ID <[email protected]>
On Sun, Aug 16, 2026 at 11:12:58PM +0400, Marc-André Lureau wrote:
> HMP commands are specific to the HMP monitor, so make the cmd function
> pointer in HMPCommand take MonitorHMP * instead of Monitor *. This
> strengthens type safety and makes the HMP-specific nature of these
> handlers explicit.
> 
> Handler functions are renamed to take MonitorHMP *hmp, with a local
> Monitor *mon = MONITOR(hmp) added where the body needs the base type.
> Following patches will drop it, since most functions are HMP specific.
> 
> Signed-off-by: Marc-André Lureau <[email protected]>
> ---
>  audio/audio-hmp-cmds.c          |   8 +-
>  backends/cryptodev-hmp-cmds.c   |   3 +-
>  block/monitor/block-hmp-cmds.c  |  78 +++++++----
>  chardev/char-hmp-cmds.c         |  21 ++-
>  dump/dump-hmp-cmds.c            |   6 +-
>  hw/core/machine-hmp-cmds.c      |  49 ++++---
>  hw/i386/kvm/xen-stubs.c         |   6 +-
>  hw/i386/kvm/xen_evtchn.c        |   6 +-
>  hw/i386/sgx-hmp-stub.c          |   3 +-
>  hw/i386/sgx.c                   |   3 +-
>  hw/misc/mos6522-stub.c          |   3 +-
>  hw/misc/mos6522.c               |   3 +-
>  hw/net/rocker/rocker-hmp-cmds.c |  12 +-
>  hw/pci/pci-hmp-cmds.c           |   6 +-
>  hw/pci/pci-stub.c               |   5 +-
>  hw/s390x/s390-skeys.c           |   5 +-
>  hw/s390x/s390-stattrib.c        |   6 +-
>  hw/uefi/ovmf-log.c              |   3 +-
>  hw/usb/host-libusb.c            |   3 +-
>  hw/virtio/virtio-hmp-cmds.c     |  15 +-
>  include/block/block-hmp-cmds.h  |  55 ++++----
>  include/hw/usb/usb.h            |   3 +-
>  include/monitor/hmp.h           | 294 ++++++++++++++++++++--------------------
>  include/monitor/qdev.h          |   5 +-
>  include/net/net.h               |   5 +-
>  include/net/slirp.h             |   8 +-
>  migration/dirtyrate.c           |   6 +-
>  migration/migration-hmp-cmds.c  |  48 ++++---
>  monitor/hmp-cmds.c              |  96 ++++++++-----
>  monitor/hmp.c                   |  17 ++-
>  monitor/monitor-internal.h      |   2 +-
>  net/net-hmp-cmds.c              |  14 +-
>  net/slirp.c                     |   9 +-
>  qom/qom-hmp-cmds.c              |  18 ++-
>  replay/replay-debugging.c       |   9 +-
>  replay/stubs-system.c           |   8 +-
>  stats/stats-hmp-cmds.c          |   3 +-
>  stubs/hmp-cmd-info_sev.c        |   3 +-
>  system/dirtylimit-hmp-cmds.c    |   9 +-
>  system/qdev-monitor.c           |  11 +-
>  system/runstate-hmp-cmds.c      |   9 +-
>  system/tpm-hmp-cmds.c           |   3 +-
>  target/i386/cpu-apic.c          |   3 +-
>  target/i386/monitor.c           |   9 +-
>  target/i386/sev.c               |   3 +-
>  target/m68k/monitor.c           |   3 +-
>  target/ppc/monitor.c            |   3 +-
>  target/riscv/monitor.c          |   3 +-
>  target/sh4/monitor.c            |   3 +-
>  target/sparc/monitor.c          |   3 +-
>  target/xtensa/monitor.c         |   3 +-
>  trace/trace-hmp-cmds.c          |   8 +-
>  ui/ui-hmp-cmds.c                |  31 +++--
>  53 files changed, 561 insertions(+), 390 deletions(-)

Reviewed-by: Daniel P. Berrangé <[email protected]>


With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.