All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, "Greg Kurz" <groug@kaod.org>,
	"Bin Meng" <bin.meng@windriver.com>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Stafford Horne" <shorne@gmail.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	qemu-ppc@nongnu.org,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	qemu-arm@nongnu.org, "Michael Rolnik" <mrolnik@gmail.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Taylor Simpson" <tsimpson@quicinc.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	qemu-riscv@nongnu.org, "Max Filippov" <jcmvbkbc@gmail.com>,
	"Yuval Shaia" <yuval.shaia.ml@gmail.com>,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Marek Vasut" <marex@denx.de>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	qemu-s390x@nongnu.org, "Laurent Vivier" <lvivier@redhat.com>,
	"Eric Blake" <eblake@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Chris Wulff" <crwulff@gmail.com>
Subject: Re: [PATCH v2 04/53] docs/devel: add example of command returning unstructured text
Date: Mon, 20 Sep 2021 09:51:57 +0200	[thread overview]
Message-ID: <87v92v3crm.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20210914142042.1655100-5-berrange@redhat.com> ("Daniel P. Berrangé"'s message of "Tue, 14 Sep 2021 15:19:53 +0100")

Daniel P. Berrangé <berrange@redhat.com> writes:

> This illustrates how to add a QMP command returning unstructured text,
> following the guidelines added in the previous patch. The example uses
> a simplified version of 'info roms'.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  docs/devel/writing-monitor-commands.rst | 85 +++++++++++++++++++++++++
>  1 file changed, 85 insertions(+)
>
> diff --git a/docs/devel/writing-monitor-commands.rst b/docs/devel/writing-monitor-commands.rst
> index d68c552fdd..4cf51ab557 100644
> --- a/docs/devel/writing-monitor-commands.rst
> +++ b/docs/devel/writing-monitor-commands.rst
> @@ -647,3 +647,88 @@ has to traverse the list, it's shown below for reference::
   Modelling data in QAPI
   ~~~~~~~~~~~~~~~~~~~~~~

   For a QMP command that to be considered stable and supported long term,
   there is a requirement returned data should be explicitly modelled
   using fine-grained QAPI types. As a general guide, a caller of the QMP
   command should never need to parse individual returned data fields. If
   a field appears to need parsing, then it should be split into separate
   fields corresponding to each distinct data item. This should be the
   common case for any new QMP command that is intended to be used by
   machines, as opposed to exclusively human operators.

   Some QMP commands, however, are only intended as ad hoc debugging aids
   for human operators. While they may return large amounts of formatted
   data, it is not expected that machines will need to parse the result.
   The overhead of defining a fine grained QAPI type for the data may not
   be justified by the potential benefit. In such cases, it is permitted
   to have a command return a simple string that contains formatted data,
   however, it is mandatory for the command to use the 'x-' name prefix.
   This indicates that the command is not guaranteed to be long term
   stable / liable to change in future and is not following QAPI design
   best practices. An example where this approach is taken is the QMP
   command "x-query-registers". This returns a formatted dump of the
   architecture specific CPU state. The way the data is formatted varies
   across QEMU targets, is liable to change over time, and is only
   intended to be consumed as an opaque string by machines.

Recommend to add a forward reference to section "Writing a debugging aid
..." here.

[...]
>  
>       qapi_free_TimerAlarmMethodList(method_list);
>   }
> +
> +Writing a debugging aid returning unstructured text
> +---------------------------------------------------
> +
> +As discussed at the start of the previous example, it is required that

Suggest 'As discussed in section "Modelling data in QAPI"'.

