aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blkdebug.c4
-rw-r--r--block/file-posix.c8
-rw-r--r--block/file-win32.c2
-rw-r--r--block/gluster.c4
-rw-r--r--block/parallels.c14
-rw-r--r--block/qcow2.c4
-rw-r--r--block/quorum.c2
7 files changed, 21 insertions, 17 deletions
diff --git a/block/blkdebug.c b/block/blkdebug.c
index b370fcedfb..8e385acf54 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -169,7 +169,7 @@ static int add_rule(void *opaque, QemuOpts *opts, Error **errp)
error_setg(errp, "Missing event name for rule");
return -1;
}
- event = qapi_enum_parse(BlkdebugEvent_lookup, event_name, -1, errp);
+ event = qapi_enum_parse(&BlkdebugEvent_lookup, event_name, -1, errp);
if (event < 0) {
return -1;
}
@@ -732,7 +732,7 @@ static int blkdebug_debug_breakpoint(BlockDriverState *bs, const char *event,
struct BlkdebugRule *rule;
int blkdebug_event;
- blkdebug_event = qapi_enum_parse(BlkdebugEvent_lookup, event, -1, NULL);
+ blkdebug_event = qapi_enum_parse(&BlkdebugEvent_lookup, event, -1, NULL);
if (blkdebug_event < 0) {
return -ENOENT;
}
diff --git a/block/file-posix.c b/block/file-posix.c
index bfef91db63..6acbd56238 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -437,7 +437,8 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
aio_default = (bdrv_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, &local_err);
if (local_err) {
error_propagate(errp, local_err);
@@ -446,7 +447,8 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
}
s->use_linux_aio = (aio == BLOCKDEV_AIO_OPTIONS_NATIVE);
- locking = qapi_enum_parse(OnOffAuto_lookup, qemu_opt_get(opts, "locking"),
+ locking = qapi_enum_parse(&OnOffAuto_lookup,
+ qemu_opt_get(opts, "locking"),
ON_OFF_AUTO_AUTO, &local_err);
if (local_err) {
error_propagate(errp, local_err);
@@ -1973,7 +1975,7 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
BDRV_SECTOR_SIZE);
nocow = qemu_opt_get_bool(opts, BLOCK_OPT_NOCOW, false);
buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
- prealloc = qapi_enum_parse(PreallocMode_lookup, buf,
+ prealloc = qapi_enum_parse(&PreallocMode_lookup, buf,
PREALLOC_MODE_OFF, &local_err);
g_free(buf);
if (local_err) {
diff --git a/block/file-win32.c b/block/file-win32.c
index f2a1830060..9e02214a69 100644
--- a/block/file-win32.c
+++ b/block/file-win32.c
@@ -302,7 +302,7 @@ 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) {
diff --git a/block/gluster.c b/block/gluster.c
index 29f9427e47..0f4265a3a4 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -543,7 +543,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
if (!strcmp(ptr, "tcp")) {
ptr = "inet"; /* accept legacy "tcp" */
}
- type = qapi_enum_parse(SocketAddressType_lookup, ptr, -1, NULL);
+ type = qapi_enum_parse(&SocketAddressType_lookup, ptr, -1, NULL);
if (type != SOCKET_ADDRESS_TYPE_INET
&& type != SOCKET_ADDRESS_TYPE_UNIX) {
error_setg(&local_err,
@@ -1000,7 +1000,7 @@ static int qemu_gluster_create(const char *filename,
BDRV_SECTOR_SIZE);
tmp = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
- prealloc = qapi_enum_parse(PreallocMode_lookup, tmp, PREALLOC_MODE_OFF,
+ prealloc = qapi_enum_parse(&PreallocMode_lookup, tmp, PREALLOC_MODE_OFF,
&local_err);
g_free(tmp);
if (local_err) {
diff --git a/block/parallels.c b/block/parallels.c
index d812210b4f..cce7336cac 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -68,13 +68,15 @@ typedef enum ParallelsPreallocMode {
PRL_PREALLOC_MODE__MAX = 2,
} ParallelsPreallocMode;
-static const char *prealloc_mode_lookup[] = {
- "falloc",
- "truncate",
- NULL,
+static QEnumLookup prealloc_mode_lookup = {
+ .array = (const char *const[]) {
+ "falloc",
+ "truncate",
+ NULL,
+ },
+ .size = PRL_PREALLOC_MODE__MAX
};
-
typedef struct BDRVParallelsState {
/** Locking is conservative, the lock protects
* - image file extending (truncate, fallocate)
@@ -695,7 +697,7 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
qemu_opt_get_size_del(opts, PARALLELS_OPT_PREALLOC_SIZE, 0);
s->prealloc_size = MAX(s->tracks, s->prealloc_size >> BDRV_SECTOR_BITS);
buf = qemu_opt_get_del(opts, PARALLELS_OPT_PREALLOC_MODE);
- s->prealloc_mode = qapi_enum_parse(prealloc_mode_lookup, buf,
+ s->prealloc_mode = qapi_enum_parse(&prealloc_mode_lookup, buf,
PRL_PREALLOC_MODE_FALLOCATE,
&local_err);
g_free(buf);
diff --git a/block/qcow2.c b/block/qcow2.c
index cbe9681fb0..2ec399663e 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2915,7 +2915,7 @@ static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp)
goto finish;
}
buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
- prealloc = qapi_enum_parse(PreallocMode_lookup, buf,
+ prealloc = qapi_enum_parse(&PreallocMode_lookup, buf,
PREALLOC_MODE_OFF, &local_err);
if (local_err) {
error_propagate(errp, local_err);
@@ -3605,7 +3605,7 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,
}
optstr = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
- prealloc = qapi_enum_parse(PreallocMode_lookup, optstr,
+ prealloc = qapi_enum_parse(&PreallocMode_lookup, optstr,
PREALLOC_MODE_OFF, &local_err);
g_free(optstr);
if (local_err) {
diff --git a/block/quorum.c b/block/quorum.c
index 8d1c9f6306..272f9a5b77 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -912,7 +912,7 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags,
if (!pattern_str) {
ret = QUORUM_READ_PATTERN_QUORUM;
} else {
- ret = qapi_enum_parse(QuorumReadPattern_lookup, pattern_str,
+ ret = qapi_enum_parse(&QuorumReadPattern_lookup, pattern_str,
-EINVAL, NULL);
}
if (ret < 0) {