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