|
From: | Wenchao Xia |
Subject: | Re: [Qemu-devel] [PATCH 3/6] qapi: rename prefix QEVENT to Q_EVENT |
Date: | Tue, 29 Oct 2013 13:22:57 +0800 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 |
δΊ 2013/10/28 18:44, Paolo Bonzini ει:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Il 21/10/2013 22:41, Eric Blake ha scritto:On 10/21/2013 03:16 AM, Wenchao Xia wrote:The define will be moved to qapi-schema.json later, so rename the prefix to match its naming style.Wouldn't it be simpler to fix the code generator to special case QEvent to turn into QEVENT, instead of having to go through this churn? But if we _like_ the Q_EVENT_ prefix, then this looks fairly mechanical:No, I disagree. However, since something _is_ being renamed, we might as well rename every QEVENT_ to MONITOR_EVENT_ and avoid patch 2. Paolo
MONITOR_EVENT seems tide to monitor too much, since it will be present in qapi-schema, I think Q_EVENT_ or QMP_EVENT_KIND would be better? I am coding v2, which fully support event define in qapi-schema. There is another thing I hope to know your opinion: Should we support use enum as discriminator? { 'enum': 'QEvent', 'data': [ 'SHUTDOWN', 'POWERDOWN'] { 'type': 'QmpEventBase', 'data': { 'event': 'QEvent', 'timestamp': 'EventTimestamp' } } { 'Union': 'QmpEvent', 'base': 'QmpEventBase', 'discriminator': 'event', 'data': { 'SHUTDOWN' : 'EventShutdown', 'POWERDOWN' : 'EventPowerdown' } } By default 'QmpEvent' will generate a hidden enum type 'QmpEventKind'. but the hidden type define is needed by query-event, so there is two way to archieve it: 1 just use the hidden type in qapi-schema.json. 2 modified the script to support use predefined enum type. In my draft code, both can work, but which one do you prefer?
[Prev in Thread] | Current Thread | [Next in Thread] |