> +commands expecting machine usage be using fine-grained QAPI data types.
> +The exception to this rule applies when the command is solely intended
> +as a debugging aid and allows for returning unstructured text. This is
> +commonly needed for query commands that report aspects of QEMU's
> +internal state that are useful to human operators.
> +
> +In this example we will consider a simplified variant of the HMP
> +command ``info roms``. Following the earlier rules, this command will
> +need to live under the ``x-`` name prefix, so its QMP implementation
> +will be called ``x-query-roms``. It will have no parameters and will
> +return a single text string::
> +
> + { 'struct': 'HumanReadableText',
> +   'data': { 'human-readable-text': 'str' } }
> +
> + { 'command': 'x-query-roms',
> +   'returns': 'HumanReadableText' }
> +
> +The ``HumanReadableText`` struct is intended to be used for all
> +commands, under the ``x-`` name prefix that are returning unstructured
> +text targetted at humans. It should never be used for commands outside
> +the ``x-`` name prefix, as those should be using structured QAPI types.
> +
> +Implementing the QMP command
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The QMP implementation will typically involve creating a ``GString``
> +object and printing formatted data into it::
> +
> + HumanReadableText *qmp_x_query_roms(Error **errp)
> + {
> +     GString buf = g_string_new("");
> +     HumanReadableText ret = g_new0(HumanReadableText, 1);
> +     Rom *rom;
> +
> +     QTAILQ_FOREACH(rom, &roms, next) {
> +        g_string_append_printf("%s size=0x%06zx name=\"%s\"\n",
> +                               memory_region_name(rom->mr),
> +                               rom->romsize,
> +                               rom->name);
> +     }
> +
> +     ret->human_readable_text = g_string_free(buf, FALSE);
> +
> +     return ret;
> + }
> +
> +
> +Implementing the HMP command
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Now that the QMP command is in place, we can also make it available in
> +the human monitor (HMP) as shown in previous examples. The HMP
> +implementations will all look fairly similar, as all they need do is
> +invoke the QMP command and then print the resulting text or error
> +message. Here's the implementation of the "info roms" HMP command::
> +
> + void hmp_info_roms(Monitor *mon, const QDict *qdict)
> + {
> +     Error err = NULL;
> +     g_autoptr(HumanReadableText) info = qmp_x_query_roms(&err);

Humor me: blank line between declarations and statements, please.

> +     if (err) {
> +         error_report_err(err);
> +         return;
> +     }
> +     monitor_printf(mon, "%s\n", info->human_readable_text);
> + }
> +
> +Also, you have to add the function's prototype to the hmp.h file.
> +
> +There's one last step to actually make the command available to
> +monitor users, we should add it to the hmp-commands-info.hx file::
> +
> +    {
> +        .name       = "roms",
> +        .args_type  = "",
> +        .params     = "",
> +        .help       = "show roms",
> +        .cmd        = hmp_info_roms,
> +    },



WARNING: multiple messages have this Message-ID (diff)
From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Chris Wulff" <crwulff@gmail.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Bin Meng" <bin.meng@windriver.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	qemu-devel@nongnu.org, "Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Laurent Vivier" <laurent@vivier.eu>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	"Taylor Simpson" <tsimpson@quicinc.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Eric Blake" <eblake@redhat.com>, "Marek Vasut" <marex@denx.de>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Greg Kurz" <groug@kaod.org>,
	"Yuval Shaia" <yuval.shaia.ml@gmail.com>,
	qemu-s390x@nongnu.org, qemu-arm@nongnu.org,
	"Michael Rolnik" <mrolnik@gmail.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Stafford Horne" <shorne@gmail.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	qemu-riscv@nongnu.org,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-ppc@nongnu.org, "Aurelien Jarno" <aurelien@aurel32.net>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH v2 04/53] docs/devel: add example of command returning unstructured text
