qerror: Clean up QERR_ macros to expand into a single string
These macros expand into error class enumeration constant, comma,
string. Unclean. Has been that way since commit 13f59ae
.
The error class is always ERROR_CLASS_GENERIC_ERROR since the previous
commit.
Clean up as follows:
* Prepend every use of a QERR_ macro by ERROR_CLASS_GENERIC_ERROR, and
delete it from the QERR_ macro. No change after preprocessing.
* Rewrite error_set(ERROR_CLASS_GENERIC_ERROR, ...) into
error_setg(...). Again, no change after preprocessing.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
75158ebbe2
commit
c6bd8c706a
@ -140,7 +140,7 @@ static void rng_egd_opened(RngBackend *b, Error **errp)
|
||||
RngEgd *s = RNG_EGD(b);
|
||||
|
||||
if (s->chr_name == NULL) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"chardev", "a valid character device");
|
||||
return;
|
||||
}
|
||||
@ -153,7 +153,7 @@ static void rng_egd_opened(RngBackend *b, Error **errp)
|
||||
}
|
||||
|
||||
if (qemu_chr_fe_claim(s->chr) != 0) {
|
||||
error_set(errp, QERR_DEVICE_IN_USE, s->chr_name);
|
||||
error_setg(errp, QERR_DEVICE_IN_USE, s->chr_name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ static void rng_egd_set_chardev(Object *obj, const char *value, Error **errp)
|
||||
RngEgd *s = RNG_EGD(b);
|
||||
|
||||
if (b->opened) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
} else {
|
||||
g_free(s->chr_name);
|
||||
s->chr_name = g_strdup(value);
|
||||
|
@ -74,7 +74,7 @@ static void rng_random_opened(RngBackend *b, Error **errp)
|
||||
RndRandom *s = RNG_RANDOM(b);
|
||||
|
||||
if (s->filename == NULL) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"filename", "a valid filename");
|
||||
} else {
|
||||
s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK);
|
||||
@ -98,7 +98,7 @@ static void rng_random_set_filename(Object *obj, const char *filename,
|
||||
RndRandom *s = RNG_RANDOM(obj);
|
||||
|
||||
if (b->opened) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ static void rng_backend_prop_set_opened(Object *obj, bool value, Error **errp)
|
||||
}
|
||||
|
||||
if (!value && s->opened) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ static void tpm_backend_prop_set_opened(Object *obj, bool value, Error **errp)
|
||||
}
|
||||
|
||||
if (!value && s->opened) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ void qmp_balloon(int64_t target, Error **errp)
|
||||
}
|
||||
|
||||
if (target <= 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "target", "a size");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "target", "a size");
|
||||
return;
|
||||
}
|
||||
|
||||
|
2
block.c
2
block.c
@ -2698,7 +2698,7 @@ void bdrv_add_key(BlockDriverState *bs, const char *key, Error **errp)
|
||||
error_setg(errp, "Node '%s' is not encrypted",
|
||||
bdrv_get_device_or_node_name(bs));
|
||||
} else if (bdrv_set_key(bs, key) < 0) {
|
||||
error_set(errp, QERR_INVALID_PASSWORD);
|
||||
error_setg(errp, QERR_INVALID_PASSWORD);
|
||||
}
|
||||
} else {
|
||||
if (bdrv_key_required(bs)) {
|
||||
|
@ -197,7 +197,7 @@ static void backup_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
BackupBlockJob *s = container_of(job, BackupBlockJob, common);
|
||||
|
||||
if (speed < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
return;
|
||||
}
|
||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||
@ -472,7 +472,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
|
||||
if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
|
||||
on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
||||
!bdrv_iostatus_is_enabled(bs)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ static void commit_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
CommitBlockJob *s = container_of(job, CommitBlockJob, common);
|
||||
|
||||
if (speed < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
return;
|
||||
}
|
||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||
|
@ -573,7 +573,7 @@ static void mirror_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
MirrorBlockJob *s = container_of(job, MirrorBlockJob, common);
|
||||
|
||||
if (speed < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
return;
|
||||
}
|
||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||
@ -598,7 +598,7 @@ static void mirror_complete(BlockJob *job, Error **errp)
|
||||
return;
|
||||
}
|
||||
if (!s->synced) {
|
||||
error_set(errp, QERR_BLOCK_JOB_NOT_READY,
|
||||
error_setg(errp, QERR_BLOCK_JOB_NOT_READY,
|
||||
bdrv_get_device_name(job->bs));
|
||||
return;
|
||||
}
|
||||
@ -667,7 +667,7 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,
|
||||
if ((on_source_error == BLOCKDEV_ON_ERROR_STOP ||
|
||||
on_source_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
||||
!bdrv_iostatus_is_enabled(bs)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "on-source-error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
char version[64];
|
||||
snprintf(version, sizeof(version), "QCOW version %" PRIu32,
|
||||
header.version);
|
||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "qcow", version);
|
||||
ret = -ENOTSUP;
|
||||
goto fail;
|
||||
|
@ -207,7 +207,7 @@ static void GCC_FMT_ATTR(3, 4) report_unsupported(BlockDriverState *bs,
|
||||
vsnprintf(msg, sizeof(msg), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "qcow2", msg);
|
||||
}
|
||||
|
||||
|
@ -407,7 +407,7 @@ static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "%" PRIx64,
|
||||
s->header.features & ~QED_FEATURE_MASK);
|
||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "QED", buf);
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
@ -800,7 +800,7 @@ static int quorum_valid_threshold(int threshold, int num_children, Error **errp)
|
||||
{
|
||||
|
||||
if (threshold < 1) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"vote-threshold", "value >= 1");
|
||||
return -ERANGE;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ int bdrv_snapshot_delete(BlockDriverState *bs,
|
||||
{
|
||||
BlockDriver *drv = bs->drv;
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
if (!snapshot_id && !name) {
|
||||
@ -315,7 +315,7 @@ int bdrv_snapshot_load_tmp(BlockDriverState *bs,
|
||||
BlockDriver *drv = bs->drv;
|
||||
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, bdrv_get_device_name(bs));
|
||||
return -ENOMEDIUM;
|
||||
}
|
||||
if (!snapshot_id && !name) {
|
||||
|
@ -227,7 +227,7 @@ static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
StreamBlockJob *s = container_of(job, StreamBlockJob, common);
|
||||
|
||||
if (speed < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "speed");
|
||||
return;
|
||||
}
|
||||
ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME);
|
||||
@ -250,7 +250,7 @@ void stream_start(BlockDriverState *bs, BlockDriverState *base,
|
||||
if ((on_error == BLOCKDEV_ON_ERROR_STOP ||
|
||||
on_error == BLOCKDEV_ON_ERROR_ENOSPC) &&
|
||||
!bdrv_iostatus_is_enabled(bs)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "on-error");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "on-error");
|
||||
return;
|
||||
}
|
||||
|
||||
|
10
block/vmdk.c
10
block/vmdk.c
@ -645,7 +645,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "VMDK version %" PRId32,
|
||||
le32_to_cpu(header.version));
|
||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
error_setg(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bdrv_get_device_or_node_name(bs), "vmdk", buf);
|
||||
return -ENOTSUP;
|
||||
} else if (le32_to_cpu(header.version) == 3 && (flags & BDRV_O_RDWR)) {
|
||||
@ -1688,12 +1688,12 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
||||
/* write all the data */
|
||||
ret = bdrv_pwrite(bs, 0, &magic, sizeof(magic));
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
ret = bdrv_pwrite(bs, sizeof(magic), &header, sizeof(header));
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@ -1713,7 +1713,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
||||
ret = bdrv_pwrite(bs, le64_to_cpu(header.rgd_offset) * BDRV_SECTOR_SIZE,
|
||||
gd_buf, gd_buf_size);
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@ -1725,7 +1725,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
||||
ret = bdrv_pwrite(bs, le64_to_cpu(header.gd_offset) * BDRV_SECTOR_SIZE,
|
||||
gd_buf, gd_buf_size);
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable,
|
||||
return;
|
||||
}
|
||||
if (!blk_is_inserted(blk)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
return;
|
||||
}
|
||||
|
||||
|
41
blockdev.c
41
blockdev.c
@ -1312,7 +1312,7 @@ static void internal_snapshot_prepare(BlkTransactionState *common,
|
||||
aio_context_acquire(state->aio_context);
|
||||
|
||||
if (!bdrv_is_inserted(bs)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1453,7 +1453,7 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
||||
/* start processing */
|
||||
drv = bdrv_find_format(format);
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1480,7 +1480,7 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
||||
aio_context_acquire(state->aio_context);
|
||||
|
||||
if (!bdrv_is_inserted(state->old_bs)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1491,13 +1491,13 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
||||
|
||||
if (!bdrv_is_read_only(state->old_bs)) {
|
||||
if (bdrv_flush(state->old_bs)) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bdrv_is_first_non_filter(state->old_bs)) {
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "snapshot");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "snapshot");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1926,7 +1926,7 @@ void qmp_change_blockdev(const char *device, const char *filename,
|
||||
if (format) {
|
||||
drv = bdrv_find_whitelisted_format(format, bs->read_only);
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -2208,17 +2208,17 @@ void qmp_block_resize(bool has_device, const char *device,
|
||||
aio_context_acquire(aio_context);
|
||||
|
||||
if (!bdrv_is_first_non_filter(bs)) {
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "resize");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "resize");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (size < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "size", "a >0 size");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_RESIZE, NULL)) {
|
||||
error_set(errp, QERR_DEVICE_IN_USE, device);
|
||||
error_setg(errp, QERR_DEVICE_IN_USE, device);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2230,16 +2230,16 @@ void qmp_block_resize(bool has_device, const char *device,
|
||||
case 0:
|
||||
break;
|
||||
case -ENOMEDIUM:
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
break;
|
||||
case -ENOTSUP:
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
break;
|
||||
case -EACCES:
|
||||
error_setg(errp, "Device '%s' is read only", device);
|
||||
break;
|
||||
case -EBUSY:
|
||||
error_set(errp, QERR_DEVICE_IN_USE, device);
|
||||
error_setg(errp, QERR_DEVICE_IN_USE, device);
|
||||
break;
|
||||
default:
|
||||
error_setg_errno(errp, -ret, "Could not resize");
|
||||
@ -2313,7 +2313,7 @@ void qmp_block_stream(const char *device,
|
||||
if (has_base) {
|
||||
base_bs = bdrv_find_backing_image(bs, base);
|
||||
if (base_bs == NULL) {
|
||||
error_set(errp, QERR_BASE_NOT_FOUND, base);
|
||||
error_setg(errp, QERR_BASE_NOT_FOUND, base);
|
||||
goto out;
|
||||
}
|
||||
assert(bdrv_get_aio_context(base_bs) == aio_context);
|
||||
@ -2411,7 +2411,7 @@ void qmp_block_commit(const char *device,
|
||||
}
|
||||
|
||||
if (base_bs == NULL) {
|
||||
error_set(errp, QERR_BASE_NOT_FOUND, base ? base : "NULL");
|
||||
error_setg(errp, QERR_BASE_NOT_FOUND, base ? base : "NULL");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2497,7 +2497,7 @@ void qmp_drive_backup(const char *device, const char *target,
|
||||
/* Although backup_run has this check too, we need to use bs->drv below, so
|
||||
* do an early check redundantly. */
|
||||
if (!bdrv_is_inserted(bs)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2507,7 +2507,7 @@ void qmp_drive_backup(const char *device, const char *target,
|
||||
if (format) {
|
||||
drv = bdrv_find_format(format);
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@ -2689,12 +2689,13 @@ void qmp_drive_mirror(const char *device, const char *target,
|
||||
}
|
||||
|
||||
if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
|
||||
"a value in range [512B, 64MB]");
|
||||
return;
|
||||
}
|
||||
if (granularity & (granularity - 1)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "granularity", "power of 2");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "granularity",
|
||||
"power of 2");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2710,7 +2711,7 @@ void qmp_drive_mirror(const char *device, const char *target,
|
||||
aio_context_acquire(aio_context);
|
||||
|
||||
if (!bdrv_is_inserted(bs)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -2720,7 +2721,7 @@ void qmp_drive_mirror(const char *device, const char *target,
|
||||
if (format) {
|
||||
drv = bdrv_find_format(format);
|
||||
if (!drv) {
|
||||
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
error_setg(errp, QERR_INVALID_BLOCK_FORMAT, format);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs,
|
||||
BlockJob *job;
|
||||
|
||||
if (bs->job) {
|
||||
error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
|
||||
error_setg(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs));
|
||||
return NULL;
|
||||
}
|
||||
bdrv_ref(bs);
|
||||
@ -93,7 +93,7 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (!job->driver->set_speed) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return;
|
||||
}
|
||||
job->driver->set_speed(job, speed, &local_err);
|
||||
@ -108,7 +108,7 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
void block_job_complete(BlockJob *job, Error **errp)
|
||||
{
|
||||
if (job->pause_count || job->cancelled || !job->driver->complete) {
|
||||
error_set(errp, QERR_BLOCK_JOB_NOT_READY,
|
||||
error_setg(errp, QERR_BLOCK_JOB_NOT_READY,
|
||||
bdrv_get_device_name(job->bs));
|
||||
return;
|
||||
}
|
||||
|
6
cpus.c
6
cpus.c
@ -1512,7 +1512,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
|
||||
|
||||
cpu = qemu_get_cpu(cpu_index);
|
||||
if (cpu == NULL) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
|
||||
"a CPU number");
|
||||
return;
|
||||
}
|
||||
@ -1533,7 +1533,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename,
|
||||
goto exit;
|
||||
}
|
||||
if (fwrite(buf, 1, l, f) != l) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
addr += l;
|
||||
@ -1563,7 +1563,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename,
|
||||
l = size;
|
||||
cpu_physical_memory_read(addr, buf, l);
|
||||
if (fwrite(buf, 1, l, f) != l) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
goto exit;
|
||||
}
|
||||
addr += l;
|
||||
|
12
dump.c
12
dump.c
@ -1474,7 +1474,7 @@ static void dump_init(DumpState *s, int fd, bool has_format,
|
||||
|
||||
s->start = get_start_block(s);
|
||||
if (s->start == -1) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "begin");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "begin");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1484,14 +1484,14 @@ static void dump_init(DumpState *s, int fd, bool has_format,
|
||||
*/
|
||||
ret = cpu_get_dump_info(&s->dump_info, &s->guest_phys_blocks);
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
s->note_size = cpu_get_note_size(s->dump_info.d_class,
|
||||
s->dump_info.d_machine, nr_cpus);
|
||||
if (s->note_size < 0) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1615,11 +1615,11 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
||||
return;
|
||||
}
|
||||
if (has_begin && !has_length) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, "length");
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, "length");
|
||||
return;
|
||||
}
|
||||
if (!has_begin && has_length) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, "begin");
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, "begin");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1656,7 +1656,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin,
|
||||
}
|
||||
|
||||
if (fd == -1) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "protocol");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "protocol");
|
||||
return;
|
||||
}
|
||||
|
||||
|
10
hmp.c
10
hmp.c
@ -1045,7 +1045,7 @@ void hmp_drive_mirror(Monitor *mon, const QDict *qdict)
|
||||
Error *err = NULL;
|
||||
|
||||
if (!filename) {
|
||||
error_set(&err, QERR_MISSING_PARAMETER, "target");
|
||||
error_setg(&err, QERR_MISSING_PARAMETER, "target");
|
||||
hmp_handle_error(mon, &err);
|
||||
return;
|
||||
}
|
||||
@ -1075,7 +1075,7 @@ void hmp_drive_backup(Monitor *mon, const QDict *qdict)
|
||||
Error *err = NULL;
|
||||
|
||||
if (!filename) {
|
||||
error_set(&err, QERR_MISSING_PARAMETER, "target");
|
||||
error_setg(&err, QERR_MISSING_PARAMETER, "target");
|
||||
hmp_handle_error(mon, &err);
|
||||
return;
|
||||
}
|
||||
@ -1105,7 +1105,7 @@ void hmp_snapshot_blkdev(Monitor *mon, const QDict *qdict)
|
||||
if (!filename) {
|
||||
/* In the future, if 'snapshot-file' is not specified, the snapshot
|
||||
will be taken internally. Today it's actually required. */
|
||||
error_set(&err, QERR_MISSING_PARAMETER, "snapshot-file");
|
||||
error_setg(&err, QERR_MISSING_PARAMETER, "snapshot-file");
|
||||
hmp_handle_error(mon, &err);
|
||||
return;
|
||||
}
|
||||
@ -1200,7 +1200,7 @@ void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict)
|
||||
}
|
||||
|
||||
if (i == MIGRATION_CAPABILITY_MAX) {
|
||||
error_set(&err, QERR_INVALID_PARAMETER, cap);
|
||||
error_setg(&err, QERR_INVALID_PARAMETER, cap);
|
||||
}
|
||||
|
||||
qapi_free_MigrationCapabilityStatusList(caps);
|
||||
@ -1244,7 +1244,7 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
|
||||
}
|
||||
|
||||
if (i == MIGRATION_PARAMETER_MAX) {
|
||||
error_set(&err, QERR_INVALID_PARAMETER, param);
|
||||
error_setg(&err, QERR_INVALID_PARAMETER, param);
|
||||
}
|
||||
|
||||
if (err) {
|
||||
|
@ -67,7 +67,7 @@ void nmi_monitor_handle(int cpu_index, Error **errp)
|
||||
if (ns.handled) {
|
||||
error_propagate(errp, ns.errp);
|
||||
} else {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
|
||||
|
||||
hubport = net_hub_port_find(id);
|
||||
if (!hubport) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name, prop->info->name);
|
||||
return;
|
||||
}
|
||||
|
@ -570,8 +570,8 @@ static void set_pci_devfn(Object *obj, Visitor *v, void *opaque,
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
} else if (value < -1 || value > 255) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
|
||||
"pci_devfn");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name ? name : "null", "pci_devfn");
|
||||
} else {
|
||||
*ptr = value;
|
||||
}
|
||||
@ -640,8 +640,8 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque,
|
||||
}
|
||||
/* value of 0 means "unset" */
|
||||
if (value && (value < min || value > max)) {
|
||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||
dev->id?:"", name, (int64_t)value, min, max);
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||
dev->id ? : "", name, (int64_t)value, min, max);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -923,7 +923,7 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
|
||||
break;
|
||||
default:
|
||||
case -EINVAL:
|
||||
error_set(errp, QERR_PROPERTY_VALUE_BAD,
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_BAD,
|
||||
object_get_typename(OBJECT(dev)), prop->name, value);
|
||||
break;
|
||||
case -ENOENT:
|
||||
|
@ -276,12 +276,12 @@ void qdev_unplug(DeviceState *dev, Error **errp)
|
||||
HotplugHandlerClass *hdc;
|
||||
|
||||
if (dev->parent_bus && !qbus_is_hotpluggable(dev->parent_bus)) {
|
||||
error_set(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
|
||||
error_setg(errp, QERR_BUS_NO_HOTPLUG, dev->parent_bus->name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dc->hotpluggable) {
|
||||
error_set(errp, QERR_DEVICE_NO_HOTPLUG,
|
||||
error_setg(errp, QERR_DEVICE_NO_HOTPLUG,
|
||||
object_get_typename(OBJECT(dev)));
|
||||
return;
|
||||
}
|
||||
@ -1026,7 +1026,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (dev->hotplugged && !dc->hotpluggable) {
|
||||
error_set(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
|
||||
error_setg(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1556,7 +1556,7 @@ static void openpic_realize(DeviceState *dev, Error **errp)
|
||||
};
|
||||
|
||||
if (opp->nb_cpus > MAX_CPU) {
|
||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||
TYPE_OPENPIC, "nb_cpus", (uint64_t)opp->nb_cpus,
|
||||
(uint64_t)0, (uint64_t)MAX_CPU);
|
||||
return;
|
||||
|
@ -21,13 +21,13 @@
|
||||
|
||||
RockerSwitch *qmp_query_rocker(const char *name, Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
return NULL;
|
||||
};
|
||||
|
||||
RockerPortList *qmp_query_rocker_ports(const char *name, Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
return NULL;
|
||||
};
|
||||
|
||||
@ -36,7 +36,7 @@ RockerOfDpaFlowList *qmp_query_rocker_of_dpa_flows(const char *name,
|
||||
uint32_t tbl_id,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
return NULL;
|
||||
};
|
||||
|
||||
@ -45,6 +45,6 @@ RockerOfDpaGroupList *qmp_query_rocker_of_dpa_groups(const char *name,
|
||||
uint8_t type,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "rocker");
|
||||
return NULL;
|
||||
};
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
PciInfoList *qmp_query_pci(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1062,7 @@ static void spapr_phb_hot_plug_child(HotplugHandler *plug_handler,
|
||||
* we need to let them know it's not enabled
|
||||
*/
|
||||
if (plugged_dev->hotplugged) {
|
||||
error_set(errp, QERR_BUS_NO_HOTPLUG,
|
||||
error_setg(errp, QERR_BUS_NO_HOTPLUG,
|
||||
object_get_typename(OBJECT(phb)));
|
||||
}
|
||||
return;
|
||||
@ -1090,7 +1090,7 @@ static void spapr_phb_hot_unplug_child(HotplugHandler *plug_handler,
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (!phb->dr_enabled) {
|
||||
error_set(errp, QERR_BUS_NO_HOTPLUG,
|
||||
error_setg(errp, QERR_BUS_NO_HOTPLUG,
|
||||
object_get_typename(OBJECT(phb)));
|
||||
return;
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ void s390_nmi(NMIState *n, int cpu_index, Error **errp)
|
||||
CPUState *cs = qemu_get_cpu(cpu_index);
|
||||
|
||||
if (s390_cpu_restart(S390_CPU(cs))) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1369,7 +1369,7 @@ static void usbredir_realize(USBDevice *udev, Error **errp)
|
||||
int i;
|
||||
|
||||
if (dev->cs == NULL) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, "chardev");
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, "chardev");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1378,7 +1378,7 @@ static void usbredir_realize(USBDevice *udev, Error **errp)
|
||||
&dev->filter_rules,
|
||||
&dev->filter_rules_count);
|
||||
if (i) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "filter",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "filter",
|
||||
"a usb device filter string");
|
||||
return;
|
||||
}
|
||||
|
@ -35,93 +35,93 @@ void qerror_report_err(Error *err);
|
||||
* Use scripts/check-qerror.sh to check.
|
||||
*/
|
||||
#define QERR_BASE_NOT_FOUND \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Base '%s' not found"
|
||||
"Base '%s' not found"
|
||||
|
||||
#define QERR_BLOCK_JOB_NOT_READY \
|
||||
ERROR_CLASS_GENERIC_ERROR, "The active block job for device '%s' cannot be completed"
|
||||
"The active block job for device '%s' cannot be completed"
|
||||
|
||||
#define QERR_BUS_NO_HOTPLUG \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Bus '%s' does not support hotplugging"
|
||||
"Bus '%s' does not support hotplugging"
|
||||
|
||||
#define QERR_DEVICE_HAS_NO_MEDIUM \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Device '%s' has no medium"
|
||||
"Device '%s' has no medium"
|
||||
|
||||
#define QERR_DEVICE_INIT_FAILED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Device '%s' could not be initialized"
|
||||
"Device '%s' could not be initialized"
|
||||
|
||||
#define QERR_DEVICE_IN_USE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Device '%s' is in use"
|
||||
"Device '%s' is in use"
|
||||
|
||||
#define QERR_DEVICE_NO_HOTPLUG \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging"
|
||||
"Device '%s' does not support hotplugging"
|
||||
|
||||
#define QERR_FD_NOT_FOUND \
|
||||
ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found"
|
||||
"File descriptor named '%s' not found"
|
||||
|
||||
#define QERR_FD_NOT_SUPPLIED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "No file descriptor supplied via SCM_RIGHTS"
|
||||
"No file descriptor supplied via SCM_RIGHTS"
|
||||
|
||||
#define QERR_FEATURE_DISABLED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "The feature '%s' is not enabled"
|
||||
"The feature '%s' is not enabled"
|
||||
|
||||
#define QERR_INVALID_BLOCK_FORMAT \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Invalid block format '%s'"
|
||||
"Invalid block format '%s'"
|
||||
|
||||
#define QERR_INVALID_PARAMETER \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Invalid parameter '%s'"
|
||||
"Invalid parameter '%s'"
|
||||
|
||||
#define QERR_INVALID_PARAMETER_TYPE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Invalid parameter type for '%s', expected: %s"
|
||||
"Invalid parameter type for '%s', expected: %s"
|
||||
|
||||
#define QERR_INVALID_PARAMETER_VALUE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' expects %s"
|
||||
"Parameter '%s' expects %s"
|
||||
|
||||
#define QERR_INVALID_PASSWORD \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Password incorrect"
|
||||
"Password incorrect"
|
||||
|
||||
#define QERR_IO_ERROR \
|
||||
ERROR_CLASS_GENERIC_ERROR, "An IO error has occurred"
|
||||
"An IO error has occurred"
|
||||
|
||||
#define QERR_JSON_PARSING \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Invalid JSON syntax"
|
||||
"Invalid JSON syntax"
|
||||
|
||||
#define QERR_MIGRATION_ACTIVE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "There's a migration process in progress"
|
||||
"There's a migration process in progress"
|
||||
|
||||
#define QERR_MISSING_PARAMETER \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Parameter '%s' is missing"
|
||||
"Parameter '%s' is missing"
|
||||
|
||||
#define QERR_PERMISSION_DENIED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Insufficient permission to perform this operation"
|
||||
"Insufficient permission to perform this operation"
|
||||
|
||||
#define QERR_PROPERTY_VALUE_BAD \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Property '%s.%s' doesn't take value '%s'"
|
||||
"Property '%s.%s' doesn't take value '%s'"
|
||||
|
||||
#define QERR_PROPERTY_VALUE_OUT_OF_RANGE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
|
||||
"Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")"
|
||||
|
||||
#define QERR_QGA_COMMAND_FAILED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Guest agent command failed, error was '%s'"
|
||||
"Guest agent command failed, error was '%s'"
|
||||
|
||||
#define QERR_QMP_BAD_INPUT_OBJECT \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Expected '%s' in QMP input"
|
||||
"Expected '%s' in QMP input"
|
||||
|
||||
#define QERR_QMP_BAD_INPUT_OBJECT_MEMBER \
|
||||
ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' expects '%s'"
|
||||
"QMP input object member '%s' expects '%s'"
|
||||
|
||||
#define QERR_QMP_EXTRA_MEMBER \
|
||||
ERROR_CLASS_GENERIC_ERROR, "QMP input object member '%s' is unexpected"
|
||||
"QMP input object member '%s' is unexpected"
|
||||
|
||||
#define QERR_SET_PASSWD_FAILED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "Could not set password"
|
||||
"Could not set password"
|
||||
|
||||
#define QERR_UNDEFINED_ERROR \
|
||||
ERROR_CLASS_GENERIC_ERROR, "An undefined error has occurred"
|
||||
"An undefined error has occurred"
|
||||
|
||||
#define QERR_UNKNOWN_BLOCK_FORMAT_FEATURE \
|
||||
ERROR_CLASS_GENERIC_ERROR, "'%s' uses a %s feature which is not supported by this qemu version: %s"
|
||||
"'%s' uses a %s feature which is not supported by this qemu version: %s"
|
||||
|
||||
#define QERR_UNSUPPORTED \
|
||||
ERROR_CLASS_GENERIC_ERROR, "this feature or command is not currently supported"
|
||||
"this feature or command is not currently supported"
|
||||
|
||||
#endif /* QERROR_H */
|
||||
|
@ -337,7 +337,7 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
|
||||
|
||||
if (s->state == MIGRATION_STATUS_ACTIVE ||
|
||||
s->state == MIGRATION_STATUS_SETUP) {
|
||||
error_set(errp, QERR_MIGRATION_ACTIVE);
|
||||
error_setg(errp, QERR_MIGRATION_ACTIVE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -356,20 +356,20 @@ void qmp_migrate_set_parameters(bool has_compress_level,
|
||||
MigrationState *s = migrate_get_current();
|
||||
|
||||
if (has_compress_level && (compress_level < 0 || compress_level > 9)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level",
|
||||
"is invalid, it should be in the range of 0 to 9");
|
||||
return;
|
||||
}
|
||||
if (has_compress_threads &&
|
||||
(compress_threads < 1 || compress_threads > 255)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"compress_threads",
|
||||
"is invalid, it should be in the range of 1 to 255");
|
||||
return;
|
||||
}
|
||||
if (has_decompress_threads &&
|
||||
(decompress_threads < 1 || decompress_threads > 255)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"decompress_threads",
|
||||
"is invalid, it should be in the range of 1 to 255");
|
||||
return;
|
||||
@ -573,7 +573,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
|
||||
if (s->state == MIGRATION_STATUS_ACTIVE ||
|
||||
s->state == MIGRATION_STATUS_SETUP ||
|
||||
s->state == MIGRATION_STATUS_CANCELLING) {
|
||||
error_set(errp, QERR_MIGRATION_ACTIVE);
|
||||
error_setg(errp, QERR_MIGRATION_ACTIVE);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -608,7 +608,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
|
||||
fd_start_outgoing_migration(s, p, &local_err);
|
||||
#endif
|
||||
} else {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri",
|
||||
"a valid migration protocol");
|
||||
s->state = MIGRATION_STATUS_FAILED;
|
||||
return;
|
||||
}
|
||||
@ -632,21 +633,21 @@ void qmp_migrate_set_cache_size(int64_t value, Error **errp)
|
||||
|
||||
/* Check for truncation */
|
||||
if (value != (size_t)value) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
"exceeding address space");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Cache should not be larger than guest ram size */
|
||||
if (value > ram_bytes_total()) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
"exceeds guest ram size ");
|
||||
return;
|
||||
}
|
||||
|
||||
new_size = xbzrle_cache_resize(value);
|
||||
if (new_size < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cache size",
|
||||
"is smaller than page size");
|
||||
return;
|
||||
}
|
||||
|
@ -1307,7 +1307,7 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp)
|
||||
ret = qemu_save_device_state(f);
|
||||
qemu_fclose(f);
|
||||
if (ret < 0) {
|
||||
error_set(errp, QERR_IO_ERROR);
|
||||
error_setg(errp, QERR_IO_ERROR);
|
||||
}
|
||||
|
||||
the_end:
|
||||
|
48
monitor.c
48
monitor.c
@ -603,7 +603,7 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index,
|
||||
int ret = monitor_set_cpu(cpu_index);
|
||||
if (ret < 0) {
|
||||
cur_mon = old_mon;
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
|
||||
"a CPU number");
|
||||
goto out;
|
||||
}
|
||||
@ -1021,7 +1021,7 @@ void qmp_client_migrate_info(const char *protocol, const char *hostname,
|
||||
}
|
||||
|
||||
if (!has_port && !has_tls_port) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, "port/tls-port");
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, "port/tls-port");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1029,13 +1029,13 @@ void qmp_client_migrate_info(const char *protocol, const char *hostname,
|
||||
has_port ? port : -1,
|
||||
has_tls_port ? tls_port : -1,
|
||||
cert_subject)) {
|
||||
error_set(errp, QERR_UNDEFINED_ERROR);
|
||||
error_setg(errp, QERR_UNDEFINED_ERROR);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "spice");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "spice");
|
||||
}
|
||||
|
||||
static void hmp_logfile(Monitor *mon, const QDict *qdict)
|
||||
@ -2100,13 +2100,13 @@ void qmp_getfd(const char *fdname, Error **errp)
|
||||
|
||||
fd = qemu_chr_fe_get_msgfd(cur_mon->chr);
|
||||
if (fd == -1) {
|
||||
error_set(errp, QERR_FD_NOT_SUPPLIED);
|
||||
error_setg(errp, QERR_FD_NOT_SUPPLIED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (qemu_isdigit(fdname[0])) {
|
||||
close(fd);
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdname",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "fdname",
|
||||
"a name not starting with a digit");
|
||||
return;
|
||||
}
|
||||
@ -2144,7 +2144,7 @@ void qmp_closefd(const char *fdname, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
error_set(errp, QERR_FD_NOT_FOUND, fdname);
|
||||
error_setg(errp, QERR_FD_NOT_FOUND, fdname);
|
||||
}
|
||||
|
||||
static void hmp_loadvm(Monitor *mon, const QDict *qdict)
|
||||
@ -2225,7 +2225,7 @@ AddfdInfo *qmp_add_fd(bool has_fdset_id, int64_t fdset_id, bool has_opaque,
|
||||
|
||||
fd = qemu_chr_fe_get_msgfd(mon->chr);
|
||||
if (fd == -1) {
|
||||
error_set(errp, QERR_FD_NOT_SUPPLIED);
|
||||
error_setg(errp, QERR_FD_NOT_SUPPLIED);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -2277,7 +2277,7 @@ error:
|
||||
} else {
|
||||
snprintf(fd_str, sizeof(fd_str), "fdset-id:%" PRId64, fdset_id);
|
||||
}
|
||||
error_set(errp, QERR_FD_NOT_FOUND, fd_str);
|
||||
error_setg(errp, QERR_FD_NOT_FOUND, fd_str);
|
||||
}
|
||||
|
||||
FdsetInfoList *qmp_query_fdsets(Error **errp)
|
||||
@ -2345,7 +2345,7 @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
|
||||
|
||||
if (has_fdset_id) {
|
||||
if (fdset_id < 0) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "fdset-id",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "fdset-id",
|
||||
"a non-negative value");
|
||||
return NULL;
|
||||
}
|
||||
@ -4771,7 +4771,7 @@ static void check_client_args_type(const QDict *client_args,
|
||||
continue;
|
||||
}
|
||||
/* client arg doesn't exist */
|
||||
error_set(errp, QERR_INVALID_PARAMETER, client_arg_name);
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, client_arg_name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4784,7 +4784,7 @@ static void check_client_args_type(const QDict *client_args,
|
||||
case 'B':
|
||||
case 's':
|
||||
if (qobject_type(client_arg) != QTYPE_QSTRING) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE,
|
||||
client_arg_name, "string");
|
||||
return;
|
||||
}
|
||||
@ -4794,7 +4794,7 @@ static void check_client_args_type(const QDict *client_args,
|
||||
case 'M':
|
||||
case 'o':
|
||||
if (qobject_type(client_arg) != QTYPE_QINT) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE,
|
||||
client_arg_name, "int");
|
||||
return;
|
||||
}
|
||||
@ -4802,7 +4802,7 @@ static void check_client_args_type(const QDict *client_args,
|
||||
case 'T':
|
||||
if (qobject_type(client_arg) != QTYPE_QINT &&
|
||||
qobject_type(client_arg) != QTYPE_QFLOAT) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE,
|
||||
client_arg_name, "number");
|
||||
return;
|
||||
}
|
||||
@ -4810,7 +4810,7 @@ static void check_client_args_type(const QDict *client_args,
|
||||
case 'b':
|
||||
case '-':
|
||||
if (qobject_type(client_arg) != QTYPE_QBOOL) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE,
|
||||
client_arg_name, "bool");
|
||||
return;
|
||||
}
|
||||
@ -4854,7 +4854,7 @@ static void check_mandatory_args(const QDict *cmd_args,
|
||||
} else if (qstring_get_str(type)[0] != '-' &&
|
||||
qstring_get_str(type)[1] != '?' &&
|
||||
!qdict_haskey(client_args, cmd_arg_name)) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, cmd_arg_name);
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, cmd_arg_name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -4952,7 +4952,7 @@ static QDict *qmp_check_input_obj(QObject *input_obj, Error **errp)
|
||||
QDict *input_dict;
|
||||
|
||||
if (qobject_type(input_obj) != QTYPE_QDICT) {
|
||||
error_set(errp, QERR_QMP_BAD_INPUT_OBJECT, "object");
|
||||
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT, "object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -4964,27 +4964,27 @@ static QDict *qmp_check_input_obj(QObject *input_obj, Error **errp)
|
||||
|
||||
if (!strcmp(arg_name, "execute")) {
|
||||
if (qobject_type(arg_obj) != QTYPE_QSTRING) {
|
||||
error_set(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
|
||||
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
|
||||
"execute", "string");
|
||||
return NULL;
|
||||
}
|
||||
has_exec_key = 1;
|
||||
} else if (!strcmp(arg_name, "arguments")) {
|
||||
if (qobject_type(arg_obj) != QTYPE_QDICT) {
|
||||
error_set(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
|
||||
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER,
|
||||
"arguments", "object");
|
||||
return NULL;
|
||||
}
|
||||
} else if (!strcmp(arg_name, "id")) {
|
||||
/* Any string is acceptable as "id", so nothing to check */
|
||||
} else {
|
||||
error_set(errp, QERR_QMP_EXTRA_MEMBER, arg_name);
|
||||
error_setg(errp, QERR_QMP_EXTRA_MEMBER, arg_name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_exec_key) {
|
||||
error_set(errp, QERR_QMP_BAD_INPUT_OBJECT, "execute");
|
||||
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT, "execute");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -5006,7 +5006,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
|
||||
obj = json_parser_parse(tokens, NULL);
|
||||
if (!obj) {
|
||||
// FIXME: should be triggered in json_parser_parse()
|
||||
error_set(&local_err, QERR_JSON_PARSING);
|
||||
error_setg(&local_err, QERR_JSON_PARSING);
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
@ -5048,7 +5048,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
|
||||
/* Command failed... */
|
||||
if (!mon->error) {
|
||||
/* ... without setting an error, so make one up */
|
||||
error_set(&local_err, QERR_UNDEFINED_ERROR);
|
||||
error_setg(&local_err, QERR_UNDEFINED_ERROR);
|
||||
}
|
||||
}
|
||||
if (mon->error) {
|
||||
@ -5382,6 +5382,6 @@ QemuOptsList qemu_mon_opts = {
|
||||
#ifndef TARGET_I386
|
||||
void qmp_rtc_reset_reinjection(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "rtc-reset-reinjection");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "rtc-reset-reinjection");
|
||||
}
|
||||
#endif
|
||||
|
@ -945,7 +945,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
|
||||
break;
|
||||
|
||||
default:
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "type",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "type",
|
||||
"a netdev backend type");
|
||||
return -1;
|
||||
}
|
||||
@ -953,7 +953,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
|
||||
u.net = object;
|
||||
opts = u.net->opts;
|
||||
if (opts->kind == NET_CLIENT_OPTIONS_KIND_HUBPORT) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "type",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "type",
|
||||
"a net type");
|
||||
return -1;
|
||||
}
|
||||
@ -975,7 +975,7 @@ static int net_client_init1(const void *object, int is_netdev, Error **errp)
|
||||
if (net_client_init_fun[opts->kind](opts, name, peer, errp) < 0) {
|
||||
/* FIXME drop when all init functions store an Error */
|
||||
if (errp && !*errp) {
|
||||
error_set(errp, QERR_DEVICE_INIT_FAILED,
|
||||
error_setg(errp, QERR_DEVICE_INIT_FAILED,
|
||||
NetClientOptionsKind_lookup[opts->kind]);
|
||||
}
|
||||
return -1;
|
||||
|
@ -173,7 +173,7 @@ opts_end_struct(Visitor *v, Error **errp)
|
||||
const QemuOpt *first;
|
||||
|
||||
first = g_queue_peek_head(any);
|
||||
error_set(errp, QERR_INVALID_PARAMETER, first->name);
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, first->name);
|
||||
}
|
||||
g_hash_table_destroy(ov->unprocessed_opts);
|
||||
ov->unprocessed_opts = NULL;
|
||||
@ -193,7 +193,7 @@ lookup_distinct(const OptsVisitor *ov, const char *name, Error **errp)
|
||||
|
||||
list = g_hash_table_lookup(ov->unprocessed_opts, name);
|
||||
if (!list) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, name);
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, name);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -341,7 +341,7 @@ opts_type_bool(Visitor *v, bool *obj, const char *name, Error **errp)
|
||||
strcmp(opt->str, "n") == 0) {
|
||||
*obj = false;
|
||||
} else {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
|
||||
"on|yes|y|off|no|n");
|
||||
return;
|
||||
}
|
||||
@ -403,7 +403,7 @@ opts_type_int(Visitor *v, int64_t *obj, const char *name, Error **errp)
|
||||
}
|
||||
}
|
||||
}
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
|
||||
(ov->list_mode == LM_NONE) ? "an int64 value" :
|
||||
"an int64 value or range");
|
||||
}
|
||||
@ -455,7 +455,7 @@ opts_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp)
|
||||
}
|
||||
}
|
||||
}
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
|
||||
(ov->list_mode == LM_NONE) ? "a uint64 value" :
|
||||
"a uint64 value or range");
|
||||
}
|
||||
@ -477,7 +477,7 @@ opts_type_size(Visitor *v, uint64_t *obj, const char *name, Error **errp)
|
||||
val = strtosz_suffix(opt->str ? opt->str : "", &endptr,
|
||||
STRTOSZ_DEFSUFFIX_B);
|
||||
if (val < 0 || *endptr) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
|
||||
"a size value representible as a non-negative int64");
|
||||
return;
|
||||
}
|
||||
|
@ -110,8 +110,8 @@ void visit_type_uint8(Visitor *v, uint8_t *obj, const char *name, Error **errp)
|
||||
value = *obj;
|
||||
v->type_int(v, &value, name, errp);
|
||||
if (value < 0 || value > UINT8_MAX) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
|
||||
"uint8_t");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name ? name : "null", "uint8_t");
|
||||
return;
|
||||
}
|
||||
*obj = value;
|
||||
@ -128,8 +128,8 @@ void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp
|
||||
value = *obj;
|
||||
v->type_int(v, &value, name, errp);
|
||||
if (value < 0 || value > UINT16_MAX) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
|
||||
"uint16_t");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name ? name : "null", "uint16_t");
|
||||
return;
|
||||
}
|
||||
*obj = value;
|
||||
@ -146,8 +146,8 @@ void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp
|
||||
value = *obj;
|
||||
v->type_int(v, &value, name, errp);
|
||||
if (value < 0 || value > UINT32_MAX) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
|
||||
"uint32_t");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name ? name : "null", "uint32_t");
|
||||
return;
|
||||
}
|
||||
*obj = value;
|
||||
@ -177,8 +177,8 @@ void visit_type_int8(Visitor *v, int8_t *obj, const char *name, Error **errp)
|
||||
value = *obj;
|
||||
v->type_int(v, &value, name, errp);
|
||||
if (value < INT8_MIN || value > INT8_MAX) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
|
||||
"int8_t");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name ? name : "null", "int8_t");
|
||||
return;
|
||||
}
|
||||
*obj = value;
|
||||
@ -195,8 +195,8 @@ void visit_type_int16(Visitor *v, int16_t *obj, const char *name, Error **errp)
|
||||
value = *obj;
|
||||
v->type_int(v, &value, name, errp);
|
||||
if (value < INT16_MIN || value > INT16_MAX) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
|
||||
"int16_t");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name ? name : "null", "int16_t");
|
||||
return;
|
||||
}
|
||||
*obj = value;
|
||||
@ -213,8 +213,8 @@ void visit_type_int32(Visitor *v, int32_t *obj, const char *name, Error **errp)
|
||||
value = *obj;
|
||||
v->type_int(v, &value, name, errp);
|
||||
if (value < INT32_MIN || value > INT32_MAX) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null",
|
||||
"int32_t");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name ? name : "null", "int32_t");
|
||||
return;
|
||||
}
|
||||
*obj = value;
|
||||
@ -271,7 +271,7 @@ void output_type_enum(Visitor *v, int *obj, const char * const strings[],
|
||||
assert(strings);
|
||||
while (strings[i++] != NULL);
|
||||
if (value < 0 || value >= i - 1) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, name ? name : "null");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, name ? name : "null");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ void input_type_enum(Visitor *v, int *obj, const char * const strings[],
|
||||
}
|
||||
|
||||
if (strings[value] == NULL) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, enum_str);
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, enum_str);
|
||||
g_free(enum_str);
|
||||
return;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)
|
||||
QDict *dict = NULL;
|
||||
|
||||
if (qobject_type(request) != QTYPE_QDICT) {
|
||||
error_set(errp, QERR_QMP_BAD_INPUT_OBJECT,
|
||||
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT,
|
||||
"request is not a dictionary");
|
||||
return NULL;
|
||||
}
|
||||
@ -41,19 +41,19 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp)
|
||||
|
||||
if (!strcmp(arg_name, "execute")) {
|
||||
if (qobject_type(arg_obj) != QTYPE_QSTRING) {
|
||||
error_set(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "execute",
|
||||
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "execute",
|
||||
"string");
|
||||
return NULL;
|
||||
}
|
||||
has_exec_key = true;
|
||||
} else if (strcmp(arg_name, "arguments")) {
|
||||
error_set(errp, QERR_QMP_EXTRA_MEMBER, arg_name);
|
||||
error_setg(errp, QERR_QMP_EXTRA_MEMBER, arg_name);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_exec_key) {
|
||||
error_set(errp, QERR_QMP_BAD_INPUT_OBJECT, "execute");
|
||||
error_setg(errp, QERR_QMP_BAD_INPUT_OBJECT, "execute");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ static void qmp_input_pop(QmpInputVisitor *qiv, Error **errp)
|
||||
if (g_hash_table_size(top_ht)) {
|
||||
const char *key;
|
||||
g_hash_table_find(top_ht, always_true, &key);
|
||||
error_set(errp, QERR_QMP_EXTRA_MEMBER, key);
|
||||
error_setg(errp, QERR_QMP_EXTRA_MEMBER, key);
|
||||
}
|
||||
g_hash_table_unref(top_ht);
|
||||
}
|
||||
@ -122,7 +122,7 @@ static void qmp_input_start_struct(Visitor *v, void **obj, const char *kind,
|
||||
Error *err = NULL;
|
||||
|
||||
if (!qobj || qobject_type(qobj) != QTYPE_QDICT) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"QDict");
|
||||
return;
|
||||
}
|
||||
@ -163,7 +163,7 @@ static void qmp_input_start_list(Visitor *v, const char *name, Error **errp)
|
||||
QObject *qobj = qmp_input_get_object(qiv, name, true);
|
||||
|
||||
if (!qobj || qobject_type(qobj) != QTYPE_QLIST) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"list");
|
||||
return;
|
||||
}
|
||||
@ -215,7 +215,7 @@ static void qmp_input_get_next_type(Visitor *v, int *kind, const int *qobjects,
|
||||
QObject *qobj = qmp_input_get_object(qiv, name, false);
|
||||
|
||||
if (!qobj) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, name ? name : "null");
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, name ? name : "null");
|
||||
return;
|
||||
}
|
||||
*kind = qobjects[qobject_type(qobj)];
|
||||
@ -228,7 +228,7 @@ static void qmp_input_type_int(Visitor *v, int64_t *obj, const char *name,
|
||||
QObject *qobj = qmp_input_get_object(qiv, name, true);
|
||||
|
||||
if (!qobj || qobject_type(qobj) != QTYPE_QINT) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"integer");
|
||||
return;
|
||||
}
|
||||
@ -243,7 +243,7 @@ static void qmp_input_type_bool(Visitor *v, bool *obj, const char *name,
|
||||
QObject *qobj = qmp_input_get_object(qiv, name, true);
|
||||
|
||||
if (!qobj || qobject_type(qobj) != QTYPE_QBOOL) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"boolean");
|
||||
return;
|
||||
}
|
||||
@ -258,7 +258,7 @@ static void qmp_input_type_str(Visitor *v, char **obj, const char *name,
|
||||
QObject *qobj = qmp_input_get_object(qiv, name, true);
|
||||
|
||||
if (!qobj || qobject_type(qobj) != QTYPE_QSTRING) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"string");
|
||||
return;
|
||||
}
|
||||
@ -274,7 +274,7 @@ static void qmp_input_type_number(Visitor *v, double *obj, const char *name,
|
||||
|
||||
if (!qobj || (qobject_type(qobj) != QTYPE_QFLOAT &&
|
||||
qobject_type(qobj) != QTYPE_QINT)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"number");
|
||||
return;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ static void parse_type_int(Visitor *v, int64_t *obj, const char *name,
|
||||
StringInputVisitor *siv = DO_UPCAST(StringInputVisitor, visitor, v);
|
||||
|
||||
if (!siv->string) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"integer");
|
||||
return;
|
||||
}
|
||||
@ -217,7 +217,7 @@ static void parse_type_int(Visitor *v, int64_t *obj, const char *name,
|
||||
return;
|
||||
|
||||
error:
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name,
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name,
|
||||
"an int64 value or range");
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ static void parse_type_size(Visitor *v, uint64_t *obj, const char *name,
|
||||
if (siv->string) {
|
||||
parse_option_size(name, siv->string, &val, &err);
|
||||
} else {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"size");
|
||||
return;
|
||||
}
|
||||
@ -263,7 +263,7 @@ static void parse_type_bool(Visitor *v, bool *obj, const char *name,
|
||||
}
|
||||
}
|
||||
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"boolean");
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ static void parse_type_str(Visitor *v, char **obj, const char *name,
|
||||
if (siv->string) {
|
||||
*obj = g_strdup(siv->string);
|
||||
} else {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"string");
|
||||
}
|
||||
}
|
||||
@ -291,7 +291,7 @@ static void parse_type_number(Visitor *v, double *obj, const char *name,
|
||||
val = strtod(siv->string, &endp);
|
||||
}
|
||||
if (!siv->string || errno || endp == siv->string || *endp) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name ? name : "null",
|
||||
"number");
|
||||
return;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp)
|
||||
}
|
||||
|
||||
if (object_class_is_abstract(oc)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "driver",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver",
|
||||
"non-abstract device type");
|
||||
return NULL;
|
||||
}
|
||||
@ -209,7 +209,7 @@ static DeviceClass *qdev_get_device_class(const char **driver, Error **errp)
|
||||
dc = DEVICE_CLASS(oc);
|
||||
if (dc->cannot_instantiate_with_device_add_yet ||
|
||||
(qdev_hotplug && !dc->hotpluggable)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "driver",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver",
|
||||
"pluggable device type");
|
||||
return NULL;
|
||||
}
|
||||
@ -527,7 +527,7 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
|
||||
|
||||
driver = qemu_opt_get(opts, "driver");
|
||||
if (!driver) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, "driver");
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, "driver");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -558,7 +558,7 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
|
||||
}
|
||||
}
|
||||
if (qdev_hotplug && bus && !qbus_is_hotpluggable(bus)) {
|
||||
error_set(errp, QERR_BUS_NO_HOTPLUG, bus->name);
|
||||
error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -739,7 +739,7 @@ static int img_commit(int argc, char **argv)
|
||||
if (base) {
|
||||
base_bs = bdrv_find_backing_image(bs, base);
|
||||
if (!base_bs) {
|
||||
error_set(&local_err, QERR_BASE_NOT_FOUND, base);
|
||||
error_setg(&local_err, QERR_BASE_NOT_FOUND, base);
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
|
@ -382,14 +382,14 @@ static int guest_file_toggle_flags(int fd, int flags, bool set, Error **err)
|
||||
|
||||
old_flags = fcntl(fd, F_GETFL);
|
||||
if (old_flags == -1) {
|
||||
error_set_errno(err, errno, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg_errno(err, errno, QERR_QGA_COMMAND_FAILED,
|
||||
"failed to fetch filehandle flags");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = fcntl(fd, F_SETFL, set ? (old_flags | flags) : (old_flags & ~flags));
|
||||
if (ret == -1) {
|
||||
error_set_errno(err, errno, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg_errno(err, errno, QERR_QGA_COMMAND_FAILED,
|
||||
"failed to set filehandle flags");
|
||||
return -1;
|
||||
}
|
||||
@ -2302,34 +2302,34 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
|
||||
|
||||
void qmp_guest_suspend_disk(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
void qmp_guest_suspend_ram(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
void qmp_guest_suspend_hybrid(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int64_t qmp_guest_set_vcpus(GuestLogicalProcessorList *vcpus, Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2338,25 +2338,25 @@ void qmp_guest_set_user_password(const char *username,
|
||||
bool crypted,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GuestMemoryBlockResponseList *
|
||||
qmp_guest_set_memory_blocks(GuestMemoryBlockList *mem_blks, Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2366,20 +2366,20 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
|
||||
|
||||
GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64_t qmp_guest_fsfreeze_freeze(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2388,14 +2388,14 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints,
|
||||
strList *mountpoints,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64_t qmp_guest_fsfreeze_thaw(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -2404,7 +2404,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **errp)
|
||||
#if !defined(CONFIG_FSTRIM)
|
||||
void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -182,7 +182,7 @@ static void acquire_privilege(const char *name, Error **errp)
|
||||
TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &token))
|
||||
{
|
||||
if (!LookupPrivilegeValue(NULL, name, &priv.Privileges[0].Luid)) {
|
||||
error_set(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
"no luid for requested privilege");
|
||||
goto out;
|
||||
}
|
||||
@ -191,13 +191,13 @@ static void acquire_privilege(const char *name, Error **errp)
|
||||
priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||
|
||||
if (!AdjustTokenPrivileges(token, FALSE, &priv, 0, NULL, 0)) {
|
||||
error_set(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
"unable to acquire requested privilege");
|
||||
goto out;
|
||||
}
|
||||
|
||||
} else {
|
||||
error_set(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
"failed to open privilege token");
|
||||
}
|
||||
|
||||
@ -217,7 +217,7 @@ static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque,
|
||||
|
||||
HANDLE thread = CreateThread(NULL, 0, func, opaque, 0, NULL);
|
||||
if (!thread) {
|
||||
error_set(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
"failed to dispatch asynchronous command");
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
@ -237,7 +237,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
|
||||
} else if (strcmp(mode, "reboot") == 0) {
|
||||
shutdown_flag |= EWX_REBOOT;
|
||||
} else {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "mode",
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "mode",
|
||||
"halt|powerdown|reboot");
|
||||
return;
|
||||
}
|
||||
@ -252,7 +252,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
|
||||
|
||||
if (!ExitWindowsEx(shutdown_flag, SHTDN_REASON_FLAG_PLANNED)) {
|
||||
slog("guest-shutdown failed: %lu", GetLastError());
|
||||
error_set(errp, QERR_UNDEFINED_ERROR);
|
||||
error_setg(errp, QERR_UNDEFINED_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -384,7 +384,7 @@ static void guest_file_init(void)
|
||||
|
||||
GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -394,7 +394,7 @@ GuestFilesystemInfoList *qmp_guest_get_fsinfo(Error **errp)
|
||||
GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **errp)
|
||||
{
|
||||
if (!vss_initialized()) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -415,7 +415,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **errp)
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (!vss_initialized()) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints,
|
||||
strList *mountpoints,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -459,7 +459,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **errp)
|
||||
int i;
|
||||
|
||||
if (!vss_initialized()) {
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -495,7 +495,7 @@ static void guest_fsfreeze_cleanup(void)
|
||||
*/
|
||||
void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
@ -510,7 +510,7 @@ static void check_suspend_mode(GuestSuspendMode mode, Error **errp)
|
||||
|
||||
ZeroMemory(&sys_pwr_caps, sizeof(sys_pwr_caps));
|
||||
if (!GetPwrCapabilities(&sys_pwr_caps)) {
|
||||
error_set(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
"failed to determine guest suspend capabilities");
|
||||
goto out;
|
||||
}
|
||||
@ -518,18 +518,18 @@ static void check_suspend_mode(GuestSuspendMode mode, Error **errp)
|
||||
switch (mode) {
|
||||
case GUEST_SUSPEND_MODE_DISK:
|
||||
if (!sys_pwr_caps.SystemS4) {
|
||||
error_set(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
"suspend-to-disk not supported by OS");
|
||||
}
|
||||
break;
|
||||
case GUEST_SUSPEND_MODE_RAM:
|
||||
if (!sys_pwr_caps.SystemS3) {
|
||||
error_set(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
error_setg(&local_err, QERR_QGA_COMMAND_FAILED,
|
||||
"suspend-to-ram not supported by OS");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
error_set(&local_err, QERR_INVALID_PARAMETER_VALUE, "mode",
|
||||
error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "mode",
|
||||
"GuestSuspendMode");
|
||||
}
|
||||
|
||||
@ -586,12 +586,12 @@ void qmp_guest_suspend_ram(Error **errp)
|
||||
|
||||
void qmp_guest_suspend_hybrid(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -666,13 +666,13 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
|
||||
|
||||
GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int64_t qmp_guest_set_vcpus(GuestLogicalProcessorList *vcpus, Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -681,25 +681,25 @@ void qmp_guest_set_user_password(const char *username,
|
||||
bool crypted,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
}
|
||||
|
||||
GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GuestMemoryBlockResponseList *
|
||||
qmp_guest_set_memory_blocks(GuestMemoryBlockList *mem_blks, Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GuestMemoryBlockInfo *qmp_guest_get_memory_block_info(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -578,7 +578,7 @@ static void process_event(JSONMessageParser *parser, QList *tokens)
|
||||
qdict = qdict_new();
|
||||
if (!err) {
|
||||
g_warning("failed to parse event: unknown error");
|
||||
error_set(&err, QERR_JSON_PARSING);
|
||||
error_setg(&err, QERR_JSON_PARSING);
|
||||
} else {
|
||||
g_warning("failed to parse event: %s", error_get_pretty(err));
|
||||
}
|
||||
@ -598,7 +598,7 @@ static void process_event(JSONMessageParser *parser, QList *tokens)
|
||||
QDECREF(qdict);
|
||||
qdict = qdict_new();
|
||||
g_warning("unrecognized payload format");
|
||||
error_set(&err, QERR_UNSUPPORTED);
|
||||
error_setg(&err, QERR_UNSUPPORTED);
|
||||
qdict_put_obj(qdict, "error", qmp_build_error_object(err));
|
||||
error_free(err);
|
||||
}
|
||||
|
34
qmp.c
34
qmp.c
@ -132,13 +132,13 @@ void qmp_cpu_add(int64_t id, Error **errp)
|
||||
defined in the VNC subsystem */
|
||||
VncInfo *qmp_query_vnc(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "vnc");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
|
||||
return NULL;
|
||||
};
|
||||
|
||||
VncInfo2List *qmp_query_vnc_servers(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "vnc");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
|
||||
return NULL;
|
||||
};
|
||||
#endif
|
||||
@ -295,7 +295,7 @@ void qmp_set_password(const char *protocol, const char *password,
|
||||
} else if (strcmp(connected, "keep") == 0) {
|
||||
/* nothing */
|
||||
} else {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "connected");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "connected");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -307,7 +307,7 @@ void qmp_set_password(const char *protocol, const char *password,
|
||||
rc = qemu_spice_set_passwd(password, fail_if_connected,
|
||||
disconnect_if_connected);
|
||||
if (rc != 0) {
|
||||
error_set(errp, QERR_SET_PASSWD_FAILED);
|
||||
error_setg(errp, QERR_SET_PASSWD_FAILED);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -315,19 +315,19 @@ void qmp_set_password(const char *protocol, const char *password,
|
||||
if (strcmp(protocol, "vnc") == 0) {
|
||||
if (fail_if_connected || disconnect_if_connected) {
|
||||
/* vnc supports "connected=keep" only */
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "connected");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "connected");
|
||||
return;
|
||||
}
|
||||
/* Note that setting an empty password will not disable login through
|
||||
* this interface. */
|
||||
rc = vnc_display_password(NULL, password);
|
||||
if (rc < 0) {
|
||||
error_set(errp, QERR_SET_PASSWD_FAILED);
|
||||
error_setg(errp, QERR_SET_PASSWD_FAILED);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "protocol");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "protocol");
|
||||
}
|
||||
|
||||
void qmp_expire_password(const char *protocol, const char *whenstr,
|
||||
@ -352,7 +352,7 @@ void qmp_expire_password(const char *protocol, const char *whenstr,
|
||||
}
|
||||
rc = qemu_spice_set_pw_expire(when);
|
||||
if (rc != 0) {
|
||||
error_set(errp, QERR_SET_PASSWD_FAILED);
|
||||
error_setg(errp, QERR_SET_PASSWD_FAILED);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -360,19 +360,19 @@ void qmp_expire_password(const char *protocol, const char *whenstr,
|
||||
if (strcmp(protocol, "vnc") == 0) {
|
||||
rc = vnc_display_pw_expire(NULL, when);
|
||||
if (rc != 0) {
|
||||
error_set(errp, QERR_SET_PASSWD_FAILED);
|
||||
error_setg(errp, QERR_SET_PASSWD_FAILED);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
error_set(errp, QERR_INVALID_PARAMETER, "protocol");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, "protocol");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_VNC
|
||||
void qmp_change_vnc_password(const char *password, Error **errp)
|
||||
{
|
||||
if (vnc_display_password(NULL, password) < 0) {
|
||||
error_set(errp, QERR_SET_PASSWD_FAILED);
|
||||
error_setg(errp, QERR_SET_PASSWD_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@ -403,7 +403,7 @@ static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
|
||||
{
|
||||
if (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0) {
|
||||
if (!has_arg) {
|
||||
error_set(errp, QERR_MISSING_PARAMETER, "password");
|
||||
error_setg(errp, QERR_MISSING_PARAMETER, "password");
|
||||
} else {
|
||||
qmp_change_vnc_password(arg, errp);
|
||||
}
|
||||
@ -414,12 +414,12 @@ static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
|
||||
#else
|
||||
void qmp_change_vnc_password(const char *password, Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "vnc");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
|
||||
}
|
||||
static void qmp_change_vnc(const char *target, bool has_arg, const char *arg,
|
||||
Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_FEATURE_DISABLED, "vnc");
|
||||
error_setg(errp, QERR_FEATURE_DISABLED, "vnc");
|
||||
}
|
||||
#endif /* !CONFIG_VNC */
|
||||
|
||||
@ -528,8 +528,7 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename,
|
||||
|
||||
klass = object_class_dynamic_cast(klass, TYPE_DEVICE);
|
||||
if (klass == NULL) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
"name", TYPE_DEVICE);
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "name", TYPE_DEVICE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -686,7 +685,8 @@ int qmp_object_add(Monitor *mon, const QDict *qdict, QObject **ret)
|
||||
if (props) {
|
||||
pdict = qobject_to_qdict(props);
|
||||
if (!pdict) {
|
||||
error_set(&local_err, QERR_INVALID_PARAMETER_TYPE, "props", "dict");
|
||||
error_setg(&local_err, QERR_INVALID_PARAMETER_TYPE,
|
||||
"props", "dict");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
12
qom/object.c
12
qom/object.c
@ -926,7 +926,7 @@ void object_property_get(Object *obj, Visitor *v, const char *name,
|
||||
}
|
||||
|
||||
if (!prop->get) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
} else {
|
||||
prop->get(obj, v, prop->opaque, name, errp);
|
||||
}
|
||||
@ -941,7 +941,7 @@ void object_property_set(Object *obj, Visitor *v, const char *name,
|
||||
}
|
||||
|
||||
if (!prop->set) {
|
||||
error_set(errp, QERR_PERMISSION_DENIED);
|
||||
error_setg(errp, QERR_PERMISSION_DENIED);
|
||||
} else {
|
||||
prop->set(obj, v, prop->opaque, name, errp);
|
||||
}
|
||||
@ -968,7 +968,7 @@ char *object_property_get_str(Object *obj, const char *name,
|
||||
}
|
||||
qstring = qobject_to_qstring(ret);
|
||||
if (!qstring) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "string");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "string");
|
||||
retval = NULL;
|
||||
} else {
|
||||
retval = g_strdup(qstring_get_str(qstring));
|
||||
@ -1029,7 +1029,7 @@ bool object_property_get_bool(Object *obj, const char *name,
|
||||
}
|
||||
qbool = qobject_to_qbool(ret);
|
||||
if (!qbool) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "boolean");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "boolean");
|
||||
retval = false;
|
||||
} else {
|
||||
retval = qbool_get_bool(qbool);
|
||||
@ -1060,7 +1060,7 @@ int64_t object_property_get_int(Object *obj, const char *name,
|
||||
}
|
||||
qint = qobject_to_qint(ret);
|
||||
if (!qint) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "int");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "int");
|
||||
retval = -1;
|
||||
} else {
|
||||
retval = qint_get_int(qint);
|
||||
@ -1304,7 +1304,7 @@ static Object *object_resolve_link(Object *obj, const char *name,
|
||||
} else if (!target) {
|
||||
target = object_resolve_path(path, &ambiguous);
|
||||
if (target || ambiguous) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, target_type);
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, target_type);
|
||||
} else {
|
||||
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
|
||||
"Device '%s' not found", path);
|
||||
|
@ -4,6 +4,6 @@
|
||||
|
||||
CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
|
||||
{
|
||||
error_set(errp, QERR_UNSUPPORTED);
|
||||
error_setg(errp, QERR_UNSUPPORTED);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1524,7 +1524,7 @@ static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque,
|
||||
return;
|
||||
}
|
||||
if (value < min || value > max) {
|
||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
name ? name : "null", value, min, max);
|
||||
return;
|
||||
}
|
||||
@ -1565,7 +1565,7 @@ static void x86_cpuid_version_set_model(Object *obj, Visitor *v, void *opaque,
|
||||
return;
|
||||
}
|
||||
if (value < min || value > max) {
|
||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
name ? name : "null", value, min, max);
|
||||
return;
|
||||
}
|
||||
@ -1603,7 +1603,7 @@ static void x86_cpuid_version_set_stepping(Object *obj, Visitor *v,
|
||||
return;
|
||||
}
|
||||
if (value < min || value > max) {
|
||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
name ? name : "null", value, min, max);
|
||||
return;
|
||||
}
|
||||
@ -1632,8 +1632,7 @@ static void x86_cpuid_set_vendor(Object *obj, const char *value,
|
||||
int i;
|
||||
|
||||
if (strlen(value) != CPUID_VENDOR_SZ) {
|
||||
error_set(errp, QERR_PROPERTY_VALUE_BAD, "",
|
||||
"vendor", value);
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_BAD, "", "vendor", value);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1709,7 +1708,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque,
|
||||
return;
|
||||
}
|
||||
if (value < min || value > max) {
|
||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "",
|
||||
name ? name : "null", value, min, max);
|
||||
return;
|
||||
}
|
||||
|
9
tpm.c
9
tpm.c
@ -140,21 +140,22 @@ static int configure_tpm(QemuOpts *opts)
|
||||
|
||||
id = qemu_opts_id(opts);
|
||||
if (id == NULL) {
|
||||
qerror_report(QERR_MISSING_PARAMETER, "id");
|
||||
qerror_report(ERROR_CLASS_GENERIC_ERROR, QERR_MISSING_PARAMETER, "id");
|
||||
return 1;
|
||||
}
|
||||
|
||||
value = qemu_opt_get(opts, "type");
|
||||
if (!value) {
|
||||
qerror_report(QERR_MISSING_PARAMETER, "type");
|
||||
qerror_report(ERROR_CLASS_GENERIC_ERROR, QERR_MISSING_PARAMETER,
|
||||
"type");
|
||||
tpm_display_backend_drivers();
|
||||
return 1;
|
||||
}
|
||||
|
||||
be = tpm_get_backend_driver(value);
|
||||
if (be == NULL) {
|
||||
qerror_report(QERR_INVALID_PARAMETER_VALUE, "type",
|
||||
"a TPM backend type");
|
||||
qerror_report(ERROR_CLASS_GENERIC_ERROR, QERR_INVALID_PARAMETER_VALUE,
|
||||
"type", "a TPM backend type");
|
||||
tpm_display_backend_drivers();
|
||||
return 1;
|
||||
}
|
||||
|
4
ui/vnc.c
4
ui/vnc.c
@ -427,7 +427,7 @@ VncInfo *qmp_query_vnc(Error **errp)
|
||||
|
||||
if (getsockname(vd->lsock, (struct sockaddr *)&sa,
|
||||
&salen) == -1) {
|
||||
error_set(errp, QERR_UNDEFINED_ERROR);
|
||||
error_setg(errp, QERR_UNDEFINED_ERROR);
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
@ -435,7 +435,7 @@ VncInfo *qmp_query_vnc(Error **errp)
|
||||
host, sizeof(host),
|
||||
serv, sizeof(serv),
|
||||
NI_NUMERICHOST | NI_NUMERICSERV) < 0) {
|
||||
error_set(errp, QERR_UNDEFINED_ERROR);
|
||||
error_setg(errp, QERR_UNDEFINED_ERROR);
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,8 @@ static void parse_option_bool(const char *name, const char *value, bool *ret,
|
||||
} else if (!strcmp(value, "off")) {
|
||||
*ret = 0;
|
||||
} else {
|
||||
error_set(errp,QERR_INVALID_PARAMETER_VALUE, name, "'on' or 'off'");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
|
||||
name, "'on' or 'off'");
|
||||
}
|
||||
} else {
|
||||
*ret = 1;
|
||||
@ -148,12 +149,12 @@ static void parse_option_number(const char *name, const char *value,
|
||||
if (value != NULL) {
|
||||
number = strtoull(value, &postfix, 0);
|
||||
if (*postfix != '\0') {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, "a number");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name, "a number");
|
||||
return;
|
||||
}
|
||||
*ret = number;
|
||||
} else {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, "a number");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name, "a number");
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,7 +199,7 @@ void parse_option_size(const char *name, const char *value,
|
||||
*ret = (uint64_t) sizef;
|
||||
break;
|
||||
default:
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, "a size");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name, "a size");
|
||||
#if 0 /* conversion from qerror_report() to error_set() broke this: */
|
||||
error_printf_unless_qmp("You may use k, M, G or T suffixes for "
|
||||
"kilobytes, megabytes, gigabytes and terabytes.\n");
|
||||
@ -206,7 +207,7 @@ void parse_option_size(const char *name, const char *value,
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
error_set(errp, QERR_INVALID_PARAMETER_VALUE, name, "a size");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name, "a size");
|
||||
}
|
||||
}
|
||||
|
||||
@ -527,7 +528,7 @@ static void opt_set(QemuOpts *opts, const char *name, const char *value,
|
||||
|
||||
desc = find_desc_by_name(opts->list->desc, name);
|
||||
if (!desc && !opts_accepts_any(opts)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, name);
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -563,7 +564,7 @@ void qemu_opt_set_bool(QemuOpts *opts, const char *name, bool val,
|
||||
opt = g_malloc0(sizeof(*opt));
|
||||
opt->desc = find_desc_by_name(desc, name);
|
||||
if (!opt->desc && !opts_accepts_any(opts)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, name);
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, name);
|
||||
g_free(opt);
|
||||
return;
|
||||
}
|
||||
@ -584,7 +585,7 @@ void qemu_opt_set_number(QemuOpts *opts, const char *name, int64_t val,
|
||||
opt = g_malloc0(sizeof(*opt));
|
||||
opt->desc = find_desc_by_name(desc, name);
|
||||
if (!opt->desc && !opts_accepts_any(opts)) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, name);
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, name);
|
||||
g_free(opt);
|
||||
return;
|
||||
}
|
||||
@ -640,7 +641,8 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id,
|
||||
|
||||
if (id) {
|
||||
if (!id_wellformed(id)) {
|
||||
error_set(errp,QERR_INVALID_PARAMETER_VALUE, "id", "an identifier");
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "id",
|
||||
"an identifier");
|
||||
#if 0 /* conversion from qerror_report() to error_set() broke this: */
|
||||
error_printf_unless_qmp("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n");
|
||||
#endif
|
||||
@ -1055,7 +1057,7 @@ void qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc, Error **errp)
|
||||
QTAILQ_FOREACH(opt, &opts->head, next) {
|
||||
opt->desc = find_desc_by_name(desc, opt->name);
|
||||
if (!opt->desc) {
|
||||
error_set(errp, QERR_INVALID_PARAMETER, opt->name);
|
||||
error_setg(errp, QERR_INVALID_PARAMETER, opt->name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user