aboutsummaryrefslogtreecommitdiff
path: root/hmp.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-08-24 10:46:08 +0200
committerMarkus Armbruster <armbru@redhat.com>2017-09-04 13:09:13 +0200
commit977c736f80c232de7c6476d793ed575359c049d8 (patch)
tree986bf327e75929660aa367008574343e59818ee4 /hmp.c
parent5b5f825d44306b18509cd10ba9ac6983e90d6e0f (diff)
qapi: Mechanically convert FOO_lookup[...] to FOO_str(...)
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503564371-26090-14-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/hmp.c b/hmp.c
index 5d980acb1e..30819fe602 100644
--- a/hmp.c
+++ b/hmp.c
@@ -106,7 +106,7 @@ void hmp_info_status(Monitor *mon, const QDict *qdict)
info->singlestep ? " (single step mode)" : "");
if (!info->running && info->status != RUN_STATE_PAUSED) {
- monitor_printf(mon, " (%s)", RunState_lookup[info->status]);
+ monitor_printf(mon, " (%s)", RunState_str(info->status));
}
monitor_printf(mon, "\n");
@@ -171,7 +171,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "capabilities: ");
for (cap = caps; cap; cap = cap->next) {
monitor_printf(mon, "%s: %s ",
- MigrationCapability_lookup[cap->value->capability],
+ MigrationCapability_str(cap->value->capability),
cap->value->state ? "on" : "off");
}
monitor_printf(mon, "\n");
@@ -179,7 +179,7 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
if (info->has_status) {
monitor_printf(mon, "Migration status: %s",
- MigrationStatus_lookup[info->status]);
+ MigrationStatus_str(info->status));
if (info->status == MIGRATION_STATUS_FAILED &&
info->has_error_desc) {
monitor_printf(mon, " (%s)\n", info->error_desc);
@@ -277,7 +277,7 @@ void hmp_info_migrate_capabilities(Monitor *mon, const QDict *qdict)
if (caps) {
for (cap = caps; cap; cap = cap->next) {
monitor_printf(mon, "%s: %s\n",
- MigrationCapability_lookup[cap->value->capability],
+ MigrationCapability_str(cap->value->capability),
cap->value->state ? "on" : "off");
}
}
@@ -294,48 +294,48 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
if (params) {
assert(params->has_compress_level);
monitor_printf(mon, "%s: %" PRId64 "\n",
- MigrationParameter_lookup[MIGRATION_PARAMETER_COMPRESS_LEVEL],
+ MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_LEVEL),
params->compress_level);
assert(params->has_compress_threads);
monitor_printf(mon, "%s: %" PRId64 "\n",
- MigrationParameter_lookup[MIGRATION_PARAMETER_COMPRESS_THREADS],
+ MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_THREADS),
params->compress_threads);
assert(params->has_decompress_threads);
monitor_printf(mon, "%s: %" PRId64 "\n",
- MigrationParameter_lookup[MIGRATION_PARAMETER_DECOMPRESS_THREADS],
+ MigrationParameter_str(MIGRATION_PARAMETER_DECOMPRESS_THREADS),
params->decompress_threads);
assert(params->has_cpu_throttle_initial);
monitor_printf(mon, "%s: %" PRId64 "\n",
- MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL],
+ MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL),
params->cpu_throttle_initial);
assert(params->has_cpu_throttle_increment);
monitor_printf(mon, "%s: %" PRId64 "\n",
- MigrationParameter_lookup[MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT],
+ MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT),
params->cpu_throttle_increment);
assert(params->has_tls_creds);
monitor_printf(mon, "%s: '%s'\n",
- MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_CREDS],
+ MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS),
params->tls_creds);
assert(params->has_tls_hostname);
monitor_printf(mon, "%s: '%s'\n",
- MigrationParameter_lookup[MIGRATION_PARAMETER_TLS_HOSTNAME],
+ MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME),
params->tls_hostname);
assert(params->has_max_bandwidth);
monitor_printf(mon, "%s: %" PRId64 " bytes/second\n",
- MigrationParameter_lookup[MIGRATION_PARAMETER_MAX_BANDWIDTH],
+ MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH),
params->max_bandwidth);
assert(params->has_downtime_limit);
monitor_printf(mon, "%s: %" PRId64 " milliseconds\n",
- MigrationParameter_lookup[MIGRATION_PARAMETER_DOWNTIME_LIMIT],
+ MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT),
params->downtime_limit);
assert(params->has_x_checkpoint_delay);
monitor_printf(mon, "%s: %" PRId64 "\n",
- MigrationParameter_lookup[MIGRATION_PARAMETER_X_CHECKPOINT_DELAY],
+ MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY),
params->x_checkpoint_delay);
assert(params->has_block_incremental);
monitor_printf(mon, "%s: %s\n",
- MigrationParameter_lookup[MIGRATION_PARAMETER_BLOCK_INCREMENTAL],
- params->block_incremental ? "on" : "off");
+ MigrationParameter_str(MIGRATION_PARAMETER_BLOCK_INCREMENTAL),
+ params->block_incremental ? "on" : "off");
}
qapi_free_MigrationParameters(params);
@@ -431,7 +431,7 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
}
if (info->has_io_status && info->io_status != BLOCK_DEVICE_IO_STATUS_OK) {
monitor_printf(mon, " I/O status: %s\n",
- BlockDeviceIoStatus_lookup[info->io_status]);
+ BlockDeviceIoStatus_str(info->io_status));
}
if (info->removable) {
@@ -461,7 +461,7 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
if (inserted->detect_zeroes != BLOCKDEV_DETECT_ZEROES_OPTIONS_OFF) {
monitor_printf(mon, " Detect zeroes: %s\n",
- BlockdevDetectZeroesOptions_lookup[inserted->detect_zeroes]);
+ BlockdevDetectZeroesOptions_str(inserted->detect_zeroes));
}
if (inserted->bps || inserted->bps_rd || inserted->bps_wr ||
@@ -612,7 +612,7 @@ static void hmp_info_VncBasicInfo(Monitor *mon, VncBasicInfo *info,
name,
info->host,
info->service,
- NetworkAddressFamily_lookup[info->family],
+ NetworkAddressFamily_str(info->family),
info->websocket ? " (Websocket)" : "");
}
@@ -622,8 +622,8 @@ static void hmp_info_vnc_authcrypt(Monitor *mon, const char *indent,
VncVencryptSubAuth *vencrypt)
{
monitor_printf(mon, "%sAuth: %s (Sub: %s)\n", indent,
- VncPrimaryAuth_lookup[auth],
- vencrypt ? VncVencryptSubAuth_lookup[*vencrypt] : "none");
+ VncPrimaryAuth_str(auth),
+ vencrypt ? VncVencryptSubAuth_str(*vencrypt) : "none");
}
static void hmp_info_vnc_clients(Monitor *mon, VncClientInfoList *client)
@@ -738,7 +738,7 @@ void hmp_info_spice(Monitor *mon, const QDict *qdict)
monitor_printf(mon, " auth: %s\n", info->auth);
monitor_printf(mon, " compiled: %s\n", info->compiled_version);
monitor_printf(mon, " mouse-mode: %s\n",
- SpiceQueryMouseMode_lookup[info->mouse_mode]);
+ SpiceQueryMouseMode_str(info->mouse_mode));
if (!info->has_channels || info->channels == NULL) {
monitor_printf(mon, "Channels: none\n");
@@ -1009,10 +1009,10 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict)
for (info = info_list; info; info = info->next) {
TPMInfo *ti = info->value;
monitor_printf(mon, " tpm%d: model=%s\n",
- c, TpmModel_lookup[ti->model]);
+ c, TpmModel_str(ti->model));
monitor_printf(mon, " \\ %s: type=%s",
- ti->id, TpmTypeOptionsKind_lookup[ti->options->type]);
+ ti->id, TpmTypeOptionsKind_str(ti->options->type));
switch (ti->options->type) {
case TPM_TYPE_OPTIONS_KIND_PASSTHROUGH:
@@ -2368,7 +2368,7 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict)
monitor_printf(mon, " prealloc: %s\n",
m->value->prealloc ? "true" : "false");
monitor_printf(mon, " policy: %s\n",
- HostMemPolicy_lookup[m->value->policy]);
+ HostMemPolicy_str(m->value->policy));
visit_complete(v, &str);
monitor_printf(mon, " host nodes: %s\n", str);
@@ -2399,7 +2399,7 @@ void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
di = value->u.dimm.data;
monitor_printf(mon, "Memory device [%s]: \"%s\"\n",
- MemoryDeviceInfoKind_lookup[value->type],
+ MemoryDeviceInfoKind_str(value->type),
di->id ? di->id : "");
monitor_printf(mon, " addr: 0x%" PRIx64 "\n", di->addr);
monitor_printf(mon, " slot: %" PRId64 "\n", di->slot);
@@ -2793,7 +2793,7 @@ void hmp_info_dump(Monitor *mon, const QDict *qdict)
DumpQueryResult *result = qmp_query_dump(NULL);
assert(result && result->status < DUMP_STATUS__MAX);
- monitor_printf(mon, "Status: %s\n", DumpStatus_lookup[result->status]);
+ monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status));
if (result->status == DUMP_STATUS_ACTIVE) {
float percent = 0;