Date: Mon, 20 Sep 2021 09:51:57 +0200	[thread overview]
Message-ID: <87v92v3crm.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20210914142042.1655100-5-berrange@redhat.com> ("Daniel P. Berrangé"'s message of "Tue, 14 Sep 2021 15:19:53 +0100")

Daniel P. Berrangé <berrange@redhat.com> writes:

> This illustrates how to add a QMP command returning unstructured text,
> following the guidelines added in the previous patch. The example uses
> a simplified version of 'info roms'.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  docs/devel/writing-monitor-commands.rst | 85 +++++++++++++++++++++++++
>  1 file changed, 85 insertions(+)
>
> diff --git a/docs/devel/writing-monitor-commands.rst b/docs/devel/writing-monitor-commands.rst
> index d68c552fdd..4cf51ab557 100644
> --- a/docs/devel/writing-monitor-commands.rst
> +++ b/docs/devel/writing-monitor-commands.rst
> @@ -647,3 +647,88 @@ has to traverse the list, it's shown below for reference::
   Modelling data in QAPI
   ~~~~~~~~~~~~~~~~~~~~~~

   For a QMP command that to be considered stable and supported long term,
   there is a requirement returned data should be explicitly modelled
   using fine-grained QAPI types. As a general guide, a caller of the QMP
   command should never need to parse individual returned data fields. If
   a field appears to need parsing, then it should be split into separate
   fields corresponding to each distinct data item. This should be the
   common case for any new QMP command that is intended to be used by
   machines, as opposed to exclusively human operators.

   Some QMP commands, however, are only intended as ad hoc debugging aids
   for human operators. While they may return large amounts of formatted
   data, it is not expected that machines will need to parse the result.
   The overhead of defining a fine grained QAPI type for the data may not
   be justified by the potential benefit. In such cases, it is permitted
   to have a command return a simple string that contains formatted data,
   however, it is mandatory for the command to use the 'x-' name prefix.
   This indicates that the command is not guaranteed to be long term
   stable / liable to change in future and is not following QAPI design
   best practices. An example where this approach is taken is the QMP
   command "x-query-registers". This returns a formatted dump of the
   architecture specific CPU state. The way the data is formatted varies
   across QEMU targets, is liable to change over time, and is only
   intended to be consumed as an opaque string by machines.

Recommend to add a forward reference to section "Writing a debugging aid
..." here.

[...]
>  
>       qapi_free_TimerAlarmMethodList(method_list);
>   }
> +
> +Writing a debugging aid returning unstructured text
> +---------------------------------------------------
> +
> +As discussed at the start of the previous example, it is required that

Suggest 'As discussed in section "Modelling data in QAPI"'.

> +commands expecting machine usage be using fine-grained QAPI data types.
> +The exception to this rule applies when the command is solely intended
> +as a debugging aid and allows for returning unstructured text. This is
> +commonly needed for query commands that report aspects of QEMU's
> +internal state that are useful to human operators.
> +
> +In this example we will consider a simplified variant of the HMP
> +command ``info roms``. Following the earlier rules, this command will
> +need to live under the ``x-`` name prefix, so its QMP implementation
> +will be called ``x-query-roms``. It will have no parameters and will
> +return a single text string::
> +
> + { 'struct': 'HumanReadableText',
> +   'data': { 'human-readable-text': 'str' } }
> +
> + { 'command': 'x-query-roms',
> +   'returns': 'HumanReadableText' }
> +
> +The ``HumanReadableText`` struct is intended to be used for all
> +commands, under the ``x-`` name prefix that are returning unstructured
> +text targetted at humans. It should never be used for commands outside
> +the ``x-`` name prefix, as those should be using structured QAPI types.
> +
> +Implementing the QMP command
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The QMP implementation will typically involve creating a ``GString``
> +object and printing formatted data into it::
> +
> + HumanReadableText *qmp_x_query_roms(Error **errp)
> + {
> +     GString buf = g_string_new("");
> +     HumanReadableText ret = g_new0(HumanReadableText, 1);
> +     Rom *rom;
> +
> +     QTAILQ_FOREACH(rom, &roms, next) {
> +        g_string_append_printf("%s size=0x%06zx name=\"%s\"\n",
> +                               memory_region_name(rom->mr),
> +                               rom->romsize,
> +                               rom->name);
> +     }
> +
> +     ret->human_readable_text = g_string_free(buf, FALSE);
> +
> +     return ret;
> + }
> +
> +
> +Implementing the HMP command
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Now that the QMP command is in place, we can also make it available in
> +the human monitor (HMP) as shown in previous examples. The HMP
> +implementations will all look fairly similar, as all they need do is
> +invoke the QMP command and then print the resulting text or error
> +message. Here's the implementation of the "info roms" HMP command::
> +
> + void hmp_info_roms(Monitor *mon, const QDict *qdict)
> + {
> +     Error err = NULL;
> +     g_autoptr(HumanReadableText) info = qmp_x_query_roms(&err);

Humor me: blank line between declarations and statements, please.

> +     if (err) {
> +         error_report_err(err);
> +         return;
> +     }
> +     monitor_printf(mon, "%s\n", info->human_readable_text);
> + }
> +
> +Also, you have to add the function's prototype to the hmp.h file.
> +
> +There's one last step to actually make the command available to
> +monitor users, we should add it to the hmp-commands-info.hx file::
> +
> +    {
> +        .name       = "roms",
> +        .args_type  = "",
> +        .params     = "",
> +        .help       = "show roms",
> +        .cmd        = hmp_info_roms,
> +    },


