On 10/28/21 17:54, Daniel P. Berrangé wrote: > This provides a foundation on which to convert simple HMP commands to > use QMP. The QMP implementation will generate formatted text targeted > for human consumption, returning it in the HumanReadableText data type. > > The HMP command handler will simply print out the formatted string > within the HumanReadableText data type. Since this will be an entirely > formulaic action in the case of HMP commands taking no arguemnts, a
Typo "arguments" > custom command handler is provided. > > Thus instead of registering a 'cmd' callback for the HMP command, a > 'cmd_info_hrt' callback is provided, which will simply be a pointer > to the QMP implementation. > > Signed-off-by: Daniel P. Berrangé <[email protected]> > --- > include/monitor/hmp.h | 3 +++ > include/monitor/monitor.h | 2 ++ > include/qapi/type-helpers.h | 14 ++++++++++++++ > monitor/hmp.c | 31 ++++++++++++++++++++++++++++--- > monitor/misc.c | 18 +++++++++++++++++- > monitor/monitor-internal.h | 7 +++++++ > qapi/common.json | 11 +++++++++++ > qapi/meson.build | 3 +++ > qapi/qapi-type-helpers.c | 23 +++++++++++++++++++++++ > 9 files changed, 108 insertions(+), 4 deletions(-) > create mode 100644 include/qapi/type-helpers.h > create mode 100644 qapi/qapi-type-helpers.c > +## > +# @HumanReadableText: > +# > +# @human-readable-text: Formatted output intended for humans. > +# > +# Since: 6.2 > +# > +## > +{ 'struct': 'HumanReadableText', > + 'data': { 'human-readable-text': 'str' } } > diff --git a/qapi/meson.build b/qapi/meson.build > index c356a385e3..c0c49c15e4 100644 > --- a/qapi/meson.build > +++ b/qapi/meson.build > @@ -10,6 +10,9 @@ util_ss.add(files( > 'string-input-visitor.c', > 'string-output-visitor.c', > )) > +if have_system > + util_ss.add(files('qapi-type-helpers.c')) > +endif > if have_system or have_tools Eh I was expecting this to be added here, but it seems to build, so TIL tools don't use HMP. Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Tested-by: Philippe Mathieu-Daudé <[email protected]> > util_ss.add(files( > 'qmp-dispatch.c',
