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