WARNING: multiple messages have this Message-ID (diff)
From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Chris Wulff" <crwulff@gmail.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Bin Meng" <bin.meng@windriver.com>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	qemu-devel@nongnu.org, "Laurent Vivier" <laurent@vivier.eu>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	"Taylor Simpson" <tsimpson@quicinc.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Eric Blake" <eblake@redhat.com>, "Marek Vasut" <marex@denx.de>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Artyom Tarasenko" <atar4qemu@gmail.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Greg Kurz" <groug@kaod.org>,
	"Yuval Shaia" <yuval.shaia.ml@gmail.com>,
	qemu-s390x@nongnu.org, qemu-arm@nongnu.org,
	"Michael Rolnik" <mrolnik@gmail.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Stafford Horne" <shorne@gmail.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	qemu-riscv@nongnu.org,
	"Bastian Koppelmann" <kbastian@mail.uni-paderborn.de>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-ppc@nongnu.org, "Aurelien Jarno" <aurelien@aurel32.net>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH v2 04/53] docs/devel: add example of command returning unstructured text
Date: Mon, 20 Sep 2021 09:51:57 +0200	[thread overview]
Message-ID: <87v92v3crm.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20210914142042.1655100-5-berrange@redhat.com> ("Daniel P. Berrangé"'s message of "Tue, 14 Sep 2021 15:19:53 +0100")

Daniel P. Berrangé <berrange@redhat.com> writes:

> This illustrates how to add a QMP command returning unstructured text,
> following the guidelines added in the previous patch. The example uses
> a simplified version of 'info roms'.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  docs/devel/writing-monitor-commands.rst | 85 +++++++++++++++++++++++++
>  1 file changed, 85 insertions(+)
>
> diff --git a/docs/devel/writing-monitor-commands.rst b/docs/devel/writing-monitor-commands.rst
> index d68c552fdd..4cf51ab557 100644
> --- a/docs/devel/writing-monitor-commands.rst
> +++ b/docs/devel/writing-monitor-commands.rst
> @@ -647,3 +647,88 @@ has to traverse the list, it's shown below for reference::
   Modelling data in QAPI
   ~~~~~~~~~~~~~~~~~~~~~~

   For a QMP command that to be considered stable and supported long term,
   there is a requirement returned data should be explicitly modelled
   using fine-grained QAPI types. As a general guide, a caller of the QMP
   command should never need to parse individual returned data fields. If
   a field appears to need parsing, then it should be split into separate
   fields corresponding to each distinct data item. This should be the
   common case for any new QMP command that is intended to be used by
   machines, as opposed to exclusively human operators.

   Some QMP commands, however, are only intended as ad hoc debugging aids
   for human operators. While they may return large amounts of formatted
   data, it is not expected that machines will need to parse the result.
   The overhead of defining a fine grained QAPI type for the data may not
   be justified by the potential benefit. In such cases, it is permitted
   to have a command return a simple string that contains formatted data,
   however, it is mandatory for the command to use the 'x-' name prefix.
   This indicates that the command is not guaranteed to be long term
   stable / liable to change in future and is not following QAPI design
   best practices. An example where this approach is taken is the QMP
   command "x-query-registers". This returns a formatted dump of the
   architecture specific CPU state. The way the data is formatted varies
   across QEMU targets, is liable to change over time, and is only
   intended to be consumed as an opaque string by machines.

Recommend to add a forward reference to section "Writing a debugging aid
..." here.

[...]
>  
>       qapi_free_TimerAlarmMethodList(method_list);
>   }
> +
> +Writing a debugging aid returning unstructured text
> +---------------------------------------------------
> +
> +As discussed at the start of the previous example, it is required that

