From: Markus Armbruster <armbru@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: drjones@redhat.com, famz@redhat.com, qemu-devel@nongnu.org,
lcapitulino@redhat.com, pbonzini@redhat.com, lersek@redhat.com
Subject: Re: [Qemu-devel] [PATCH v7 00/11] Add basic "detach" support for dump-guest-memory
Date: Thu, 18 Feb 2016 08:26:44 +0100 [thread overview]
Message-ID: <87a8mymqbv.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <1455772616-8668-1-git-send-email-peterx@redhat.com> (Peter Xu's message of "Thu, 18 Feb 2016 13:16:45 +0800")
Peter Xu <peterx@redhat.com> writes:
> Changes from v7:
> - patch 8: use s->dump_info.page_size not TARGET_PAGE_SIZE
> - patch 10: change DUMP_STATUS_MAX to DUMP_STATUS__MAX (this is to
> fix compile error for rebasing to latest master branch, still do
> not know why we need this change from generating "_MAX" to
> "__MAX" for enum types...)
Don't ask yourself why something was done, ask git :)
$ git-log -S__MAX
[...]
commit 7fb1cf1606c78c9d5b538f29176fd5a101726a9d
Author: Eric Blake <eblake@redhat.com>
Date: Wed Nov 18 01:52:57 2015 -0700
---> qapi: Don't let implicit enum MAX member collide
Now that we guarantee the user doesn't have any enum values
beginning with a single underscore, we can use that for our
own purposes. Renaming ENUM_MAX to ENUM__MAX makes it obvious
that the sentinel is generated.
This patch was mostly generated by applying a temporary patch:
|diff --git a/scripts/qapi.py b/scripts/qapi.py
|index e6d014b..b862ec9 100644
|--- a/scripts/qapi.py
|+++ b/scripts/qapi.py
|@@ -1570,6 +1570,7 @@ const char *const %(c_name)s_lookup[] = {
| max_index = c_enum_const(name, 'MAX', prefix)
| ret += mcgen('''
| [%(max_index)s] = NULL,
|+// %(max_index)s
| };
| ''',
| max_index=max_index)
then running:
$ cat qapi-{types,event}.c tests/test-qapi-types.c |
sed -n 's,^// \(.*\)MAX,s|\1MAX|\1_MAX|g,p' > list
$ git grep -l _MAX | xargs sed -i -f list
The only things not generated are the changes in scripts/qapi.py.
Rejecting enum members named 'MAX' is now useless, and will be dropped
in the next patch.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1447836791-369-23-git-send-email-eblake@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
[Rebased to current master, commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
I guess this isn't perfectly clear without more context, so let me add
some.
The implicit FOO_MAX could collide with the user's FOO_MAX for QAPI
enumeration values 'max', or case variations thereof. Commit cf39359
added extra code to catch that.
Renaming the implict FOO_MAX to FOO__MAX removes the need for the
special rule "you can't use 'max' as an enumeration value", because the
general rule "names starting with '_' are reserved" suffices then.
Fewer rules is better.
[...]
next prev parent reply other threads:[~2016-02-18 7:26 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 5:16 [Qemu-devel] [PATCH v7 00/11] Add basic "detach" support for dump-guest-memory Peter Xu
2016-02-18 5:16 ` [Qemu-devel] [PATCH v8 01/11] dump-guest-memory: cleanup: removing dump_{error|cleanup}() Peter Xu
2016-02-18 5:16 ` [Qemu-devel] [PATCH v8 02/11] dump-guest-memory: add "detach" flag for QMP/HMP interfaces Peter Xu
2016-02-18 5:16 ` [Qemu-devel] [PATCH v8 03/11] dump-guest-memory: using static DumpState, add DumpStatus Peter Xu
2016-02-18 5:16 ` [Qemu-devel] [PATCH v8 04/11] dump-guest-memory: add dump_in_progress() helper function Peter Xu
2016-02-18 5:16 ` [Qemu-devel] [PATCH v8 05/11] dump-guest-memory: introduce dump_process() " Peter Xu
2016-02-18 5:16 ` [Qemu-devel] [PATCH v8 06/11] dump-guest-memory: disable dump when in INMIGRATE state Peter Xu
2016-02-18 5:16 ` [Qemu-devel] [PATCH v8 07/11] dump-guest-memory: add "detach" support Peter Xu
2016-02-18 5:16 ` [Qemu-devel] [PATCH v8 08/11] DumpState: adding total_size and written_size fields Peter Xu
2016-02-18 5:16 ` [Qemu-devel] [PATCH v8 09/11] Dump: add qmp command "query-dump" Peter Xu
2016-02-18 5:16 ` [Qemu-devel] [PATCH v8 10/11] Dump: add hmp command "info dump" Peter Xu
2016-02-18 5:16 ` [Qemu-devel] [PATCH v8 11/11] dump-guest-memory: add qmp event DUMP_COMPLETED Peter Xu
2016-02-18 5:25 ` [Qemu-devel] [PATCH v7 00/11] Add basic "detach" support for dump-guest-memory Peter Xu
2016-02-18 7:26 ` Markus Armbruster [this message]
2016-02-18 7:50 ` Peter Xu
2016-02-18 15:26 ` Paolo Bonzini
-- strict thread matches above, loose matches on Subject: below --
2016-02-16 7:50 Peter Xu
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=87a8mymqbv.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=drjones@redhat.com \
--cc=famz@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=lersek@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/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.