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>
This commit is contained in:
parent
5b5f825d44
commit
977c736f80
@ -304,7 +304,7 @@ host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
|
||||
return;
|
||||
} else if (maxnode == 0 && backend->policy != MPOL_DEFAULT) {
|
||||
error_setg(errp, "host-nodes must be set for policy %s",
|
||||
HostMemPolicy_lookup[backend->policy]);
|
||||
HostMemPolicy_str(backend->policy));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -596,7 +596,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs,
|
||||
error_setg(errp,
|
||||
"a sync_bitmap was provided to backup_run, "
|
||||
"but received an incompatible sync_mode (%s)",
|
||||
MirrorSyncMode_lookup[sync_mode]);
|
||||
MirrorSyncMode_str(sync_mode));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1724,7 +1724,7 @@ static int raw_regular_truncate(int fd, int64_t offset, PreallocMode prealloc,
|
||||
default:
|
||||
result = -ENOTSUP;
|
||||
error_setg(errp, "Unsupported preallocation mode: %s",
|
||||
PreallocMode_lookup[prealloc]);
|
||||
PreallocMode_str(prealloc));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1759,7 +1759,7 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
if (prealloc != PREALLOC_MODE_OFF) {
|
||||
error_setg(errp, "Preallocation mode '%s' unsupported for this "
|
||||
"non-regular file", PreallocMode_lookup[prealloc]);
|
||||
"non-regular file", PreallocMode_str(prealloc));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
if (prealloc != PREALLOC_MODE_OFF) {
|
||||
error_setg(errp, "Unsupported preallocation mode '%s'",
|
||||
PreallocMode_lookup[prealloc]);
|
||||
PreallocMode_str(prealloc));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -1047,7 +1047,7 @@ static int qemu_gluster_create(const char *filename,
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
error_setg(errp, "Unsupported preallocation mode: %s",
|
||||
PreallocMode_lookup[prealloc]);
|
||||
PreallocMode_str(prealloc));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1099,7 +1099,7 @@ static int qemu_gluster_truncate(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
if (prealloc != PREALLOC_MODE_OFF) {
|
||||
error_setg(errp, "Unsupported preallocation mode '%s'",
|
||||
PreallocMode_lookup[prealloc]);
|
||||
PreallocMode_str(prealloc));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -2087,7 +2087,7 @@ static int iscsi_truncate(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
if (prealloc != PREALLOC_MODE_OFF) {
|
||||
error_setg(errp, "Unsupported preallocation mode '%s'",
|
||||
PreallocMode_lookup[prealloc]);
|
||||
PreallocMode_str(prealloc));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -772,7 +772,7 @@ static int nfs_file_truncate(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
if (prealloc != PREALLOC_MODE_OFF) {
|
||||
error_setg(errp, "Unsupported preallocation mode '%s'",
|
||||
PreallocMode_lookup[prealloc]);
|
||||
PreallocMode_str(prealloc));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -2715,7 +2715,7 @@ static int qcow2_create2(const char *filename, int64_t total_size,
|
||||
int64_t prealloc_size =
|
||||
qcow2_calc_prealloc_size(total_size, cluster_size, refcount_order);
|
||||
qemu_opt_set_number(opts, BLOCK_OPT_SIZE, prealloc_size, &error_abort);
|
||||
qemu_opt_set(opts, BLOCK_OPT_PREALLOC, PreallocMode_lookup[prealloc],
|
||||
qemu_opt_set(opts, BLOCK_OPT_PREALLOC, PreallocMode_str(prealloc),
|
||||
&error_abort);
|
||||
}
|
||||
|
||||
@ -3080,7 +3080,7 @@ static int qcow2_truncate(BlockDriverState *bs, int64_t offset,
|
||||
prealloc != PREALLOC_MODE_FALLOC && prealloc != PREALLOC_MODE_FULL)
|
||||
{
|
||||
error_setg(errp, "Unsupported preallocation mode '%s'",
|
||||
PreallocMode_lookup[prealloc]);
|
||||
PreallocMode_str(prealloc));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -1399,7 +1399,7 @@ static int bdrv_qed_truncate(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
if (prealloc != PREALLOC_MODE_OFF) {
|
||||
error_setg(errp, "Unsupported preallocation mode '%s'",
|
||||
PreallocMode_lookup[prealloc]);
|
||||
PreallocMode_str(prealloc));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -944,7 +944,7 @@ static int qemu_rbd_truncate(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
if (prealloc != PREALLOC_MODE_OFF) {
|
||||
error_setg(errp, "Unsupported preallocation mode '%s'",
|
||||
PreallocMode_lookup[prealloc]);
|
||||
PreallocMode_str(prealloc));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -2176,7 +2176,7 @@ static int sd_truncate(BlockDriverState *bs, int64_t offset,
|
||||
|
||||
if (prealloc != PREALLOC_MODE_OFF) {
|
||||
error_setg(errp, "Unsupported preallocation mode '%s'",
|
||||
PreallocMode_lookup[prealloc]);
|
||||
PreallocMode_str(prealloc));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
@ -1466,8 +1466,8 @@ static int action_check_completion_mode(BlkActionState *s, Error **errp)
|
||||
error_setg(errp,
|
||||
"Action '%s' does not support Transaction property "
|
||||
"completion-mode = %s",
|
||||
TransactionActionKind_lookup[s->action->type],
|
||||
ActionCompletionMode_lookup[s->txn_props->completion_mode]);
|
||||
TransactionActionKind_str(s->action->type),
|
||||
ActionCompletionMode_str(s->txn_props->completion_mode));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -208,7 +208,7 @@ static char *child_job_get_parent_desc(BdrvChild *c)
|
||||
{
|
||||
BlockJob *job = c->opaque;
|
||||
return g_strdup_printf("%s job '%s'",
|
||||
BlockJobType_lookup[job->driver->job_type],
|
||||
BlockJobType_str(job->driver->job_type),
|
||||
job->id);
|
||||
}
|
||||
|
||||
@ -553,7 +553,7 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp)
|
||||
return NULL;
|
||||
}
|
||||
info = g_new0(BlockJobInfo, 1);
|
||||
info->type = g_strdup(BlockJobType_lookup[job->driver->job_type]);
|
||||
info->type = g_strdup(BlockJobType_str(job->driver->job_type));
|
||||
info->device = g_strdup(job->id);
|
||||
info->len = job->len;
|
||||
info->busy = job->busy;
|
||||
@ -666,7 +666,7 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
|
||||
job->refcnt = 1;
|
||||
|
||||
error_setg(&job->blocker, "block device is in use by block job: %s",
|
||||
BlockJobType_lookup[driver->job_type]);
|
||||
BlockJobType_str(driver->job_type));
|
||||
block_job_add_bdrv(job, "main node", bs, 0, BLK_PERM_ALL, &error_abort);
|
||||
bs->job = job;
|
||||
|
||||
|
@ -931,7 +931,7 @@ ChardevReturn *qmp_chardev_add(const char *id, ChardevBackend *backend,
|
||||
ChardevReturn *ret;
|
||||
Chardev *chr;
|
||||
|
||||
cc = char_get_class(ChardevBackendKind_lookup[backend->type], errp);
|
||||
cc = char_get_class(ChardevBackendKind_str(backend->type), errp);
|
||||
if (!cc) {
|
||||
return NULL;
|
||||
}
|
||||
@ -989,7 +989,7 @@ ChardevReturn *qmp_chardev_change(const char *id, ChardevBackend *backend,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cc = char_get_class(ChardevBackendKind_lookup[backend->type], errp);
|
||||
cc = char_get_class(ChardevBackendKind_str(backend->type), errp);
|
||||
if (!cc) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ qcrypto_block_luks_cipher_alg_lookup(QCryptoCipherAlgorithm alg,
|
||||
}
|
||||
|
||||
error_setg(errp, "Algorithm '%s' not supported",
|
||||
QCryptoCipherAlgorithm_lookup[alg]);
|
||||
QCryptoCipherAlgorithm_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -392,7 +392,7 @@ qcrypto_block_luks_essiv_cipher(QCryptoCipherAlgorithm cipher,
|
||||
break;
|
||||
default:
|
||||
error_setg(errp, "Cipher %s not supported with essiv",
|
||||
QCryptoCipherAlgorithm_lookup[cipher]);
|
||||
QCryptoCipherAlgorithm_str(cipher));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -962,16 +962,16 @@ qcrypto_block_luks_create(QCryptoBlock *block,
|
||||
goto error;
|
||||
}
|
||||
|
||||
cipher_mode = QCryptoCipherMode_lookup[luks_opts.cipher_mode];
|
||||
ivgen_alg = QCryptoIVGenAlgorithm_lookup[luks_opts.ivgen_alg];
|
||||
cipher_mode = QCryptoCipherMode_str(luks_opts.cipher_mode);
|
||||
ivgen_alg = QCryptoIVGenAlgorithm_str(luks_opts.ivgen_alg);
|
||||
if (luks_opts.has_ivgen_hash_alg) {
|
||||
ivgen_hash_alg = QCryptoHashAlgorithm_lookup[luks_opts.ivgen_hash_alg];
|
||||
ivgen_hash_alg = QCryptoHashAlgorithm_str(luks_opts.ivgen_hash_alg);
|
||||
cipher_mode_spec = g_strdup_printf("%s-%s:%s", cipher_mode, ivgen_alg,
|
||||
ivgen_hash_alg);
|
||||
} else {
|
||||
cipher_mode_spec = g_strdup_printf("%s-%s", cipher_mode, ivgen_alg);
|
||||
}
|
||||
hash_alg = QCryptoHashAlgorithm_lookup[luks_opts.hash_alg];
|
||||
hash_alg = QCryptoHashAlgorithm_str(luks_opts.hash_alg);
|
||||
|
||||
|
||||
if (strlen(cipher_alg) >= QCRYPTO_BLOCK_LUKS_CIPHER_NAME_LEN) {
|
||||
|
@ -61,7 +61,7 @@ QCryptoBlock *qcrypto_block_open(QCryptoBlockOpenOptions *options,
|
||||
if (options->format >= G_N_ELEMENTS(qcrypto_block_drivers) ||
|
||||
!qcrypto_block_drivers[options->format]) {
|
||||
error_setg(errp, "Unsupported block driver %s",
|
||||
QCryptoBlockFormat_lookup[options->format]);
|
||||
QCryptoBlockFormat_str(options->format));
|
||||
g_free(block);
|
||||
return NULL;
|
||||
}
|
||||
@ -92,7 +92,7 @@ QCryptoBlock *qcrypto_block_create(QCryptoBlockCreateOptions *options,
|
||||
if (options->format >= G_N_ELEMENTS(qcrypto_block_drivers) ||
|
||||
!qcrypto_block_drivers[options->format]) {
|
||||
error_setg(errp, "Unsupported block driver %s",
|
||||
QCryptoBlockFormat_lookup[options->format]);
|
||||
QCryptoBlockFormat_str(options->format));
|
||||
g_free(block);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ qcrypto_afalg_cipher_format_name(QCryptoCipherAlgorithm alg,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mode_name = QCryptoCipherMode_lookup[mode];
|
||||
mode_name = QCryptoCipherMode_str(mode);
|
||||
name = g_strdup_printf("%s(%s)", mode_name, alg_name);
|
||||
|
||||
return name;
|
||||
|
@ -247,7 +247,7 @@ qcrypto_cipher_init_aes(QCryptoCipherMode mode,
|
||||
mode != QCRYPTO_CIPHER_MODE_ECB &&
|
||||
mode != QCRYPTO_CIPHER_MODE_XTS) {
|
||||
error_setg(errp, "Unsupported cipher mode %s",
|
||||
QCryptoCipherMode_lookup[mode]);
|
||||
QCryptoCipherMode_str(mode));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ qcrypto_cipher_init_des_rfb(QCryptoCipherMode mode,
|
||||
|
||||
if (mode != QCRYPTO_CIPHER_MODE_ECB) {
|
||||
error_setg(errp, "Unsupported cipher mode %s",
|
||||
QCryptoCipherMode_lookup[mode]);
|
||||
QCryptoCipherMode_str(mode));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -440,7 +440,7 @@ static QCryptoCipherBuiltin *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
break;
|
||||
default:
|
||||
error_setg(errp, "Unsupported cipher mode %s",
|
||||
QCryptoCipherMode_lookup[mode]);
|
||||
QCryptoCipherMode_str(mode));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -460,7 +460,7 @@ static QCryptoCipherBuiltin *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
default:
|
||||
error_setg(errp,
|
||||
"Unsupported cipher algorithm %s",
|
||||
QCryptoCipherAlgorithm_lookup[alg]);
|
||||
QCryptoCipherAlgorithm_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ static QCryptoCipherGcrypt *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
break;
|
||||
default:
|
||||
error_setg(errp, "Unsupported cipher mode %s",
|
||||
QCryptoCipherMode_lookup[mode]);
|
||||
QCryptoCipherMode_str(mode));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ static QCryptoCipherGcrypt *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
|
||||
default:
|
||||
error_setg(errp, "Unsupported cipher algorithm %s",
|
||||
QCryptoCipherAlgorithm_lookup[alg]);
|
||||
QCryptoCipherAlgorithm_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ static QCryptoCipherNettle *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
break;
|
||||
default:
|
||||
error_setg(errp, "Unsupported cipher mode %s",
|
||||
QCryptoCipherMode_lookup[mode]);
|
||||
QCryptoCipherMode_str(mode));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ static QCryptoCipherNettle *qcrypto_cipher_ctx_new(QCryptoCipherAlgorithm alg,
|
||||
|
||||
default:
|
||||
error_setg(errp, "Unsupported cipher algorithm %s",
|
||||
QCryptoCipherAlgorithm_lookup[alg]);
|
||||
QCryptoCipherAlgorithm_str(alg));
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -491,7 +491,7 @@ qcrypto_nettle_cipher_encrypt(QCryptoCipher *cipher,
|
||||
|
||||
default:
|
||||
error_setg(errp, "Unsupported cipher mode %s",
|
||||
QCryptoCipherMode_lookup[cipher->mode]);
|
||||
QCryptoCipherMode_str(cipher->mode));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@ -537,7 +537,7 @@ qcrypto_nettle_cipher_decrypt(QCryptoCipher *cipher,
|
||||
|
||||
default:
|
||||
error_setg(errp, "Unsupported cipher mode %s",
|
||||
QCryptoCipherMode_lookup[cipher->mode]);
|
||||
QCryptoCipherMode_str(cipher->mode));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -52,7 +52,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
|
||||
if (!qcrypto_hmac_supports(alg)) {
|
||||
error_setg(errp, "Unsupported hmac algorithm %s",
|
||||
QCryptoHashAlgorithm_lookup[alg]);
|
||||
QCryptoHashAlgorithm_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
|
||||
if (!qcrypto_hmac_supports(alg)) {
|
||||
error_setg(errp, "Unsupported hmac algorithm %s",
|
||||
QCryptoHashAlgorithm_lookup[alg]);
|
||||
QCryptoHashAlgorithm_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ void *qcrypto_hmac_ctx_new(QCryptoHashAlgorithm alg,
|
||||
|
||||
if (!qcrypto_hmac_supports(alg)) {
|
||||
error_setg(errp, "Unsupported hmac algorithm %s",
|
||||
QCryptoHashAlgorithm_lookup[alg]);
|
||||
QCryptoHashAlgorithm_str(alg));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
|
||||
hash_map[hash] == GCRY_MD_NONE) {
|
||||
error_setg_errno(errp, ENOSYS,
|
||||
"PBKDF does not support hash algorithm %s",
|
||||
QCryptoHashAlgorithm_lookup[hash]);
|
||||
QCryptoHashAlgorithm_str(hash));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ int qcrypto_pbkdf2(QCryptoHashAlgorithm hash,
|
||||
default:
|
||||
error_setg_errno(errp, ENOSYS,
|
||||
"PBKDF does not support hash algorithm %s",
|
||||
QCryptoHashAlgorithm_lookup[hash]);
|
||||
QCryptoHashAlgorithm_str(hash));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
54
hmp.c
54
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;
|
||||
|
@ -392,9 +392,9 @@ static int pick_geometry(FDrive *drv)
|
||||
FLOPPY_DPRINTF("User requested floppy drive type '%s', "
|
||||
"but inserted medium appears to be a "
|
||||
"%"PRId64" sector '%s' type\n",
|
||||
FloppyDriveType_lookup[drv->drive],
|
||||
FloppyDriveType_str(drv->drive),
|
||||
nb_sectors,
|
||||
FloppyDriveType_lookup[parse->drive]);
|
||||
FloppyDriveType_str(parse->drive));
|
||||
}
|
||||
match = type_match;
|
||||
}
|
||||
@ -403,7 +403,7 @@ static int pick_geometry(FDrive *drv)
|
||||
if (match == -1) {
|
||||
error_setg(&error_abort, "No candidate geometries present in table "
|
||||
" for floppy drive type '%s'",
|
||||
FloppyDriveType_lookup[drv->drive]);
|
||||
FloppyDriveType_str(drv->drive));
|
||||
}
|
||||
|
||||
parse = &(fd_formats[match]);
|
||||
|
@ -848,7 +848,7 @@ static void sunkbd_handle_event(DeviceState *dev, QemuConsole *src,
|
||||
assert(evt->type == INPUT_EVENT_KIND_KEY);
|
||||
key = evt->u.key.data;
|
||||
qcode = qemu_input_key_value_to_qcode(key->key);
|
||||
trace_escc_sunkbd_event_in(qcode, QKeyCode_lookup[qcode],
|
||||
trace_escc_sunkbd_event_in(qcode, QKeyCode_str(qcode),
|
||||
key->down);
|
||||
|
||||
if (qcode == Q_KEY_CODE_CAPS_LOCK) {
|
||||
|
@ -209,7 +209,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
|
||||
} else {
|
||||
if (key->down) {
|
||||
fprintf(stderr, "%s: unmapped key: %d [%s]\n", __func__,
|
||||
qcode, QKeyCode_lookup[qcode]);
|
||||
qcode, QKeyCode_str(qcode));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -224,7 +224,7 @@ static void virtio_input_handle_event(DeviceState *dev, QemuConsole *src,
|
||||
if (btn->down) {
|
||||
fprintf(stderr, "%s: unmapped button: %d [%s]\n", __func__,
|
||||
btn->button,
|
||||
InputButton_lookup[btn->button]);
|
||||
InputButton_str(btn->button));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -34,7 +34,7 @@ static void colo_failover_bh(void *opaque)
|
||||
FAILOVER_STATUS_ACTIVE);
|
||||
if (old_state != FAILOVER_STATUS_REQUIRE) {
|
||||
error_report("Unknown error for failover, old_state = %s",
|
||||
FailoverStatus_lookup[old_state]);
|
||||
FailoverStatus_str(old_state));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ FailoverStatus failover_set_state(FailoverStatus old_state,
|
||||
|
||||
old = atomic_cmpxchg(&failover_state, old_state, new_state);
|
||||
if (old == old_state) {
|
||||
trace_colo_failover_set_state(FailoverStatus_lookup[new_state]);
|
||||
trace_colo_failover_set_state(FailoverStatus_str(new_state));
|
||||
}
|
||||
return old;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ static void secondary_vm_do_failover(void)
|
||||
FAILOVER_STATUS_RELAUNCH);
|
||||
if (old_state != FAILOVER_STATUS_ACTIVE) {
|
||||
error_report("Unknown error while do failover for secondary VM,"
|
||||
"old_state: %s", FailoverStatus_lookup[old_state]);
|
||||
"old_state: %s", FailoverStatus_str(old_state));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -91,7 +91,7 @@ static void secondary_vm_do_failover(void)
|
||||
FAILOVER_STATUS_COMPLETED);
|
||||
if (old_state != FAILOVER_STATUS_ACTIVE) {
|
||||
error_report("Incorrect state (%s) while doing failover for "
|
||||
"secondary VM", FailoverStatus_lookup[old_state]);
|
||||
"secondary VM", FailoverStatus_str(old_state));
|
||||
return;
|
||||
}
|
||||
/* Notify COLO incoming thread that failover work is finished */
|
||||
@ -126,7 +126,7 @@ static void primary_vm_do_failover(void)
|
||||
FAILOVER_STATUS_COMPLETED);
|
||||
if (old_state != FAILOVER_STATUS_ACTIVE) {
|
||||
error_report("Incorrect state (%s) while doing failover for Primary VM",
|
||||
FailoverStatus_lookup[old_state]);
|
||||
FailoverStatus_str(old_state));
|
||||
return;
|
||||
}
|
||||
/* Notify COLO thread that failover work is finished */
|
||||
@ -222,7 +222,7 @@ static void colo_send_message(QEMUFile *f, COLOMessage msg,
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Can't send COLO message");
|
||||
}
|
||||
trace_colo_send_message(COLOMessage_lookup[msg]);
|
||||
trace_colo_send_message(COLOMessage_str(msg));
|
||||
}
|
||||
|
||||
static void colo_send_message_value(QEMUFile *f, COLOMessage msg,
|
||||
@ -242,7 +242,7 @@ static void colo_send_message_value(QEMUFile *f, COLOMessage msg,
|
||||
ret = qemu_file_get_error(f);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Failed to send value for message:%s",
|
||||
COLOMessage_lookup[msg]);
|
||||
COLOMessage_str(msg));
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ static COLOMessage colo_receive_message(QEMUFile *f, Error **errp)
|
||||
error_setg(errp, "%s: Invalid message", __func__);
|
||||
return msg;
|
||||
}
|
||||
trace_colo_receive_message(COLOMessage_lookup[msg]);
|
||||
trace_colo_receive_message(COLOMessage_str(msg));
|
||||
return msg;
|
||||
}
|
||||
|
||||
@ -299,7 +299,7 @@ static uint64_t colo_receive_message_value(QEMUFile *f, uint32_t expect_msg,
|
||||
ret = qemu_file_get_error(f);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Failed to get value for COLO message: %s",
|
||||
COLOMessage_lookup[expect_msg]);
|
||||
COLOMessage_str(expect_msg));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ int global_state_store(void)
|
||||
|
||||
void global_state_store_running(void)
|
||||
{
|
||||
const char *state = RunState_lookup[RUN_STATE_RUNNING];
|
||||
const char *state = RunState_str(RUN_STATE_RUNNING);
|
||||
strncpy((char *)global_state.runstate,
|
||||
state, sizeof(global_state.runstate));
|
||||
}
|
||||
|
16
monitor.c
16
monitor.c
@ -928,7 +928,7 @@ EventInfoList *qmp_query_events(Error **errp)
|
||||
QAPIEvent e;
|
||||
|
||||
for (e = 0 ; e < QAPI_EVENT__MAX ; e++) {
|
||||
const char *event_name = QAPIEvent_lookup[e];
|
||||
const char *event_name = QAPIEvent_str(e);
|
||||
assert(event_name != NULL);
|
||||
info = g_malloc0(sizeof(*info));
|
||||
info->value = g_malloc0(sizeof(*info->value));
|
||||
@ -3250,7 +3250,7 @@ void netdev_add_completion(ReadLineState *rs, int nb_args, const char *str)
|
||||
len = strlen(str);
|
||||
readline_set_completion_index(rs, len);
|
||||
for (i = 0; i < NET_CLIENT_DRIVER__MAX; i++) {
|
||||
add_completion_option(rs, str, NetClientDriver_lookup[i]);
|
||||
add_completion_option(rs, str, NetClientDriver_str(i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3434,8 +3434,8 @@ void sendkey_completion(ReadLineState *rs, int nb_args, const char *str)
|
||||
len = strlen(str);
|
||||
readline_set_completion_index(rs, len);
|
||||
for (i = 0; i < Q_KEY_CODE__MAX; i++) {
|
||||
if (!strncmp(str, QKeyCode_lookup[i], len)) {
|
||||
readline_add_completion(rs, QKeyCode_lookup[i]);
|
||||
if (!strncmp(str, QKeyCode_str(i), len)) {
|
||||
readline_add_completion(rs, QKeyCode_str(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3538,7 +3538,7 @@ void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str)
|
||||
}
|
||||
readline_set_completion_index(rs, strlen(str));
|
||||
for (i = 0; i < WATCHDOG_EXPIRATION_ACTION__MAX; i++) {
|
||||
add_completion_option(rs, str, WatchdogExpirationAction_lookup[i]);
|
||||
add_completion_option(rs, str, WatchdogExpirationAction_str(i));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3552,7 +3552,7 @@ void migrate_set_capability_completion(ReadLineState *rs, int nb_args,
|
||||
if (nb_args == 2) {
|
||||
int i;
|
||||
for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) {
|
||||
const char *name = MigrationCapability_lookup[i];
|
||||
const char *name = MigrationCapability_str(i);
|
||||
if (!strncmp(str, name, len)) {
|
||||
readline_add_completion(rs, name);
|
||||
}
|
||||
@ -3573,7 +3573,7 @@ void migrate_set_parameter_completion(ReadLineState *rs, int nb_args,
|
||||
if (nb_args == 2) {
|
||||
int i;
|
||||
for (i = 0; i < MIGRATION_PARAMETER__MAX; i++) {
|
||||
const char *name = MigrationParameter_lookup[i];
|
||||
const char *name = MigrationParameter_str(i);
|
||||
if (!strncmp(str, name, len)) {
|
||||
readline_add_completion(rs, name);
|
||||
}
|
||||
@ -3852,7 +3852,7 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
|
||||
qdict = qdict_get_qdict(qobject_to_qdict(rsp), "error");
|
||||
if (qdict
|
||||
&& !g_strcmp0(qdict_get_try_str(qdict, "class"),
|
||||
QapiErrorClass_lookup[ERROR_CLASS_COMMAND_NOT_FOUND])) {
|
||||
QapiErrorClass_str(ERROR_CLASS_COMMAND_NOT_FOUND))) {
|
||||
/* Provide a more useful error message */
|
||||
qdict_del(qdict, "desc");
|
||||
qdict_put_str(qdict, "desc", "Expecting capabilities negotiation"
|
||||
|
@ -1064,7 +1064,7 @@ static int net_client_init1(const void *object, bool is_netdev, Error **errp)
|
||||
/* FIXME drop when all init functions store an Error */
|
||||
if (errp && !*errp) {
|
||||
error_setg(errp, QERR_DEVICE_INIT_FAILED,
|
||||
NetClientDriver_lookup[netdev->type]);
|
||||
NetClientDriver_str(netdev->type));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -1288,7 +1288,7 @@ void print_net_client(Monitor *mon, NetClientState *nc)
|
||||
|
||||
monitor_printf(mon, "%s: index=%d,type=%s,%s\n", nc->name,
|
||||
nc->queue_index,
|
||||
NetClientDriver_lookup[nc->info->type],
|
||||
NetClientDriver_str(nc->info->type),
|
||||
nc->info_str);
|
||||
if (!QTAILQ_EMPTY(&nc->filters)) {
|
||||
monitor_printf(mon, "filters:\n");
|
||||
|
@ -118,7 +118,7 @@ static QObject *do_qmp_dispatch(QmpCommandList *cmds, QObject *request,
|
||||
QObject *qmp_build_error_object(Error *err)
|
||||
{
|
||||
return qobject_from_jsonf("{ 'class': %s, 'desc': %s }",
|
||||
QapiErrorClass_lookup[error_get_class(err)],
|
||||
QapiErrorClass_str(error_get_class(err)),
|
||||
error_get_pretty(err));
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ static void test_qapi_enum_parse(void)
|
||||
ret = qapi_enum_parse(QType_lookup, "none", -1, &error_abort);
|
||||
g_assert_cmpint(ret, ==, QTYPE_NONE);
|
||||
|
||||
ret = qapi_enum_parse(QType_lookup, QType_lookup[QTYPE__MAX - 1],
|
||||
ret = qapi_enum_parse(QType_lookup, QType_str(QTYPE__MAX - 1),
|
||||
QTYPE__MAX - 1, &error_abort);
|
||||
g_assert_cmpint(ret, ==, QTYPE__MAX - 1);
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
|
||||
for (i = 0; i < ENUM_ONE__MAX; i++) {
|
||||
EnumOne res = -1;
|
||||
|
||||
v = visitor_input_test_init(data, "%s", EnumOne_lookup[i]);
|
||||
v = visitor_input_test_init(data, "%s", EnumOne_str(i));
|
||||
|
||||
visit_type_EnumOne(v, NULL, &res, &error_abort);
|
||||
g_assert_cmpint(i, ==, res);
|
||||
@ -699,7 +699,7 @@ static void test_native_list_integer_helper(TestInputVisitorData *data,
|
||||
}
|
||||
}
|
||||
g_string_append_printf(gstr_union, "{ 'type': '%s', 'data': [ %s ] }",
|
||||
UserDefNativeListUnionKind_lookup[kind],
|
||||
UserDefNativeListUnionKind_str(kind),
|
||||
gstr_list->str);
|
||||
v = visitor_input_test_init_raw(data, gstr_union->str);
|
||||
|
||||
|
@ -133,7 +133,7 @@ static void test_visitor_out_enum(TestOutputVisitorData *data,
|
||||
|
||||
qstr = qobject_to_qstring(visitor_get(data));
|
||||
g_assert(qstr);
|
||||
g_assert_cmpstr(qstring_get_str(qstr), ==, EnumOne_lookup[i]);
|
||||
g_assert_cmpstr(qstring_get_str(qstr), ==, EnumOne_str(i));
|
||||
visitor_reset(data);
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
|
||||
for (i = 0; i < ENUM_ONE__MAX; i++) {
|
||||
EnumOne res = -1;
|
||||
|
||||
v = visitor_input_test_init(data, EnumOne_lookup[i]);
|
||||
v = visitor_input_test_init(data, EnumOne_str(i));
|
||||
|
||||
visit_type_EnumOne(v, NULL, &res, &err);
|
||||
g_assert(!err);
|
||||
|
@ -194,12 +194,12 @@ static void test_visitor_out_enum(TestOutputVisitorData *data,
|
||||
|
||||
str = visitor_get(data);
|
||||
if (data->human) {
|
||||
char *str_human = g_strdup_printf("\"%s\"", EnumOne_lookup[i]);
|
||||
char *str_human = g_strdup_printf("\"%s\"", EnumOne_str(i));
|
||||
|
||||
g_assert_cmpstr(str, ==, str_human);
|
||||
g_free(str_human);
|
||||
} else {
|
||||
g_assert_cmpstr(str, ==, EnumOne_lookup[i]);
|
||||
g_assert_cmpstr(str, ==, EnumOne_str(i));
|
||||
}
|
||||
visitor_reset(data);
|
||||
}
|
||||
|
2
tpm.c
2
tpm.c
@ -62,7 +62,7 @@ static void tpm_display_backend_drivers(void)
|
||||
continue;
|
||||
}
|
||||
fprintf(stderr, "%12s %s\n",
|
||||
TpmType_lookup[i], be_drivers[i]->desc());
|
||||
TpmType_str(i), be_drivers[i]->desc());
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ int index_from_key(const char *key, size_t key_length)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < Q_KEY_CODE__MAX; i++) {
|
||||
if (!strncmp(key, QKeyCode_lookup[i], key_length) &&
|
||||
!QKeyCode_lookup[i][key_length]) {
|
||||
if (!strncmp(key, QKeyCode_str(i), key_length) &&
|
||||
!QKeyCode_str(i)[key_length]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
12
ui/input.c
12
ui/input.c
@ -151,7 +151,7 @@ void qmp_input_send_event(bool has_device, const char *device,
|
||||
if (!qemu_input_find_handler(1 << event->type, con)) {
|
||||
error_setg(errp, "Input handler not found for "
|
||||
"event type %s",
|
||||
InputEventKind_lookup[event->type]);
|
||||
InputEventKind_str(event->type));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -213,12 +213,12 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt)
|
||||
switch (key->key->type) {
|
||||
case KEY_VALUE_KIND_NUMBER:
|
||||
qcode = qemu_input_key_number_to_qcode(key->key->u.number.data);
|
||||
name = QKeyCode_lookup[qcode];
|
||||
name = QKeyCode_str(qcode);
|
||||
trace_input_event_key_number(idx, key->key->u.number.data,
|
||||
name, key->down);
|
||||
break;
|
||||
case KEY_VALUE_KIND_QCODE:
|
||||
name = QKeyCode_lookup[key->key->u.qcode.data];
|
||||
name = QKeyCode_str(key->key->u.qcode.data);
|
||||
trace_input_event_key_qcode(idx, name, key->down);
|
||||
break;
|
||||
case KEY_VALUE_KIND__MAX:
|
||||
@ -228,17 +228,17 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt)
|
||||
break;
|
||||
case INPUT_EVENT_KIND_BTN:
|
||||
btn = evt->u.btn.data;
|
||||
name = InputButton_lookup[btn->button];
|
||||
name = InputButton_str(btn->button);
|
||||
trace_input_event_btn(idx, name, btn->down);
|
||||
break;
|
||||
case INPUT_EVENT_KIND_REL:
|
||||
move = evt->u.rel.data;
|
||||
name = InputAxis_lookup[move->axis];
|
||||
name = InputAxis_str(move->axis);
|
||||
trace_input_event_rel(idx, name, move->value);
|
||||
break;
|
||||
case INPUT_EVENT_KIND_ABS:
|
||||
move = evt->u.abs.data;
|
||||
name = InputAxis_lookup[move->axis];
|
||||
name = InputAxis_str(move->axis);
|
||||
trace_input_event_abs(idx, name, move->value);
|
||||
break;
|
||||
case INPUT_EVENT_KIND__MAX:
|
||||
|
6
ui/vnc.c
6
ui/vnc.c
@ -131,7 +131,7 @@ static void vnc_init_basic_info(SocketAddress *addr,
|
||||
case SOCKET_ADDRESS_TYPE_VSOCK:
|
||||
case SOCKET_ADDRESS_TYPE_FD:
|
||||
error_setg(errp, "Unsupported socket address type %s",
|
||||
SocketAddressType_lookup[addr->type]);
|
||||
SocketAddressType_str(addr->type));
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
@ -416,7 +416,7 @@ VncInfo *qmp_query_vnc(Error **errp)
|
||||
case SOCKET_ADDRESS_TYPE_VSOCK:
|
||||
case SOCKET_ADDRESS_TYPE_FD:
|
||||
error_setg(errp, "Unsupported socket address type %s",
|
||||
SocketAddressType_lookup[addr->type]);
|
||||
SocketAddressType_str(addr->type));
|
||||
goto out_error;
|
||||
default:
|
||||
abort();
|
||||
@ -1839,7 +1839,7 @@ static void vnc_release_modifiers(VncState *vs)
|
||||
|
||||
static const char *code2name(int keycode)
|
||||
{
|
||||
return QKeyCode_lookup[qemu_input_key_number_to_qcode(keycode)];
|
||||
return QKeyCode_str(qemu_input_key_number_to_qcode(keycode));
|
||||
}
|
||||
|
||||
static void key_event(VncState *vs, int down, uint32_t sym)
|
||||
|
6
vl.c
6
vl.c
@ -688,7 +688,7 @@ bool runstate_check(RunState state)
|
||||
|
||||
bool runstate_store(char *str, size_t size)
|
||||
{
|
||||
const char *state = RunState_lookup[current_run_state];
|
||||
const char *state = RunState_str(current_run_state);
|
||||
size_t len = strlen(state) + 1;
|
||||
|
||||
if (len > size) {
|
||||
@ -721,8 +721,8 @@ void runstate_set(RunState new_state)
|
||||
|
||||
if (!runstate_valid_transitions[current_run_state][new_state]) {
|
||||
error_report("invalid runstate transition: '%s' -> '%s'",
|
||||
RunState_lookup[current_run_state],
|
||||
RunState_lookup[new_state]);
|
||||
RunState_str(current_run_state),
|
||||
RunState_str(new_state));
|
||||
abort();
|
||||
}
|
||||
trace_runstate_set(new_state);
|
||||
|
Loading…
Reference in New Issue
Block a user