Suggest 'As discussed in section "Modelling data in QAPI"'.

> +commands expecting machine usage be using fine-grained QAPI data types.
> +The exception to this rule applies when the command is solely intended
> +as a debugging aid and allows for returning unstructured text. This is
> +commonly needed for query commands that report aspects of QEMU's
> +internal state that are useful to human operators.
> +
> +In this example we will consider a simplified variant of the HMP
> +command ``info roms``. Following the earlier rules, this command will
> +need to live under the ``x-`` name prefix, so its QMP implementation
> +will be called ``x-query-roms``. It will have no parameters and will
> +return a single text string::
> +
> + { 'struct': 'HumanReadableText',
> +   'data': { 'human-readable-text': 'str' } }
> +
> + { 'command': 'x-query-roms',
> +   'returns': 'HumanReadableText' }
> +
> +The ``HumanReadableText`` struct is intended to be used for all
> +commands, under the ``x-`` name prefix that are returning unstructured
> +text targetted at humans. It should never be used for commands outside
> +the ``x-`` name prefix, as those should be using structured QAPI types.
> +
> +Implementing the QMP command
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The QMP implementation will typically involve creating a ``GString``
> +object and printing formatted data into it::
> +
> + HumanReadableText *qmp_x_query_roms(Error **errp)
> + {
> +     GString buf = g_string_new("");
> +     HumanReadableText ret = g_new0(HumanReadableText, 1);
> +     Rom *rom;
> +
> +     QTAILQ_FOREACH(rom, &roms, next) {
> +        g_string_append_printf("%s size=0x%06zx name=\"%s\"\n",
> +                               memory_region_name(rom->mr),
> +                               rom->romsize,
> +                               rom->name);
> +     }
> +
> +     ret->human_readable_text = g_string_free(buf, FALSE);
> +
> +     return ret;
> + }
> +
> +
> +Implementing the HMP command
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Now that the QMP command is in place, we can also make it available in
> +the human monitor (HMP) as shown in previous examples. The HMP
> +implementations will all look fairly similar, as all they need do is
> +invoke the QMP command and then print the resulting text or error
> +message. Here's the implementation of the "info roms" HMP command::
> +
> + void hmp_info_roms(Monitor *mon, const QDict *qdict)
> + {
> +     Error err = NULL;
> +     g_autoptr(HumanReadableText) info = qmp_x_query_roms(&err);

Humor me: blank line between declarations and statements, please.

> +     if (err) {
> +         error_report_err(err);
> +         return;
> +     }
> +     monitor_printf(mon, "%s\n", info->human_readable_text);
> + }
> +
> +Also, you have to add the function's prototype to the hmp.h file.
> +
> +There's one last step to actually make the command available to
> +monitor users, we should add it to the hmp-commands-info.hx file::
> +
> +    {
> +        .name       = "roms",
> +        .args_type  = "",
> +        .params     = "",
> +        .help       = "show roms",
> +        .cmd        = hmp_info_roms,
> +    },



  reply	other threads:[~2021-09-20  7:52 UTC|newest]

