[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 15/16] qapi: Change data type of the FOO_lookup
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 15/16] qapi: Change data type of the FOO_lookup generated for enum FOO |
Date: |
Thu, 24 Aug 2017 11:55:59 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) |
Markus Armbruster <address@hidden> writes:
> From: Marc-André Lureau <address@hidden>
>
> Currently, a FOO_lookup is an array of strings terminated by a NULL
> sentinel.
>
> A future patch will generate enums with "holes". NULL-termination
> will cease to work then.
>
> To prepare for that, store the length in the FOO_lookup by wrapping it
> in a struct and adding a member for the length.
>
> The sentinel will be dropped next.
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> Message-Id: <address@hidden>
> [Basically redone]
> Signed-off-by: Markus Armbruster <address@hidden>
Fixup for Windows (thanks, Patchew!)
>From 594a6c8eb29e728e9fb960d321ca2d17f9bd9cd1 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <address@hidden>
Date: Thu, 24 Aug 2017 11:48:46 +0200
Subject: [PATCH] fixup! qapi: Change data type of the FOO_lookup generated for
enum FOO
---
block/file-win32.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/file-win32.c b/block/file-win32.c
index f2a1830..639221b 100644
--- a/block/file-win32.c
+++ b/block/file-win32.c
@@ -302,7 +302,8 @@ static bool get_aio_option(QemuOpts *opts, int flags, Error
**errp)
aio_default = (flags & BDRV_O_NATIVE_AIO) ? BLOCKDEV_AIO_OPTIONS_NATIVE
: BLOCKDEV_AIO_OPTIONS_THREADS;
- aio = qapi_enum_parse(BlockdevAioOptions_lookup, qemu_opt_get(opts, "aio"),
+ aio = qapi_enum_parse(&BlockdevAioOptions_lookup,
+ qemu_opt_get(opts, "aio"),
aio_default, errp);
switch (aio) {
--
2.7.5
- Re: [Qemu-devel] [PATCH 02/16] qapi: Drop superfluous qapi_enum_parse() parameter max, (continued)
[Qemu-devel] [PATCH 07/16] block: Use qemu_enum_parse() in blkdebug_debug_breakpoint(), Markus Armbruster, 2017/08/24
[Qemu-devel] [PATCH 03/16] tpm: Clean up driver registration & lookup, Markus Armbruster, 2017/08/24
[Qemu-devel] [PATCH 09/16] crypto: Use qapi_enum_parse() in qcrypto_block_luks_name_lookup(), Markus Armbruster, 2017/08/24
[Qemu-devel] [PATCH 15/16] qapi: Change data type of the FOO_lookup generated for enum FOO, Markus Armbruster, 2017/08/24
- Re: [Qemu-devel] [PATCH 15/16] qapi: Change data type of the FOO_lookup generated for enum FOO,
Markus Armbruster <=
[Qemu-devel] [PATCH 06/16] hmp: Use qapi_enum_parse() in hmp_migrate_set_parameter(), Markus Armbruster, 2017/08/24
[Qemu-devel] [PATCH 13/16] qapi: Mechanically convert FOO_lookup[...] to FOO_str(...), Markus Armbruster, 2017/08/24
Re: [Qemu-devel] [PATCH 00/16] qapi: Rework mapping of enum value to string, no-reply, 2017/08/24