[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 30/32] qmp: Clean up capability negotiation afte
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 30/32] qmp: Clean up capability negotiation after commit 02130314d8c |
Date: |
Tue, 03 Jul 2018 08:50:00 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Eric Blake <address@hidden> writes:
> On 07/02/2018 11:22 AM, Markus Armbruster wrote:
>> qmp_greeting() offers capabilities to the client, and
>> qmp_qmp_capabilities() accepts or denies capabilities requested by the
>> client. The two compute the set of available capabilities
>> independently. Not nice.
>>
>> Clean this up as follows. Compute available capabilities just once in
>> monitor_qmp_caps_reset(), and store them in Monitor member
>> qmp.capab_offered[]. Have qmp_greeting() and qmp_qmp_capabilities()
>> use that. Both are now oblivious of capability details.
>>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>> monitor.c | 93 ++++++++++++++++++++++++-------------------------------
>> 1 file changed, 40 insertions(+), 53 deletions(-)
>>
>> diff --git a/monitor.c b/monitor.c
>> index 876a3a23a7..590e5b5b04 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -172,7 +172,8 @@ typedef struct {
>> * mode.
>> */
>> QmpCommandList *commands;
>> - bool qmp_caps[QMP_CAPABILITY__MAX];
>> + bool capab_offered[QMP_CAPABILITY__MAX]; /* capabilities offered */
>> + bool capab[QMP_CAPABILITY__MAX]; /* offered and accepted */
>
> Could also store as uint32_t, using '1U << bit' to compute various
> capabilities as a bitmask (up to 32 capabilities). But it's not
> frequently executed, so this works.
Yes. I chose to lessen the churn. On a green field, I guess I'd go
with bits out of habit. Might not even be a good habit :)
> Reviewed-by: Eric Blake <address@hidden>
Thanks!
- Re: [Qemu-devel] [PATCH 03/32] docs/interop/qmp: Improve OOB documentation, (continued)
- [Qemu-devel] [PATCH 20/32] monitor: Peel off @mon_global wrapper, Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 22/32] qmp: De-duplicate error response building, Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 28/32] qmp: Switch timestamp_put() to qdict_from_jsonf_nofail(), Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 30/32] qmp: Clean up capability negotiation after commit 02130314d8c, Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 26/32] qmp: Simplify monitor_qmp_respond(), Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 13/32] qmp: Revert change to handle_qmp_command tracepoint, Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 01/32] qmp: Say "out-of-band" instead of "Out-Of-Band", Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 31/32] monitor: Improve some comments, Markus Armbruster, 2018/07/02
- [Qemu-devel] [PATCH 25/32] qmp: Replace get_qmp_greeting() by qmp_greeting(), Markus Armbruster, 2018/07/02