Thread overview: 288+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 14:19 [PATCH v2 00/53] monitor: explicitly permit QMP commands to be added for all use cases Daniel P. Berrangé
2021-09-14 14:19 ` Daniel P. Berrangé
2021-09-14 14:19 ` Daniel P. Berrangé
2021-09-14 14:19 ` [PATCH v2 01/53] docs/devel: rename file for writing monitor commands Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-20  7:42   ` Markus Armbruster
2021-09-20  7:42     ` Markus Armbruster
2021-09-20  7:42     ` Markus Armbruster
2021-09-22 16:02     ` Daniel P. Berrangé
2021-09-22 16:02       ` Daniel P. Berrangé
2021-09-22 16:02       ` Daniel P. Berrangé
2021-09-14 14:19 ` [PATCH v2 02/53] docs/devel: tweak headings in monitor command docs Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-20  7:42   ` Markus Armbruster
2021-09-20  7:42     ` Markus Armbruster
2021-09-14 14:19 ` [PATCH v2 03/53] docs/devel: document expectations for QAPI data modelling for QMP Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-20  7:44   ` Markus Armbruster
2021-09-20  7:44     ` Markus Armbruster
2021-09-14 14:19 ` [PATCH v2 04/53] docs/devel: add example of command returning unstructured text Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-20  7:51   ` Markus Armbruster [this message]
2021-09-20  7:51     ` Markus Armbruster
2021-09-20  7:51     ` Markus Armbruster
2021-09-14 14:19 ` [PATCH v2 05/53] docs/devel: document expectations for HMP commands in the future Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-20  8:06   ` Markus Armbruster
2021-09-20  8:06     ` Markus Armbruster
2021-09-20  8:06     ` Markus Armbruster
2021-09-22 16:14     ` Daniel P. Berrangé
2021-09-22 16:14       ` Daniel P. Berrangé
2021-09-22 16:14       ` Daniel P. Berrangé
2021-09-14 14:19 ` [PATCH v2 06/53] hw/core: introduce 'format_state' callback to replace 'dump_state' Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-14 15:53   ` Philippe Mathieu-Daudé
2021-09-14 15:53     ` Philippe Mathieu-Daudé
2021-09-14 15:53     ` Philippe Mathieu-Daudé
2021-09-14 19:28   ` Greg Kurz
2021-09-14 19:28     ` Greg Kurz
2021-09-14 19:28     ` Greg Kurz
2021-09-14 14:19 ` [PATCH v2 07/53] target/alpha: convert to use format_state instead of dump_state Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-15  7:10   ` Philippe Mathieu-Daudé
2021-09-15  7:10     ` Philippe Mathieu-Daudé
2021-09-15  7:10     ` Philippe Mathieu-Daudé
2021-09-14 14:19 ` [PATCH v2 08/53] target/arm: " Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-14 14:19 ` [PATCH v2 09/53] target/avr: " Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-15  7:13   ` Philippe Mathieu-Daudé
2021-09-15  7:13     ` Philippe Mathieu-Daudé
2021-09-15  7:13     ` Philippe Mathieu-Daudé
2021-09-15  8:49     ` Daniel P. Berrangé
2021-09-15  8:49       ` Daniel P. Berrangé
2021-09-15  8:49       ` Daniel P. Berrangé
2021-09-15  8:58       ` Philippe Mathieu-Daudé
2021-09-15  8:58         ` Philippe Mathieu-Daudé
2021-09-15  8:58         ` Philippe Mathieu-Daudé
2021-09-14 14:19 ` [PATCH v2 10/53] target/cris: " Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-14 14:19   ` Daniel P. Berrangé
2021-09-15  7:33   ` Philippe Mathieu-Daudé
2021-09-15  7:33     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 11/53] target/hexagon: delete unused hexagon_debug() method Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:50   ` Taylor Simpson
2021-09-14 14:50     ` Taylor Simpson
2021-09-15  7:00   ` Philippe Mathieu-Daudé
2021-09-15  7:00     ` Philippe Mathieu-Daudé
2021-09-15  7:00     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 12/53] target/hexagon: convert to use format_state instead of dump_state Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  7:14   ` Philippe Mathieu-Daudé
2021-09-15  7:14     ` Philippe Mathieu-Daudé
2021-09-15  7:14     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 13/53] target/hppa: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  7:15   ` Philippe Mathieu-Daudé
2021-09-15  7:15     ` Philippe Mathieu-Daudé
2021-09-15  7:15     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 14/53] target/i386: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 15/53] target/m68k: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 19:58   ` Laurent Vivier
2021-09-14 19:58     ` Laurent Vivier
2021-09-14 19:58     ` Laurent Vivier
2021-09-15  7:17   ` Philippe Mathieu-Daudé
2021-09-15  7:17     ` Philippe Mathieu-Daudé
2021-09-15  7:17     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 16/53] target/microblaze: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  7:18   ` Philippe Mathieu-Daudé
2021-09-15  7:18     ` Philippe Mathieu-Daudé
2021-09-15  7:21     ` Philippe Mathieu-Daudé
2021-09-15  7:21       ` Philippe Mathieu-Daudé
2021-09-15  7:21       ` Philippe Mathieu-Daudé
2021-09-15  7:23       ` Philippe Mathieu-Daudé
2021-09-15  7:23         ` Philippe Mathieu-Daudé
2021-09-15  7:23         ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 17/53] target/mips: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  7:04   ` Philippe Mathieu-Daudé
2021-09-15  7:04     ` Philippe Mathieu-Daudé
2021-09-15  7:04     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 18/53] target/nios2: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  7:08   ` Philippe Mathieu-Daudé
2021-09-15  7:08     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 19/53] target/openrisc: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  7:19   ` Philippe Mathieu-Daudé
2021-09-15  7:19     ` Philippe Mathieu-Daudé
2021-09-15  7:19     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 20/53] target/ppc: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 19:30   ` Greg Kurz
2021-09-14 19:30     ` Greg Kurz
2021-09-14 19:30     ` Greg Kurz
2021-09-15  1:37   ` David Gibson
2021-09-15  1:37     ` David Gibson
2021-09-15  1:37     ` David Gibson
2021-09-14 14:20 ` [PATCH v2 21/53] target/riscv: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 22/53] target/rx: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  7:20   ` Philippe Mathieu-Daudé
2021-09-15  7:20     ` Philippe Mathieu-Daudé
2021-09-15  7:20     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 23/53] target/s390x: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 24/53] target/sh: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  7:24   ` Philippe Mathieu-Daudé
2021-09-15  7:24     ` Philippe Mathieu-Daudé
2021-09-15  7:24     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 25/53] target/sparc: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  7:27   ` Philippe Mathieu-Daudé
2021-09-15  7:27     ` Philippe Mathieu-Daudé
2021-09-15  7:27     ` Philippe Mathieu-Daudé
2021-09-16 10:53   ` Mark Cave-Ayland
2021-09-16 10:53     ` Mark Cave-Ayland
2021-09-16 10:53     ` Mark Cave-Ayland
2021-09-14 14:20 ` [PATCH v2 26/53] target/tricore: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  7:29   ` Philippe Mathieu-Daudé
2021-09-15  7:29     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 27/53] target/xtensa: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  7:32   ` Philippe Mathieu-Daudé
2021-09-15  7:32     ` Philippe Mathieu-Daudé
2021-09-15  7:32     ` Philippe Mathieu-Daudé
2021-09-15  7:54     ` Max Filippov
2021-09-15  7:54       ` Max Filippov
2021-09-15  8:52     ` Daniel P. Berrangé
2021-09-15  8:52       ` Daniel P. Berrangé
2021-09-15  8:52       ` Daniel P. Berrangé
2021-09-15  9:01       ` Philippe Mathieu-Daudé
2021-09-15  9:01         ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 28/53] monitor: remove 'info ioapic' HMP command Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 15:50   ` Philippe Mathieu-Daudé
2021-09-14 15:50     ` Philippe Mathieu-Daudé
2021-09-14 15:50     ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 29/53] qapi: introduce x-query-registers QMP command Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 16:04   ` Eric Blake
2021-09-14 16:04     ` Eric Blake
2021-09-14 17:15     ` Philippe Mathieu-Daudé
2021-09-14 17:15       ` Philippe Mathieu-Daudé
2021-09-14 17:18       ` Philippe Mathieu-Daudé
2021-09-14 17:18         ` Philippe Mathieu-Daudé
2021-09-14 14:20 ` [PATCH v2 30/53] qapi: introduce x-query-roms " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 16:04   ` Philippe Mathieu-Daudé
2021-09-14 16:04     ` Philippe Mathieu-Daudé
2021-09-14 16:04     ` Philippe Mathieu-Daudé
2021-09-14 16:42     ` Daniel P. Berrangé
2021-09-14 16:42       ` Daniel P. Berrangé
2021-09-14 16:42       ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 31/53] qapi: introduce x-query-profile " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 32/53] qapi: introduce x-query-numa " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 33/53] qapi: introduce x-query-usb " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 34/53] qapi: introduce x-query-rdma " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 35/53] qapi: introduce x-query-ramblock " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 36/53] qapi: introduce x-query-skeys " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 37/53] qapi: introduce x-query-cmma " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 38/53] qapi: introduce x-query-lapic " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-21  5:27   ` Dongli Zhang
2021-09-21  5:27     ` Dongli Zhang
2021-09-22 16:30     ` Daniel P. Berrangé
2021-09-22 16:30       ` Daniel P. Berrangé
2021-09-22 16:30       ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 39/53] qapi: introduce x-query-irq " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 40/53] hw/core: drop "dump_state" callback from CPU targets Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 41/53] hw/core: drop support for NULL pointer for FILE * in cpu_dump_state Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 42/53] hw/core: introduce a 'format_tlb' callback Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 15:56   ` Philippe Mathieu-Daudé
2021-09-14 15:56     ` Philippe Mathieu-Daudé
2021-09-14 16:34     ` Daniel P. Berrangé
2021-09-14 16:34       ` Daniel P. Berrangé
2021-09-14 16:34       ` Daniel P. Berrangé
2021-09-14 17:02       ` Philippe Mathieu-Daudé
2021-09-14 17:02         ` Philippe Mathieu-Daudé
2021-09-14 17:02         ` Philippe Mathieu-Daudé
2021-09-14 17:12         ` Daniel P. Berrangé
2021-09-14 17:12           ` Daniel P. Berrangé
2021-09-14 17:12           ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 43/53] target/i386: convert to use format_tlb callback Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 44/53] target/m68k: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 19:59   ` Laurent Vivier
2021-09-14 19:59     ` Laurent Vivier
2021-09-14 19:59     ` Laurent Vivier
2021-09-14 14:20 ` [PATCH v2 45/53] target/nios2: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 46/53] target/ppc: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  1:40   ` David Gibson
2021-09-15  1:40     ` David Gibson
2021-09-14 14:20 ` [PATCH v2 47/53] target/sh4: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 48/53] target/sparc: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-16 10:54   ` Mark Cave-Ayland
2021-09-16 10:54     ` Mark Cave-Ayland
2021-09-14 14:20 ` [PATCH v2 49/53] target/xtensa: " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  8:01   ` Max Filippov
2021-09-15  8:01     ` Max Filippov
2021-09-15  8:01     ` Max Filippov
2021-09-14 14:20 ` [PATCH v2 50/53] monitor: merge duplicate "info tlb" handlers Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-15  1:41   ` David Gibson
2021-09-15  1:41     ` David Gibson
2021-09-15  1:41     ` David Gibson
2021-09-14 14:20 ` [PATCH v2 51/53] qapi: introduce x-query-tlb QMP command Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 52/53] qapi: introduce x-query-jit " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20 ` [PATCH v2 53/53] qapi: introduce x-query-opcount " Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé
2021-09-14 14:20   ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v92v3crm.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=alistair.francis@wdc.com \
    --cc=atar4qemu@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=berrange@redhat.com \
    --cc=bin.meng@windriver.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=crwulff@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=groug@kaod.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=kraxel@redhat.com \
    --cc=laurent@vivier.eu \
    --cc=lvivier@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=marex@denx.de \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=mrolnik@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterx@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=shorne@gmail.com \
    --cc=thuth@redhat.com \
    --cc=tsimpson@quicinc.com \
    --cc=ysato@users.sourceforge.jp \
    --cc=yuval.shaia.ml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.