Received: from eggs.gnu.org ([208.118.235.92]:50535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su8Xd-0003Cd-2A for qemu-devel@nongnu.org; Wed, 25 Jul 2012 16:50:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Su8XT-0004RR-KX for qemu-devel@nongnu.org; Wed, 25 Jul 2012 16:50:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Su8XT-0004RD-0q for qemu-devel@nongnu.org; Wed, 25 Jul 2012 16:50:35 -0400 From: Luiz Capitulino Date: Wed, 25 Jul 2012 17:50:31 -0300 Message-Id: <1343249431-9245-15-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1343249431-9245-1-git-send-email-lcapitulino@redhat.com> References: <1343249431-9245-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 14/14] error: change all error_set() calls to use the ErrClass enum List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, aliguori@us.ibm.com, armbru@redhat.com, afaerber@suse.de, peter.maydell@linaro.org Signed-off-by: Luiz Capitulino --- balloon.c | 10 +++--- block.c | 4 +-- block/qcow.c | 2 +- block/stream.c | 2 +- block/vdi.c | 2 +- block/vmdk.c | 2 +- block/vpc.c | 2 +- block/vvfat.c | 2 +- blockdev.c | 68 ++++++++++++++++++++-------------------- cpus.c | 12 +++---- dump-stub.c | 2 +- dump.c | 18 +++++------ hmp.c | 2 +- hw/9pfs/virtio-9p.c | 2 +- hw/ivshmem.c | 2 +- hw/pci-stub.c | 2 +- hw/qdev-addr.c | 4 +-- hw/qdev-monitor.c | 2 +- hw/qdev-properties.c | 42 ++++++++++++------------- hw/qdev.c | 6 ++-- json-parser.c | 2 +- migration.c | 6 ++-- monitor.c | 8 ++--- net.c | 18 +++++------ qapi/qapi-visit-core.c | 16 +++++----- qapi/qmp-dispatch.c | 12 +++---- qapi/qmp-input-visitor.c | 16 +++++----- qapi/string-input-visitor.c | 8 ++--- qemu-config.c | 2 +- qemu-ga.c | 4 +-- qemu-option.c | 18 +++++------ qemu-sockets.c | 22 ++++++------- qga/commands-posix.c | 76 ++++++++++++++++++++++----------------------- qga/commands-win32.c | 44 +++++++++++++------------- qmp.c | 46 +++++++++++++-------------- qom/object.c | 20 ++++++------ savevm.c | 6 ++-- target-i386/cpu.c | 10 +++--- ui/vnc.c | 4 +-- 39 files changed, 263 insertions(+), 263 deletions(-) diff --git a/balloon.c b/balloon.c index a8bf9b6..60387df 100644 --- a/balloon.c +++ b/balloon.c @@ -99,14 +99,14 @@ BalloonInfo *qmp_query_balloon(Error **errp) BalloonInfo *info; if (kvm_enabled() && !kvm_has_sync_mmu()) { - error_set(errp, /* QERR_KVM_MISSING_CAP */ 38, "Using KVM without capability=%s, feature=%s unavailable", "synchronous MMU", "balloon"); + error_set(errp, QERR_KVM_MISSING_CAP, "Using KVM without capability=%s, feature=%s unavailable", "synchronous MMU", "balloon"); return NULL; } info = g_malloc0(sizeof(*info)); if (qemu_balloon_status(info) == 0) { - error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", "balloon"); + error_set(errp, QERR_DEVICE_NOT_ACTIVE, "Device 'device=%s' has not been activated", "balloon"); qapi_free_BalloonInfo(info); return NULL; } @@ -117,16 +117,16 @@ BalloonInfo *qmp_query_balloon(Error **errp) void qmp_balloon(int64_t value, Error **errp) { if (kvm_enabled() && !kvm_has_sync_mmu()) { - error_set(errp, /* QERR_KVM_MISSING_CAP */ 38, "Using KVM without capability=%s, feature=%s unavailable", "synchronous MMU", "balloon"); + error_set(errp, QERR_KVM_MISSING_CAP, "Using KVM without capability=%s, feature=%s unavailable", "synchronous MMU", "balloon"); return; } if (value <= 0) { - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "target", "a size"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "target", "a size"); return; } if (qemu_balloon(value) == 0) { - error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", "balloon"); + error_set(errp, QERR_DEVICE_NOT_ACTIVE, "Device 'device=%s' has not been activated", "balloon"); } } diff --git a/block.c b/block.c index c8d418a..be4861d 100644 --- a/block.c +++ b/block.c @@ -4034,7 +4034,7 @@ void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs, BlockJob *job; if (bs->job || bdrv_in_use(bs)) { - error_set(errp, /* QERR_DEVICE_IN_USE */ 14, "Device 'device=%s' is in use", bdrv_get_device_name(bs)); + error_set(errp, QERR_DEVICE_IN_USE, "Device 'device=%s' is in use", bdrv_get_device_name(bs)); return NULL; } bdrv_set_in_use(bs, 1); @@ -4079,7 +4079,7 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp) Error *local_err = NULL; if (!job->job_type->set_speed) { - error_set(errp, /* QERR_NOT_SUPPORTED */ 44, "Not supported"); + error_set(errp, QERR_NOT_SUPPORTED, "Not supported"); return; } job->job_type->set_speed(job, speed, &local_err); diff --git a/block/qcow.c b/block/qcow.c index b86d547..0e86156 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -180,7 +180,7 @@ static int qcow_open(BlockDriverState *bs, int flags) } /* Disable migration when qcow images are used */ - error_set(&s->migration_blocker, /* QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED */ 4, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "qcow", bs->device_name, "live migration"); + error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "qcow", bs->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); qemu_co_mutex_init(&s->lock); diff --git a/block/stream.c b/block/stream.c index 8ddaa59..81bb61e 100644 --- a/block/stream.c +++ b/block/stream.c @@ -168,7 +168,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 */ 30, "Invalid parameter 'name=%s'", "speed"); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", "speed"); return; } ratelimit_set_speed(&s->limit, speed / BDRV_SECTOR_SIZE, SLICE_TIME); diff --git a/block/vdi.c b/block/vdi.c index dadde29..ece4bd3 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -440,7 +440,7 @@ static int vdi_open(BlockDriverState *bs, int flags) } /* Disable migration when vdi images are used */ - error_set(&s->migration_blocker, /* QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED */ 4, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vdi", bs->device_name, "live migration"); + error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vdi", bs->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); return 0; diff --git a/block/vmdk.c b/block/vmdk.c index 49ee6cd..d38597c 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -663,7 +663,7 @@ static int vmdk_open(BlockDriverState *bs, int flags) qemu_co_mutex_init(&s->lock); /* Disable migration when VMDK images are used */ - error_set(&s->migration_blocker, /* QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED */ 4, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vmdk", bs->device_name, "live migration"); + error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vmdk", bs->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); return 0; diff --git a/block/vpc.c b/block/vpc.c index 662e3f8..d5118fe 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -255,7 +255,7 @@ static int vpc_open(BlockDriverState *bs, int flags) qemu_co_mutex_init(&s->lock); /* Disable migration when VHD images are used */ - error_set(&s->migration_blocker, /* QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED */ 4, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vpc", bs->device_name, "live migration"); + error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vpc", bs->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); return 0; diff --git a/block/vvfat.c b/block/vvfat.c index cf9e9eb..796fd74 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1091,7 +1091,7 @@ DLOG(if (stderr == NULL) { /* Disable migration when vvfat is used rw */ if (s->qcow) { - error_set(&s->migration_blocker, /* QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED */ 4, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vvfat (rw)", bs->device_name, "live migration"); + error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "Block format 'format=%s' used by device 'name=%s' does not support feature 'feature=%s'", "vvfat (rw)", bs->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); } diff --git a/blockdev.c b/blockdev.c index 11c714f..3fc9d5a 100644 --- a/blockdev.c +++ b/blockdev.c @@ -739,29 +739,29 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) drv = bdrv_find_format(format); if (!drv) { - error_set(errp, /* QERR_INVALID_BLOCK_FORMAT */ 28, "Invalid block format 'name=%s'", format); + error_set(errp, QERR_INVALID_BLOCK_FORMAT, "Invalid block format 'name=%s'", format); goto delete_and_fail; } states->old_bs = bdrv_find(device); if (!states->old_bs) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", device); goto delete_and_fail; } if (!bdrv_is_inserted(states->old_bs)) { - error_set(errp, /* QERR_DEVICE_HAS_NO_MEDIUM */ 12, "Device 'device=%s' has no medium", device); + error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, "Device 'device=%s' has no medium", device); goto delete_and_fail; } if (bdrv_in_use(states->old_bs)) { - error_set(errp, /* QERR_DEVICE_IN_USE */ 14, "Device 'device=%s' is in use", device); + error_set(errp, QERR_DEVICE_IN_USE, "Device 'device=%s' is in use", device); goto delete_and_fail; } if (!bdrv_is_read_only(states->old_bs)) { if (bdrv_flush(states->old_bs)) { - error_set(errp, /* QERR_IO_ERROR */ 35, "An IO error has occurred"); + error_set(errp, QERR_IO_ERROR, "An IO error has occurred"); goto delete_and_fail; } } @@ -770,7 +770,7 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) proto_drv = bdrv_find_protocol(new_image_file); if (!proto_drv) { - error_set(errp, /* QERR_INVALID_BLOCK_FORMAT */ 28, "Invalid block format 'name=%s'", format); + error_set(errp, QERR_INVALID_BLOCK_FORMAT, "Invalid block format 'name=%s'", format); goto delete_and_fail; } @@ -781,7 +781,7 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) states->old_bs->drv->format_name, NULL, -1, flags); if (ret) { - error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", new_image_file); + error_set(errp, QERR_OPEN_FILE_FAILED, "Could not open 'filename=%s'", new_image_file); goto delete_and_fail; } } @@ -791,7 +791,7 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) ret = bdrv_open(states->new_bs, new_image_file, flags | BDRV_O_NO_BACKING, drv); if (ret != 0) { - error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", new_image_file); + error_set(errp, QERR_OPEN_FILE_FAILED, "Could not open 'filename=%s'", new_image_file); goto delete_and_fail; } } @@ -828,18 +828,18 @@ exit: static void eject_device(BlockDriverState *bs, int force, Error **errp) { if (bdrv_in_use(bs)) { - error_set(errp, /* QERR_DEVICE_IN_USE */ 14, "Device 'device=%s' is in use", bdrv_get_device_name(bs)); + error_set(errp, QERR_DEVICE_IN_USE, "Device 'device=%s' is in use", bdrv_get_device_name(bs)); return; } if (!bdrv_dev_has_removable_media(bs)) { - error_set(errp, /* QERR_DEVICE_NOT_REMOVABLE */ 23, "Device 'device=%s' is not removable", bdrv_get_device_name(bs)); + error_set(errp, QERR_DEVICE_NOT_REMOVABLE, "Device 'device=%s' is not removable", bdrv_get_device_name(bs)); return; } if (bdrv_dev_is_medium_locked(bs) && !bdrv_dev_is_tray_open(bs)) { bdrv_dev_eject_request(bs, force); if (!force) { - error_set(errp, /* QERR_DEVICE_LOCKED */ 16, "Device 'device=%s' is locked", bdrv_get_device_name(bs)); + error_set(errp, QERR_DEVICE_LOCKED, "Device 'device=%s' is locked", bdrv_get_device_name(bs)); return; } } @@ -853,7 +853,7 @@ void qmp_eject(const char *device, bool has_force, bool force, Error **errp) bs = bdrv_find(device); if (!bs) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", device); return; } @@ -867,16 +867,16 @@ void qmp_block_passwd(const char *device, const char *password, Error **errp) bs = bdrv_find(device); if (!bs) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", device); return; } err = bdrv_set_key(bs, password); if (err == -EINVAL) { - error_set(errp, /* QERR_DEVICE_NOT_ENCRYPTED */ 21, "Device 'device=%s' is not encrypted", bdrv_get_device_name(bs)); + error_set(errp, QERR_DEVICE_NOT_ENCRYPTED, "Device 'device=%s' is not encrypted", bdrv_get_device_name(bs)); return; } else if (err < 0) { - error_set(errp, /* QERR_INVALID_PASSWORD */ 34, "Password incorrect"); + error_set(errp, QERR_INVALID_PASSWORD, "Password incorrect"); return; } } @@ -886,20 +886,20 @@ static void qmp_bdrv_open_encrypted(BlockDriverState *bs, const char *filename, const char *password, Error **errp) { if (bdrv_open(bs, filename, bdrv_flags, drv) < 0) { - error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", filename); + error_set(errp, QERR_OPEN_FILE_FAILED, "Could not open 'filename=%s'", filename); return; } if (bdrv_key_required(bs)) { if (password) { if (bdrv_set_key(bs, password) < 0) { - error_set(errp, /* QERR_INVALID_PASSWORD */ 34, "Password incorrect"); + error_set(errp, QERR_INVALID_PASSWORD, "Password incorrect"); } } else { - error_set(errp, /* QERR_DEVICE_ENCRYPTED */ 10, "Device 'device=%s' is encrypted (filename=filename=%s)", bdrv_get_device_name(bs), bdrv_get_encrypted_filename(bs)); + error_set(errp, QERR_DEVICE_ENCRYPTED, "Device 'device=%s' is encrypted (filename=filename=%s)", bdrv_get_device_name(bs), bdrv_get_encrypted_filename(bs)); } } else if (password) { - error_set(errp, /* QERR_DEVICE_NOT_ENCRYPTED */ 21, "Device 'device=%s' is not encrypted", bdrv_get_device_name(bs)); + error_set(errp, QERR_DEVICE_NOT_ENCRYPTED, "Device 'device=%s' is not encrypted", bdrv_get_device_name(bs)); } } @@ -913,14 +913,14 @@ void qmp_change_blockdev(const char *device, const char *filename, bs = bdrv_find(device); if (!bs) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", device); return; } if (format) { drv = bdrv_find_whitelisted_format(format); if (!drv) { - error_set(errp, /* QERR_INVALID_BLOCK_FORMAT */ 28, "Invalid block format 'name=%s'", format); + error_set(errp, QERR_INVALID_BLOCK_FORMAT, "Invalid block format 'name=%s'", format); return; } } @@ -947,7 +947,7 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, bs = bdrv_find(device); if (!bs) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", device); return; } @@ -959,7 +959,7 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, io_limits.iops[BLOCK_IO_LIMIT_WRITE]= iops_wr; if (!do_check_io_limits(&io_limits)) { - error_set(errp, /* QERR_INVALID_PARAMETER_COMBINATION */ 31, "Invalid parameter combination"); + error_set(errp, QERR_INVALID_PARAMETER_COMBINATION, "Invalid parameter combination"); return; } @@ -1017,12 +1017,12 @@ void qmp_block_resize(const char *device, int64_t size, Error **errp) bs = bdrv_find(device); if (!bs) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", device); return; } if (size < 0) { - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "size", "a >0 size"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "size", "a >0 size"); return; } @@ -1030,19 +1030,19 @@ void qmp_block_resize(const char *device, int64_t size, Error **errp) case 0: break; case -ENOMEDIUM: - error_set(errp, /* QERR_DEVICE_HAS_NO_MEDIUM */ 12, "Device 'device=%s' has no medium", device); + error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, "Device 'device=%s' has no medium", device); break; case -ENOTSUP: - error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(errp, QERR_UNSUPPORTED, "this feature or command is not currently supported"); break; case -EACCES: - error_set(errp, /* QERR_DEVICE_IS_READ_ONLY */ 15, "Device 'device=%s' is read only", device); + error_set(errp, QERR_DEVICE_IS_READ_ONLY, "Device 'device=%s' is read only", device); break; case -EBUSY: - error_set(errp, /* QERR_DEVICE_IN_USE */ 14, "Device 'device=%s' is in use", device); + error_set(errp, QERR_DEVICE_IN_USE, "Device 'device=%s' is in use", device); break; default: - error_set(errp, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred"); + error_set(errp, QERR_UNDEFINED_ERROR, "An undefined error has occurred"); break; } } @@ -1095,14 +1095,14 @@ void qmp_block_stream(const char *device, bool has_base, bs = bdrv_find(device); if (!bs) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", device); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", device); return; } if (base) { base_bs = bdrv_find_backing_image(bs, base); if (base_bs == NULL) { - error_set(errp, /* QERR_BASE_NOT_FOUND */ 3, "Base 'base=%s' not found", base); + error_set(errp, QERR_BASE_NOT_FOUND, "Base 'base=%s' not found", base); return; } } @@ -1138,7 +1138,7 @@ void qmp_block_job_set_speed(const char *device, int64_t speed, Error **errp) BlockJob *job = find_block_job(device); if (!job) { - error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", device); + error_set(errp, QERR_DEVICE_NOT_ACTIVE, "Device 'device=%s' has not been activated", device); return; } @@ -1150,7 +1150,7 @@ void qmp_block_job_cancel(const char *device, Error **errp) BlockJob *job = find_block_job(device); if (!job) { - error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", device); + error_set(errp, QERR_DEVICE_NOT_ACTIVE, "Device 'device=%s' has not been activated", device); return; } diff --git a/cpus.c b/cpus.c index f72c117..c6619a6 100644 --- a/cpus.c +++ b/cpus.c @@ -1246,13 +1246,13 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename, } if (env == NULL) { - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "cpu-index", "a CPU number"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "cpu-index", "a CPU number"); return; } f = fopen(filename, "wb"); if (!f) { - error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", filename); + error_set(errp, QERR_OPEN_FILE_FAILED, "Could not open 'filename=%s'", filename); return; } @@ -1262,7 +1262,7 @@ void qmp_memsave(int64_t addr, int64_t size, const char *filename, l = size; cpu_memory_rw_debug(env, addr, buf, l, 0); if (fwrite(buf, 1, l, f) != l) { - error_set(errp, /* QERR_IO_ERROR */ 35, "An IO error has occurred"); + error_set(errp, QERR_IO_ERROR, "An IO error has occurred"); goto exit; } addr += l; @@ -1282,7 +1282,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename, f = fopen(filename, "wb"); if (!f) { - error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", filename); + error_set(errp, QERR_OPEN_FILE_FAILED, "Could not open 'filename=%s'", filename); return; } @@ -1292,7 +1292,7 @@ void qmp_pmemsave(int64_t addr, int64_t size, const char *filename, l = size; cpu_physical_memory_rw(addr, buf, l, 0); if (fwrite(buf, 1, l, f) != l) { - error_set(errp, /* QERR_IO_ERROR */ 35, "An IO error has occurred"); + error_set(errp, QERR_IO_ERROR, "An IO error has occurred"); goto exit; } addr += l; @@ -1316,6 +1316,6 @@ void qmp_inject_nmi(Error **errp) } } #else - error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(errp, QERR_UNSUPPORTED, "this feature or command is not currently supported"); #endif } diff --git a/dump-stub.c b/dump-stub.c index 537c947..ec51e7f 100644 --- a/dump-stub.c +++ b/dump-stub.c @@ -21,7 +21,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, int64_t begin, bool has_length, int64_t length, Error **errp) { - error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(errp, QERR_UNSUPPORTED, "this feature or command is not currently supported"); } int cpu_write_elf64_note(write_core_dump_function f, diff --git a/dump.c b/dump.c index 7cc27f9..cc427ba 100644 --- a/dump.c +++ b/dump.c @@ -721,7 +721,7 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, s->length = length; s->start = get_start_block(s); if (s->start == -1) { - error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "begin"); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", "begin"); goto cleanup; } @@ -741,14 +741,14 @@ static int dump_init(DumpState *s, int fd, bool paging, bool has_filter, ret = cpu_get_dump_info(&s->dump_info); if (ret < 0) { - error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(errp, QERR_UNSUPPORTED, "this feature or command is not currently supported"); goto cleanup; } s->note_size = cpu_get_note_size(s->dump_info.d_class, s->dump_info.d_machine, nr_cpus); if (ret < 0) { - error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(errp, QERR_UNSUPPORTED, "this feature or command is not currently supported"); goto cleanup; } @@ -826,11 +826,11 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, int ret; if (has_begin && !has_length) { - error_set(errp, /* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "length"); + error_set(errp, QERR_MISSING_PARAMETER, "Parameter 'name=%s' is missing", "length"); return; } if (!has_begin && has_length) { - error_set(errp, /* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "begin"); + error_set(errp, QERR_MISSING_PARAMETER, "Parameter 'name=%s' is missing", "begin"); return; } @@ -838,7 +838,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, if (strstart(file, "fd:", &p)) { fd = monitor_get_fd(cur_mon, p); if (fd == -1) { - error_set(errp, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", p); + error_set(errp, QERR_FD_NOT_FOUND, "File descriptor named 'name=%s' not found", p); return; } } @@ -847,13 +847,13 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, if (strstart(file, "file:", &p)) { fd = qemu_open(p, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR); if (fd < 0) { - error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", p); + error_set(errp, QERR_OPEN_FILE_FAILED, "Could not open 'filename=%s'", p); return; } } if (fd == -1) { - error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "protocol"); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", "protocol"); return; } @@ -866,7 +866,7 @@ void qmp_dump_guest_memory(bool paging, const char *file, bool has_begin, } if (create_vmcore(s) < 0 && !error_is_set(s->errp)) { - error_set(errp, /* QERR_IO_ERROR */ 35, "An IO error has occurred"); + error_set(errp, QERR_IO_ERROR, "An IO error has occurred"); } g_free(s); diff --git a/hmp.c b/hmp.c index ceeb8da..045b911 100644 --- a/hmp.c +++ b/hmp.c @@ -707,7 +707,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(&errp, /* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "snapshot-file"); + error_set(&errp, QERR_MISSING_PARAMETER, "Parameter 'name=%s' is missing", "snapshot-file"); hmp_handle_error(mon, &errp); return; } diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c index 8080582..d833e18 100644 --- a/hw/9pfs/virtio-9p.c +++ b/hw/9pfs/virtio-9p.c @@ -985,7 +985,7 @@ static void v9fs_attach(void *opaque) qid.type, qid.version, qid.path); s->root_fid = fid; /* disable migration */ - error_set(&s->migration_blocker, /* QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION */ 69, "Migration is disabled when VirtFS export path 'path=%s' is mounted in the guest using mount_tag 'tag=%s'", s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag); + error_set(&s->migration_blocker, QERR_VIRTFS_FEATURE_BLOCKS_MIGRATION, "Migration is disabled when VirtFS export path 'path=%s' is mounted in the guest using mount_tag 'tag=%s'", s->ctx.fs_root ? s->ctx.fs_root : "NULL", s->tag); migrate_add_blocker(s->migration_blocker); out: put_fid(pdu, fidp); diff --git a/hw/ivshmem.c b/hw/ivshmem.c index f95cd60..cf042b4 100644 --- a/hw/ivshmem.c +++ b/hw/ivshmem.c @@ -681,7 +681,7 @@ static int pci_ivshmem_init(PCIDevice *dev) } if (s->role_val == IVSHMEM_PEER) { - error_set(&s->migration_blocker, /* QERR_DEVICE_FEATURE_BLOCKS_MIGRATION */ 11, "Migration is disabled when using feature 'feature=%s' in device 'device=%s'", "ivshmem", "peer mode"); + error_set(&s->migration_blocker, QERR_DEVICE_FEATURE_BLOCKS_MIGRATION, "Migration is disabled when using feature 'feature=%s' in device 'device=%s'", "ivshmem", "peer mode"); migrate_add_blocker(s->migration_blocker); } diff --git a/hw/pci-stub.c b/hw/pci-stub.c index 448c21e..8ccfb6a 100644 --- a/hw/pci-stub.c +++ b/hw/pci-stub.c @@ -25,7 +25,7 @@ PciInfoList *qmp_query_pci(Error **errp) { - error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(errp, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return NULL; } diff --git a/hw/qdev-addr.c b/hw/qdev-addr.c index c002ecd..a011f67 100644 --- a/hw/qdev-addr.c +++ b/hw/qdev-addr.c @@ -40,7 +40,7 @@ static void set_taddr(Object *obj, Visitor *v, void *opaque, int64_t value; if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -52,7 +52,7 @@ static void set_taddr(Object *obj, Visitor *v, void *opaque, if ((uint64_t)value <= (uint64_t) ~(target_phys_addr_t)0) { *ptr = value; } else { - error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", dev->id?:"", name, value, (uint64_t) 0, (uint64_t) ~(target_phys_addr_t)0); + error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", dev->id?:"", name, value, (uint64_t) 0, (uint64_t) ~(target_phys_addr_t)0); } } diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c index 03bb21d..dfa7491 100644 --- a/hw/qdev-monitor.c +++ b/hw/qdev-monitor.c @@ -600,7 +600,7 @@ void qmp_device_del(const char *id, Error **errp) dev = qdev_find_recursive(sysbus_get_default(), id); if (NULL == dev) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", id); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", id); return; } diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index a6a17d7..95020ad 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -35,7 +35,7 @@ static void set_pointer(Object *obj, Visitor *v, Property *prop, int ret; if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -73,7 +73,7 @@ static void set_enum(Object *obj, Visitor *v, void *opaque, int *ptr = qdev_get_prop_ptr(dev, prop); if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -125,7 +125,7 @@ static void set_bit(Object *obj, Visitor *v, void *opaque, bool value; if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -165,7 +165,7 @@ static void set_uint8(Object *obj, Visitor *v, void *opaque, uint8_t *ptr = qdev_get_prop_ptr(dev, prop); if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -232,7 +232,7 @@ static void set_uint16(Object *obj, Visitor *v, void *opaque, uint16_t *ptr = qdev_get_prop_ptr(dev, prop); if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -265,7 +265,7 @@ static void set_uint32(Object *obj, Visitor *v, void *opaque, uint32_t *ptr = qdev_get_prop_ptr(dev, prop); if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -290,7 +290,7 @@ static void set_int32(Object *obj, Visitor *v, void *opaque, int32_t *ptr = qdev_get_prop_ptr(dev, prop); if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -363,7 +363,7 @@ static void set_uint64(Object *obj, Visitor *v, void *opaque, uint64_t *ptr = qdev_get_prop_ptr(dev, prop); if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -451,7 +451,7 @@ static void set_string(Object *obj, Visitor *v, void *opaque, char *str; if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -656,7 +656,7 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque, VLANState *vlan; if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -671,7 +671,7 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque, } vlan = qemu_find_vlan(id, 1); if (!vlan) { - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name, prop->info->name); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name, prop->info->name); return; } *ptr = vlan; @@ -725,7 +725,7 @@ static void set_mac(Object *obj, Visitor *v, void *opaque, char *str, *p; if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -813,7 +813,7 @@ static void set_pci_devfn(Object *obj, Visitor *v, void *opaque, char *str; if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -825,7 +825,7 @@ 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 */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "pci_devfn"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "pci_devfn"); } else { *ptr = value; } @@ -882,7 +882,7 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque, const int64_t max = 32768; if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -892,13 +892,13 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque, return; } if (value < min || value > max) { - error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", dev->id?:"", name, (int64_t)value, min, max); + error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", dev->id?:"", name, (int64_t)value, min, max); return; } /* We rely on power-of-2 blocksizes for bitmasks */ if ((value & (value - 1)) != 0) { - error_set(errp, /* QERR_PROPERTY_VALUE_NOT_POWER_OF2 */ 51, "Property 'device=%s.property=%s' doesn't take value 'value=%"PRId64"', it's not a power of 2", dev->id?:"", name, (int64_t)value); + error_set(errp, QERR_PROPERTY_VALUE_NOT_POWER_OF2, "Property 'device=%s.property=%s' doesn't take value 'value=%"PRId64"', it's not a power of 2", dev->id?:"", name, (int64_t)value); return; } @@ -948,7 +948,7 @@ static void set_pci_host_devaddr(Object *obj, Visitor *v, void *opaque, unsigned int slot = 0, func = 0; if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } @@ -1055,14 +1055,14 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev, { switch (ret) { case -EEXIST: - error_set(errp, /* QERR_PROPERTY_VALUE_IN_USE */ 49, "Property 'device=%s.property=%s' can't take value 'value=%s', it's in use", object_get_typename(OBJECT(dev)), prop->name, value); + error_set(errp, QERR_PROPERTY_VALUE_IN_USE, "Property 'device=%s.property=%s' can't take value 'value=%s', it's in use", object_get_typename(OBJECT(dev)), prop->name, value); break; default: case -EINVAL: - error_set(errp, /* QERR_PROPERTY_VALUE_BAD */ 48, "Property 'device=%s.property=%s' doesn't take value 'value=%s'", object_get_typename(OBJECT(dev)), prop->name, value); + error_set(errp, QERR_PROPERTY_VALUE_BAD, "Property 'device=%s.property=%s' doesn't take value 'value=%s'", object_get_typename(OBJECT(dev)), prop->name, value); break; case -ENOENT: - error_set(errp, /* QERR_PROPERTY_VALUE_NOT_FOUND */ 50, "Property 'device=%s.property=%s' can't find value 'value=%s'", object_get_typename(OBJECT(dev)), prop->name, value); + error_set(errp, QERR_PROPERTY_VALUE_NOT_FOUND, "Property 'device=%s.property=%s' can't find value 'value=%s'", object_get_typename(OBJECT(dev)), prop->name, value); break; case 0: break; diff --git a/hw/qdev.c b/hw/qdev.c index 390403c..e33b86e 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -199,7 +199,7 @@ void qdev_unplug(DeviceState *dev, Error **errp) DeviceClass *dc = DEVICE_GET_CLASS(dev); if (!dev->parent_bus->allow_hotplug) { - error_set(errp, /* QERR_BUS_NO_HOTPLUG */ 6, "Bus 'bus=%s' does not support hotplugging", dev->parent_bus->name); + error_set(errp, QERR_BUS_NO_HOTPLUG, "Bus 'bus=%s' does not support hotplugging", dev->parent_bus->name); return; } assert(dc->unplug != NULL); @@ -207,7 +207,7 @@ void qdev_unplug(DeviceState *dev, Error **errp) qdev_hot_removed = true; if (dc->unplug(dev) < 0) { - error_set(errp, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred"); + error_set(errp, QERR_UNDEFINED_ERROR, "An undefined error has occurred"); return; } } @@ -570,7 +570,7 @@ static void qdev_set_legacy_property(Object *obj, Visitor *v, void *opaque, int ret; if (dev->state != DEV_STATE_CREATED) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); return; } diff --git a/json-parser.c b/json-parser.c index c113064..d1ff507 100644 --- a/json-parser.c +++ b/json-parser.c @@ -105,7 +105,7 @@ static void GCC_FMT_ATTR(3, 4) parse_error(JSONParserContext *ctxt, error_free(ctxt->err); ctxt->err = NULL; } - error_set(&ctxt->err, /* QERR_JSON_PARSE_ERROR */ 36, "JSON parse error, message=%s", message); + error_set(&ctxt->err, QERR_JSON_PARSE_ERROR, "JSON parse error, message=%s", message); } /** diff --git a/migration.c b/migration.c index d1788c8..ab5d03c 100644 --- a/migration.c +++ b/migration.c @@ -412,7 +412,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, params.shared = inc; if (s->state == MIG_STATE_ACTIVE) { - error_set(errp, /* QERR_MIGRATION_ACTIVE */ 39, "There\'s a migration process in progress"); + error_set(errp, QERR_MIGRATION_ACTIVE, "There\'s a migration process in progress"); return; } @@ -438,7 +438,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, ret = fd_start_outgoing_migration(s, p); #endif } else { - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "uri", "a valid migration protocol"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "uri", "a valid migration protocol"); return; } @@ -446,7 +446,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, if (!error_is_set(errp)) { DPRINTF("migration failed: %s\n", strerror(-ret)); /* FIXME: we should return meaningful errors */ - error_set(errp, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred"); + error_set(errp, QERR_UNDEFINED_ERROR, "An undefined error has occurred"); } return; } diff --git a/monitor.c b/monitor.c index 62d56a4..550f688 100644 --- a/monitor.c +++ b/monitor.c @@ -626,7 +626,7 @@ char *qmp_human_monitor_command(const char *command_line, bool has_cpu_index, int ret = monitor_set_cpu(cpu_index); if (ret < 0) { cur_mon = old_mon; - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "cpu-index", "a CPU number"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "cpu-index", "a CPU number"); goto out; } } @@ -2284,12 +2284,12 @@ 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 */ 26, "No file descriptor supplied via SCM_RIGHTS"); + error_set(errp, QERR_FD_NOT_SUPPLIED, "No file descriptor supplied via SCM_RIGHTS"); return; } if (qemu_isdigit(fdname[0])) { - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "fdname", "a name not starting with a digit"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "fdname", "a name not starting with a digit"); return; } @@ -2326,7 +2326,7 @@ void qmp_closefd(const char *fdname, Error **errp) return; } - error_set(errp, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", fdname); + error_set(errp, QERR_FD_NOT_FOUND, "File descriptor named 'name=%s' not found", fdname); } static void do_loadvm(Monitor *mon, const QDict *qdict) diff --git a/net.c b/net.c index bf4a7c3..a8d85b3 100644 --- a/net.c +++ b/net.c @@ -1089,7 +1089,7 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp) type = qemu_opt_get(opts, "type"); if (!type) { - error_set(errp, /* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "type"); + error_set(errp, QERR_MISSING_PARAMETER, "Parameter 'name=%s' is missing", "type"); return -1; } @@ -1105,20 +1105,20 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp) strcmp(type, "vde") != 0 && #endif strcmp(type, "socket") != 0) { - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "type", "a netdev backend type"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "type", "a netdev backend type"); return -1; } if (qemu_opt_get(opts, "vlan")) { - error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "vlan"); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", "vlan"); return -1; } if (qemu_opt_get(opts, "name")) { - error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "name"); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", "name"); return -1; } if (!qemu_opts_id(opts)) { - error_set(errp, /* QERR_MISSING_PARAMETER */ 42, "Parameter 'name=%s' is missing", "id"); + error_set(errp, QERR_MISSING_PARAMETER, "Parameter 'name=%s' is missing", "id"); return -1; } } @@ -1153,7 +1153,7 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp) ret = net_client_types[i].init(opts, name, vlan); if (ret < 0) { /* TODO push error reporting into init() methods */ - error_set(errp, /* QERR_DEVICE_INIT_FAILED */ 13, "Device 'device=%s' could not be initialized", type); + error_set(errp, QERR_DEVICE_INIT_FAILED, "Device 'device=%s' could not be initialized", type); return -1; } } @@ -1161,7 +1161,7 @@ int net_client_init(QemuOpts *opts, int is_netdev, Error **errp) } } - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "type", "a network client type"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "type", "a network client type"); return -1; } @@ -1273,7 +1273,7 @@ void qmp_netdev_del(const char *id, Error **errp) vc = qemu_find_netdev(id); if (!vc) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", id); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", id); return; } @@ -1336,7 +1336,7 @@ void qmp_set_link(const char *name, bool up, Error **errp) done: if (!vc) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", name); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", name); return; } diff --git a/qapi/qapi-visit-core.c b/qapi/qapi-visit-core.c index e652039..482109a 100644 --- a/qapi/qapi-visit-core.c +++ b/qapi/qapi-visit-core.c @@ -107,7 +107,7 @@ 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 */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "uint8_t"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "uint8_t"); return; } *obj = value; @@ -125,7 +125,7 @@ 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 */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "uint16_t"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "uint16_t"); return; } *obj = value; @@ -143,7 +143,7 @@ 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 */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "uint32_t"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "uint32_t"); return; } *obj = value; @@ -175,7 +175,7 @@ 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 */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "int8_t"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "int8_t"); return; } *obj = value; @@ -193,7 +193,7 @@ 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 */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "int16_t"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "int16_t"); return; } *obj = value; @@ -211,7 +211,7 @@ 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 */ 33, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "int32_t"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name ? name : "null", "int32_t"); return; } *obj = value; @@ -262,7 +262,7 @@ void output_type_enum(Visitor *v, int *obj, const char *strings[], assert(strings); while (strings[i++] != NULL); if (value < 0 || value >= i - 1) { - error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", name ? name : "null"); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", name ? name : "null"); return; } @@ -292,7 +292,7 @@ void input_type_enum(Visitor *v, int *obj, const char *strings[], } if (strings[value] == NULL) { - error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", enum_str); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", enum_str); g_free(enum_str); return; } diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index df2c12e..5dcc23f 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -27,7 +27,7 @@ static QDict *qmp_dispatch_check_obj(const QObject *request, Error **errp) QDict *dict = NULL; if (qobject_type(request) != QTYPE_QDICT) { - error_set(errp, /* QERR_QMP_BAD_INPUT_OBJECT */ 55, "Expected 'expected=%s' in QMP input", "request is not a dictionary"); + error_set(errp, QERR_QMP_BAD_INPUT_OBJECT, "Expected 'expected=%s' in QMP input", "request is not a dictionary"); return NULL; } @@ -40,18 +40,18 @@ 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 */ 56, "QMP input object member 'member=%s' expects 'expected=%s'", "execute", "string"); + error_set(errp, QERR_QMP_BAD_INPUT_OBJECT_MEMBER, "QMP input object member 'member=%s' expects 'expected=%s'", "execute", "string"); return NULL; } has_exec_key = true; } else if (strcmp(arg_name, "arguments")) { - error_set(errp, /* QERR_QMP_EXTRA_INPUT_OBJECT_MEMBER */ 57, "QMP input object member 'member=%s' is unexpected", arg_name); + error_set(errp, QERR_QMP_EXTRA_INPUT_OBJECT_MEMBER, "QMP input object member 'member=%s' is unexpected", arg_name); return NULL; } } if (!has_exec_key) { - error_set(errp, /* QERR_QMP_BAD_INPUT_OBJECT */ 55, "Expected 'expected=%s' in QMP input", "execute"); + error_set(errp, QERR_QMP_BAD_INPUT_OBJECT, "Expected 'expected=%s' in QMP input", "execute"); return NULL; } @@ -74,11 +74,11 @@ static QObject *do_qmp_dispatch(QObject *request, Error **errp) command = qdict_get_str(dict, "execute"); cmd = qmp_find_command(command); if (cmd == NULL) { - error_set(errp, /* QERR_COMMAND_NOT_FOUND */ 9, "The command name=%s has not been found", command); + error_set(errp, QERR_COMMAND_NOT_FOUND, "The command name=%s has not been found", command); return NULL; } if (!cmd->enabled) { - error_set(errp, /* QERR_COMMAND_DISABLED */ 8, "The command name=%s has been disabled for this instance", command); + error_set(errp, QERR_COMMAND_DISABLED, "The command name=%s has been disabled for this instance", command); return NULL; } diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c index 351a4a6..929b6e4 100644 --- a/qapi/qmp-input-visitor.c +++ b/qapi/qmp-input-visitor.c @@ -70,7 +70,7 @@ static void qmp_input_push(QmpInputVisitor *qiv, QObject *obj, Error **errp) GHashTable *h; if (qiv->nb_stack >= QIV_STACK_SIZE) { - error_set(errp, /* QERR_BUFFER_OVERRUN */ 5, "An internal buffer overran"); + error_set(errp, QERR_BUFFER_OVERRUN, "An internal buffer overran"); return; } @@ -104,7 +104,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_INPUT_OBJECT_MEMBER */ 57, "QMP input object member 'member=%s' is unexpected", key); + error_set(errp, QERR_QMP_EXTRA_INPUT_OBJECT_MEMBER, "QMP input object member 'member=%s' is unexpected", key); } g_hash_table_unref(top_ht); } @@ -121,7 +121,7 @@ static void qmp_input_start_struct(Visitor *v, void **obj, const char *kind, Error *err = NULL; if (!qobj || qobject_type(qobj) != QTYPE_QDICT) { - error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "QDict"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "QDict"); return; } @@ -149,7 +149,7 @@ static void qmp_input_start_list(Visitor *v, const char *name, Error **errp) QObject *qobj = qmp_input_get_object(qiv, name); if (!qobj || qobject_type(qobj) != QTYPE_QLIST) { - error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "list"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "list"); return; } @@ -200,7 +200,7 @@ static void qmp_input_type_int(Visitor *v, int64_t *obj, const char *name, QObject *qobj = qmp_input_get_object(qiv, name); if (!qobj || qobject_type(qobj) != QTYPE_QINT) { - error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "integer"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "integer"); return; } @@ -214,7 +214,7 @@ static void qmp_input_type_bool(Visitor *v, bool *obj, const char *name, QObject *qobj = qmp_input_get_object(qiv, name); if (!qobj || qobject_type(qobj) != QTYPE_QBOOL) { - error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "boolean"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "boolean"); return; } @@ -228,7 +228,7 @@ static void qmp_input_type_str(Visitor *v, char **obj, const char *name, QObject *qobj = qmp_input_get_object(qiv, name); if (!qobj || qobject_type(qobj) != QTYPE_QSTRING) { - error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "string"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "string"); return; } @@ -243,7 +243,7 @@ static void qmp_input_type_number(Visitor *v, double *obj, const char *name, if (!qobj || (qobject_type(qobj) != QTYPE_QFLOAT && qobject_type(qobj) != QTYPE_QINT)) { - error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "number"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "number"); return; } diff --git a/qapi/string-input-visitor.c b/qapi/string-input-visitor.c index d0eba4e..e01237c 100644 --- a/qapi/string-input-visitor.c +++ b/qapi/string-input-visitor.c @@ -33,7 +33,7 @@ static void parse_type_int(Visitor *v, int64_t *obj, const char *name, val = strtoll(siv->string, &endp, 0); } if (!siv->string || errno || endp == siv->string || *endp) { - error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "integer"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "integer"); return; } @@ -60,7 +60,7 @@ static void parse_type_bool(Visitor *v, bool *obj, const char *name, } } - error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "boolean"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "boolean"); } static void parse_type_str(Visitor *v, char **obj, const char *name, @@ -70,7 +70,7 @@ static void parse_type_str(Visitor *v, char **obj, const char *name, if (siv->string) { *obj = g_strdup(siv->string); } else { - error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "string"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "string"); } } @@ -86,7 +86,7 @@ static void parse_type_number(Visitor *v, double *obj, const char *name, val = strtod(siv->string, &endp); } if (!siv->string || errno || endp == siv->string || *endp) { - error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "number"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name ? name : "null", "number"); return; } diff --git a/qemu-config.c b/qemu-config.c index 09c3be4..46d2158 100644 --- a/qemu-config.c +++ b/qemu-config.c @@ -654,7 +654,7 @@ static QemuOptsList *find_list(QemuOptsList **lists, const char *group, break; } if (lists[i] == NULL) { - error_set(errp, /* QERR_INVALID_OPTION_GROUP */ 29, "There is no option group 'group=%s'", group); + error_set(errp, QERR_INVALID_OPTION_GROUP, "There is no option group 'group=%s'", group); } return lists[i]; } diff --git a/qemu-ga.c b/qemu-ga.c index d1e2b0c..28d63e3 100644 --- a/qemu-ga.c +++ b/qemu-ga.c @@ -511,7 +511,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 */ 37, "Invalid JSON syntax"); + error_set(&err, QERR_JSON_PARSING, "Invalid JSON syntax"); } else { g_warning("failed to parse event: %s", error_get_pretty(err)); } @@ -531,7 +531,7 @@ static void process_event(JSONMessageParser *parser, QList *tokens) QDECREF(qdict); qdict = qdict_new(); g_warning("unrecognized payload format"); - error_set(&err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(&err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); qdict_put_obj(qdict, "error", error_get_qobject(err)); error_free(err); } diff --git a/qemu-option.c b/qemu-option.c index 0864a96..c7a73b7 100644 --- a/qemu-option.c +++ b/qemu-option.c @@ -178,7 +178,7 @@ 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 */ 33, "Parameter 'name=%s' expects expected=%s", name, "'on' or 'off'"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name, "'on' or 'off'"); } } else { *ret = 1; @@ -194,12 +194,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 */ 33, "Parameter 'name=%s' expects expected=%s", name, "a number"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name, "a number"); return; } *ret = number; } else { - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name, "a number"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name, "a number"); } } @@ -230,13 +230,13 @@ static void parse_option_size(const char *name, const char *value, *ret = (uint64_t) sizef; break; default: - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name, "a size"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name, "a size"); error_printf_unless_qmp("You may use k, M, G or T suffixes for " "kilobytes, megabytes, gigabytes and terabytes.\n"); return; } } else { - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", name, "a size"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", name, "a size"); } } @@ -629,7 +629,7 @@ static void opt_set(QemuOpts *opts, const char *name, const char *value, if (i == 0) { /* empty list -> allow any */; } else { - error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", name); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", name); return; } } @@ -761,14 +761,14 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id, if (id) { if (!id_wellformed(id)) { - error_set(errp, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "id", "an identifier"); + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "id", "an identifier"); error_printf_unless_qmp("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n"); return NULL; } opts = qemu_opts_find(list, id); if (opts != NULL) { if (fail_if_exists && !list->merge_lists) { - error_set(errp, /* QERR_DUPLICATE_ID */ 24, "Duplicate ID 'id=%s' for object=%s", id, list->name); + error_set(errp, QERR_DUPLICATE_ID, "Duplicate ID 'id=%s' for object=%s", id, list->name); return NULL; } else { return opts; @@ -1089,7 +1089,7 @@ void qemu_opts_validate(QemuOpts *opts, const QemuOptDesc *desc, Error **errp) } } if (desc[i].name == NULL) { - error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", opt->name); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", opt->name); return; } diff --git a/qemu-sockets.c b/qemu-sockets.c index 1051740..c65db33 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -120,7 +120,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp) if ((qemu_opt_get(opts, "host") == NULL) || (qemu_opt_get(opts, "port") == NULL)) { fprintf(stderr, "%s: host and/or port not specified\n", __FUNCTION__); - error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket"); + error_set(errp, QERR_SOCK_CREATE_FAILED, "Failed to create socket"); return -1; } pstrcpy(port, sizeof(port), qemu_opt_get(opts, "port")); @@ -139,7 +139,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp) if (rc != 0) { fprintf(stderr,"getaddrinfo(%s,%s): %s\n", addr, port, gai_strerror(rc)); - error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket"); + error_set(errp, QERR_SOCK_CREATE_FAILED, "Failed to create socket"); return -1; } @@ -153,7 +153,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp) fprintf(stderr,"%s: socket(%s): %s\n", __FUNCTION__, inet_strfamily(e->ai_family), strerror(errno)); if (!e->ai_next) { - error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket"); + error_set(errp, QERR_SOCK_CREATE_FAILED, "Failed to create socket"); } continue; } @@ -179,7 +179,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp) inet_strfamily(e->ai_family), uaddr, inet_getport(e), strerror(errno)); if (!e->ai_next) { - error_set(errp, /* QERR_SOCK_BIND_FAILED */ 60, "Failed to bind socket"); + error_set(errp, QERR_SOCK_BIND_FAILED, "Failed to bind socket"); } } } @@ -191,7 +191,7 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp) listen: if (listen(slisten,1) != 0) { - error_set(errp, /* QERR_SOCK_LISTEN_FAILED */ 64, "Failed to set socket to listening mode"); + error_set(errp, QERR_SOCK_LISTEN_FAILED, "Failed to set socket to listening mode"); perror("listen"); closesocket(slisten); freeaddrinfo(res); @@ -226,7 +226,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp) block = qemu_opt_get_bool(opts, "block", 0); if (addr == NULL || port == NULL) { fprintf(stderr, "inet_connect: host and/or port not specified\n"); - error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket"); + error_set(errp, QERR_SOCK_CREATE_FAILED, "Failed to create socket"); return -1; } @@ -239,7 +239,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp) if (0 != (rc = getaddrinfo(addr, port, &ai, &res))) { fprintf(stderr,"getaddrinfo(%s,%s): %s\n", addr, port, gai_strerror(rc)); - error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket"); + error_set(errp, QERR_SOCK_CREATE_FAILED, "Failed to create socket"); return -1; } @@ -274,7 +274,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp) #else if (!block && (rc == -EINPROGRESS)) { #endif - error_set(errp, /* QERR_SOCK_CONNECT_INPROGRESS */ 62, "Connection can not be completed immediately"); + error_set(errp, QERR_SOCK_CONNECT_INPROGRESS, "Connection can not be completed immediately"); } else if (rc < 0) { if (NULL == e->ai_next) fprintf(stderr, "%s: connect(%s,%s,%s,%s): %s\n", __FUNCTION__, @@ -287,7 +287,7 @@ int inet_connect_opts(QemuOpts *opts, Error **errp) freeaddrinfo(res); return sock; } - error_set(errp, /* QERR_SOCK_CONNECT_FAILED */ 61, "Failed to connect to socket"); + error_set(errp, QERR_SOCK_CONNECT_FAILED, "Failed to connect to socket"); freeaddrinfo(res); return -1; } @@ -479,7 +479,7 @@ int inet_listen(const char *str, char *ostr, int olen, } } } else { - error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket"); + error_set(errp, QERR_SOCK_CREATE_FAILED, "Failed to create socket"); } qemu_opts_del(opts); return sock; @@ -497,7 +497,7 @@ int inet_connect(const char *str, bool block, Error **errp) } sock = inet_connect_opts(opts, errp); } else { - error_set(errp, /* QERR_SOCK_CREATE_FAILED */ 63, "Failed to create socket"); + error_set(errp, QERR_SOCK_CREATE_FAILED, "Failed to create socket"); } qemu_opts_del(opts); return sock; diff --git a/qga/commands-posix.c b/qga/commands-posix.c index e881f3e..24a46a4 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -60,7 +60,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err) } else if (strcmp(mode, "reboot") == 0) { shutdown_flag = "-r"; } else { - error_set(err, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "mode", "halt|powerdown|reboot"); + error_set(err, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "mode", "halt|powerdown|reboot"); return; } @@ -87,7 +87,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err) } exit_err: - error_set(err, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred"); + error_set(err, QERR_UNDEFINED_ERROR, "An undefined error has occurred"); } typedef struct GuestFileHandle { @@ -136,7 +136,7 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, E slog("guest-file-open called, filepath: %s, mode: %s", path, mode); fh = fopen(path, mode); if (!fh) { - error_set(err, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", path); + error_set(err, QERR_OPEN_FILE_FAILED, "Could not open 'filename=%s'", path); return -1; } @@ -147,7 +147,7 @@ int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, E ret = fcntl(fd, F_GETFL); ret = fcntl(fd, F_SETFL, ret | O_NONBLOCK); if (ret == -1) { - error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "fcntl() failed"); + error_set(err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "fcntl() failed"); fclose(fh); return -1; } @@ -164,13 +164,13 @@ void qmp_guest_file_close(int64_t handle, Error **err) slog("guest-file-close called, handle: %ld", handle); if (!gfh) { - error_set(err, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", "handle"); + error_set(err, QERR_FD_NOT_FOUND, "File descriptor named 'name=%s' not found", "handle"); return; } ret = fclose(gfh->fh); if (ret == -1) { - error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "fclose() failed"); + error_set(err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "fclose() failed"); return; } @@ -188,14 +188,14 @@ struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count, size_t read_count; if (!gfh) { - error_set(err, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", "handle"); + error_set(err, QERR_FD_NOT_FOUND, "File descriptor named 'name=%s' not found", "handle"); return NULL; } if (!has_count) { count = QGA_READ_COUNT_DEFAULT; } else if (count < 0) { - error_set(err, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "count"); + error_set(err, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", "count"); return NULL; } @@ -204,7 +204,7 @@ struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count, read_count = fread(buf, 1, count, fh); if (ferror(fh)) { slog("guest-file-read failed, handle: %ld", handle); - error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "fread() failed"); + error_set(err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "fread() failed"); } else { buf[read_count] = 0; read_data = g_malloc0(sizeof(GuestFileRead)); @@ -231,7 +231,7 @@ GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64, FILE *fh; if (!gfh) { - error_set(err, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", "handle"); + error_set(err, QERR_FD_NOT_FOUND, "File descriptor named 'name=%s' not found", "handle"); return NULL; } @@ -242,14 +242,14 @@ GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64, count = buf_len; } else if (count < 0 || count > buf_len) { g_free(buf); - error_set(err, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "count"); + error_set(err, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", "count"); return NULL; } write_count = fwrite(buf, 1, count, fh); if (ferror(fh)) { slog("guest-file-write failed, handle: %ld", handle); - error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "fwrite() error"); + error_set(err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "fwrite() error"); } else { write_data = g_malloc0(sizeof(GuestFileWrite)); write_data->count = write_count; @@ -270,14 +270,14 @@ struct GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset, int ret; if (!gfh) { - error_set(err, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", "handle"); + error_set(err, QERR_FD_NOT_FOUND, "File descriptor named 'name=%s' not found", "handle"); return NULL; } fh = gfh->fh; ret = fseek(fh, offset, whence); if (ret == -1) { - error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", strerror(errno)); + error_set(err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", strerror(errno)); } else { seek_data = g_malloc0(sizeof(GuestFileRead)); seek_data->position = ftell(fh); @@ -295,14 +295,14 @@ void qmp_guest_file_flush(int64_t handle, Error **err) int ret; if (!gfh) { - error_set(err, /* QERR_FD_NOT_FOUND */ 25, "File descriptor named 'name=%s' not found", "handle"); + error_set(err, QERR_FD_NOT_FOUND, "File descriptor named 'name=%s' not found", "handle"); return; } fh = gfh->fh; ret = fflush(fh); if (ret == EOF) { - error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", strerror(errno)); + error_set(err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", strerror(errno)); } } @@ -423,7 +423,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err) if (fd == -1) { sprintf(err_msg, "failed to open %s, %s", mount->dirname, strerror(errno)); - error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg); + error_set(err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", err_msg); goto error; } @@ -441,7 +441,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err) if (errno != EOPNOTSUPP) { sprintf(err_msg, "failed to freeze %s, %s", mount->dirname, strerror(errno)); - error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg); + error_set(err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", err_msg); close(fd); goto error; } @@ -473,7 +473,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err) QTAILQ_INIT(&mounts); ret = build_fs_mount_list(&mounts); if (ret) { - error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "failed to enumerate filesystems"); + error_set(err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "failed to enumerate filesystems"); return 0; } @@ -558,7 +558,7 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err) if (fd == -1) { sprintf(err_msg, "failed to open %s, %s", mount->dirname, strerror(errno)); - error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg); + error_set(err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", err_msg); goto error; } @@ -573,7 +573,7 @@ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err) if (errno != ENOTTY && errno != EOPNOTSUPP) { sprintf(err_msg, "failed to trim %s, %s", mount->dirname, strerror(errno)); - error_set(err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg); + error_set(err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", err_msg); close(fd); goto error; } @@ -656,7 +656,7 @@ static void bios_supports_mode(const char *pmutils_bin, const char *pmutils_arg, case SUSPEND_SUPPORTED: return; case SUSPEND_NOT_SUPPORTED: - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return; default: goto undef_err; @@ -664,7 +664,7 @@ static void bios_supports_mode(const char *pmutils_bin, const char *pmutils_arg, } undef_err: - error_set(err, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred"); + error_set(err, QERR_UNDEFINED_ERROR, "An undefined error has occurred"); } static void guest_suspend(const char *pmutils_bin, const char *sysfile_str, @@ -725,7 +725,7 @@ static void guest_suspend(const char *pmutils_bin, const char *sysfile_str, } exit_err: - error_set(err, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred"); + error_set(err, QERR_UNDEFINED_ERROR, "An undefined error has occurred"); } void qmp_guest_suspend_disk(Error **err) @@ -783,7 +783,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp) if (getifaddrs(&ifap) < 0) { snprintf(err_msg, sizeof(err_msg), "getifaddrs failed: %s", strerror(errno)); - error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg); + error_set(errp, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", err_msg); goto error; } @@ -821,7 +821,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp) if (sock == -1) { snprintf(err_msg, sizeof(err_msg), "failed to create socket: %s", strerror(errno)); - error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg); + error_set(errp, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", err_msg); goto error; } @@ -832,7 +832,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp) "failed to get MAC address of %s: %s", ifa->ifa_name, strerror(errno)); - error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg); + error_set(errp, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", err_msg); goto error; } @@ -845,7 +845,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp) (int) mac_addr[4], (int) mac_addr[5]) == -1) { snprintf(err_msg, sizeof(err_msg), "failed to format MAC: %s", strerror(errno)); - error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg); + error_set(errp, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", err_msg); goto error; } @@ -862,7 +862,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp) if (!inet_ntop(AF_INET, p, addr4, sizeof(addr4))) { snprintf(err_msg, sizeof(err_msg), "inet_ntop failed : %s", strerror(errno)); - error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg); + error_set(errp, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", err_msg); goto error; } @@ -884,7 +884,7 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp) if (!inet_ntop(AF_INET6, p, addr6, sizeof(addr6))) { snprintf(err_msg, sizeof(err_msg), "inet_ntop failed : %s", strerror(errno)); - error_set(errp, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", err_msg); + error_set(errp, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", err_msg); goto error; } @@ -937,22 +937,22 @@ error: void qmp_guest_suspend_disk(Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); } void qmp_guest_suspend_ram(Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); } void qmp_guest_suspend_hybrid(Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); } GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp) { - error_set(errp, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(errp, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return NULL; } @@ -962,21 +962,21 @@ GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp) GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return 0; } int64_t qmp_guest_fsfreeze_freeze(Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return 0; } int64_t qmp_guest_fsfreeze_thaw(Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return 0; } @@ -985,7 +985,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err) #if !defined(CONFIG_FSTRIM) void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return; } diff --git a/qga/commands-win32.c b/qga/commands-win32.c index d5bd012..f7f7989 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -36,7 +36,7 @@ static void acquire_privilege(const char *name, Error **err) TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY, &token)) { if (!LookupPrivilegeValue(NULL, name, &priv.Privileges[0].Luid)) { - error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "no luid for requested privilege"); + error_set(&local_err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "no luid for requested privilege"); goto out; } @@ -44,13 +44,13 @@ static void acquire_privilege(const char *name, Error **err) priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; if (!AdjustTokenPrivileges(token, FALSE, &priv, 0, NULL, 0)) { - error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "unable to acquire requested privilege"); + error_set(&local_err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "unable to acquire requested privilege"); goto out; } CloseHandle(token); } else { - error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "failed to open privilege token"); + error_set(&local_err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "failed to open privilege token"); } out: @@ -68,7 +68,7 @@ static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque, Error **e } HANDLE thread = CreateThread(NULL, 0, func, opaque, 0, NULL); if (!thread) { - error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "failed to dispatch asynchronous command"); + error_set(&local_err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "failed to dispatch asynchronous command"); error_propagate(err, local_err); } } @@ -86,7 +86,7 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err) } else if (strcmp(mode, "reboot") == 0) { shutdown_flag |= EWX_REBOOT; } else { - error_set(err, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "mode", "halt|powerdown|reboot"); + error_set(err, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "mode", "halt|powerdown|reboot"); return; } @@ -99,45 +99,45 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err) if (!ExitWindowsEx(shutdown_flag, SHTDN_REASON_FLAG_PLANNED)) { slog("guest-shutdown failed: %d", GetLastError()); - error_set(err, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred"); + error_set(err, QERR_UNDEFINED_ERROR, "An undefined error has occurred"); } } int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return 0; } void qmp_guest_file_close(int64_t handle, Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); } GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count, int64_t count, Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return 0; } GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64, bool has_count, int64_t count, Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return 0; } GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset, int64_t whence, Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return 0; } void qmp_guest_file_flush(int64_t handle, Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); } /* @@ -145,7 +145,7 @@ void qmp_guest_file_flush(int64_t handle, Error **err) */ GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return 0; } @@ -155,7 +155,7 @@ GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err) */ int64_t qmp_guest_fsfreeze_freeze(Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return 0; } @@ -164,7 +164,7 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err) */ int64_t qmp_guest_fsfreeze_thaw(Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return 0; } @@ -174,7 +174,7 @@ int64_t qmp_guest_fsfreeze_thaw(Error **err) */ void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return; } @@ -194,23 +194,23 @@ static void check_suspend_mode(GuestSuspendMode mode, Error **err) } ZeroMemory(&sys_pwr_caps, sizeof(sys_pwr_caps)); if (!GetPwrCapabilities(&sys_pwr_caps)) { - error_set(&local_err, /* QERR_QGA_COMMAND_FAILED */ 53, "Guest agent command failed, error was 'message=%s'", "failed to determine guest suspend capabilities"); + error_set(&local_err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "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 */ 53, "Guest agent command failed, error was 'message=%s'", "suspend-to-disk not supported by OS"); + error_set(&local_err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "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 */ 53, "Guest agent command failed, error was 'message=%s'", "suspend-to-ram not supported by OS"); + error_set(&local_err, QERR_QGA_COMMAND_FAILED, "Guest agent command failed, error was 'message=%s'", "suspend-to-ram not supported by OS"); } break; default: - error_set(&local_err, /* QERR_INVALID_PARAMETER_VALUE */ 33, "Parameter 'name=%s' expects expected=%s", "mode", "GuestSuspendMode"); + error_set(&local_err, QERR_INVALID_PARAMETER_VALUE, "Parameter 'name=%s' expects expected=%s", "mode", "GuestSuspendMode"); } out: @@ -262,12 +262,12 @@ void qmp_guest_suspend_ram(Error **err) void qmp_guest_suspend_hybrid(Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); } GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **err) { - error_set(err, /* QERR_UNSUPPORTED */ 68, "this feature or command is not currently supported"); + error_set(err, QERR_UNSUPPORTED, "this feature or command is not currently supported"); return NULL; } diff --git a/qmp.c b/qmp.c index 562706f..fce58f9 100644 --- a/qmp.c +++ b/qmp.c @@ -108,7 +108,7 @@ void qmp_cpu(int64_t index, Error **errp) defined in the VNC subsystem */ VncInfo *qmp_query_vnc(Error **errp) { - error_set(errp, /* QERR_FEATURE_DISABLED */ 27, "The feature 'name=%s' is not enabled", "vnc"); + error_set(errp, QERR_FEATURE_DISABLED, "The feature 'name=%s' is not enabled", "vnc"); return NULL; }; #endif @@ -120,7 +120,7 @@ VncInfo *qmp_query_vnc(Error **errp) to be available in the namespace if SPICE is not compiled in */ SpiceInfo *qmp_query_spice(Error **errp) { - error_set(errp, /* QERR_COMMAND_NOT_FOUND */ 9, "The command name=%s has not been found", "query-spice"); + error_set(errp, QERR_COMMAND_NOT_FOUND, "The command name=%s has not been found", "query-spice"); return NULL; }; #endif @@ -135,7 +135,7 @@ static void encrypted_bdrv_it(void *opaque, BlockDriverState *bs) Error **err = opaque; if (!error_is_set(err) && bdrv_key_required(bs)) { - error_set(err, /* QERR_DEVICE_ENCRYPTED */ 10, "Device 'device=%s' is encrypted (filename=filename=%s)", bdrv_get_device_name(bs), bdrv_get_encrypted_filename(bs)); + error_set(err, QERR_DEVICE_ENCRYPTED, "Device 'device=%s' is encrypted (filename=filename=%s)", bdrv_get_device_name(bs), bdrv_get_encrypted_filename(bs)); } } @@ -144,11 +144,11 @@ void qmp_cont(Error **errp) Error *local_err = NULL; if (runstate_check(RUN_STATE_INMIGRATE)) { - error_set(errp, /* QERR_MIGRATION_EXPECTED */ 40, "An incoming migration is expected before this command can be executed"); + error_set(errp, QERR_MIGRATION_EXPECTED, "An incoming migration is expected before this command can be executed"); return; } else if (runstate_check(RUN_STATE_INTERNAL_ERROR) || runstate_check(RUN_STATE_SHUTDOWN)) { - error_set(errp, /* QERR_RESET_REQUIRED */ 58, "Resetting the Virtual Machine is required"); + error_set(errp, QERR_RESET_REQUIRED, "Resetting the Virtual Machine is required"); return; } else if (runstate_check(RUN_STATE_SUSPENDED)) { return; @@ -178,7 +178,7 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp) obj = object_resolve_path(path, &ambiguous); if (obj == NULL) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", path); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", path); return NULL; } @@ -207,7 +207,7 @@ int qmp_qom_set(Monitor *mon, const QDict *qdict, QObject **ret) obj = object_resolve_path(path, NULL); if (!obj) { - error_set(&local_err, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", path); + error_set(&local_err, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", path); goto out; } @@ -232,7 +232,7 @@ int qmp_qom_get(Monitor *mon, const QDict *qdict, QObject **ret) obj = object_resolve_path(path, NULL); if (!obj) { - error_set(&local_err, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", path); + error_set(&local_err, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", path); goto out; } @@ -263,7 +263,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 */ 30, "Invalid parameter 'name=%s'", "connected"); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", "connected"); return; } } @@ -271,13 +271,13 @@ void qmp_set_password(const char *protocol, const char *password, if (strcmp(protocol, "spice") == 0) { if (!using_spice) { /* correct one? spice isn't a device ,,, */ - error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", "spice"); + error_set(errp, QERR_DEVICE_NOT_ACTIVE, "Device 'device=%s' has not been activated", "spice"); return; } rc = qemu_spice_set_passwd(password, fail_if_connected, disconnect_if_connected); if (rc != 0) { - error_set(errp, /* QERR_SET_PASSWD_FAILED */ 59, "Could not set password"); + error_set(errp, QERR_SET_PASSWD_FAILED, "Could not set password"); } return; } @@ -285,19 +285,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 */ 30, "Invalid parameter 'name=%s'", "connected"); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", "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 */ 59, "Could not set password"); + error_set(errp, QERR_SET_PASSWD_FAILED, "Could not set password"); } return; } - error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "protocol"); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", "protocol"); } void qmp_expire_password(const char *protocol, const char *whenstr, @@ -319,12 +319,12 @@ void qmp_expire_password(const char *protocol, const char *whenstr, if (strcmp(protocol, "spice") == 0) { if (!using_spice) { /* correct one? spice isn't a device ,,, */ - error_set(errp, /* QERR_DEVICE_NOT_ACTIVE */ 20, "Device 'device=%s' has not been activated", "spice"); + error_set(errp, QERR_DEVICE_NOT_ACTIVE, "Device 'device=%s' has not been activated", "spice"); return; } rc = qemu_spice_set_pw_expire(when); if (rc != 0) { - error_set(errp, /* QERR_SET_PASSWD_FAILED */ 59, "Could not set password"); + error_set(errp, QERR_SET_PASSWD_FAILED, "Could not set password"); } return; } @@ -332,26 +332,26 @@ 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 */ 59, "Could not set password"); + error_set(errp, QERR_SET_PASSWD_FAILED, "Could not set password"); } return; } - error_set(errp, /* QERR_INVALID_PARAMETER */ 30, "Invalid parameter 'name=%s'", "protocol"); + error_set(errp, QERR_INVALID_PARAMETER, "Invalid parameter 'name=%s'", "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 */ 59, "Could not set password"); + error_set(errp, QERR_SET_PASSWD_FAILED, "Could not set password"); } } static void qmp_change_vnc_listen(const char *target, Error **err) { if (vnc_display_open(NULL, target) < 0) { - error_set(err, /* QERR_VNC_SERVER_FAILED */ 70, "Could not start VNC server on target=%s", target); + error_set(err, QERR_VNC_SERVER_FAILED, "Could not start VNC server on target=%s", target); } } @@ -360,7 +360,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 */ 42, "Parameter 'name=%s' is missing", "password"); + error_set(errp, QERR_MISSING_PARAMETER, "Parameter 'name=%s' is missing", "password"); } else { qmp_change_vnc_password(arg, errp); } @@ -371,12 +371,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 */ 27, "The feature 'name=%s' is not enabled", "vnc"); + error_set(errp, QERR_FEATURE_DISABLED, "The feature 'name=%s' is not enabled", "vnc"); } static void qmp_change_vnc(const char *target, bool has_arg, const char *arg, Error **errp) { - error_set(errp, /* QERR_FEATURE_DISABLED */ 27, "The feature 'name=%s' is not enabled", "vnc"); + error_set(errp, QERR_FEATURE_DISABLED, "The feature 'name=%s' is not enabled", "vnc"); } #endif /* !CONFIG_VNC */ diff --git a/qom/object.c b/qom/object.c index 21b7dba..6ea7dae 100644 --- a/qom/object.c +++ b/qom/object.c @@ -683,7 +683,7 @@ ObjectProperty *object_property_find(Object *obj, const char *name, } } - error_set(errp, /* QERR_PROPERTY_NOT_FOUND */ 47, "Property 'device=%s.property=%s' not found", "", name); + error_set(errp, QERR_PROPERTY_NOT_FOUND, "Property 'device=%s.property=%s' not found", "", name); return NULL; } @@ -714,7 +714,7 @@ void object_property_get(Object *obj, Visitor *v, const char *name, } if (!prop->get) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); } else { prop->get(obj, v, prop->opaque, name, errp); } @@ -729,7 +729,7 @@ void object_property_set(Object *obj, Visitor *v, const char *name, } if (!prop->set) { - error_set(errp, /* QERR_PERMISSION_DENIED */ 46, "Insufficient permission to perform this operation"); + error_set(errp, QERR_PERMISSION_DENIED, "Insufficient permission to perform this operation"); } else { prop->set(obj, v, prop->opaque, name, errp); } @@ -756,7 +756,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 */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name, "string"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name, "string"); retval = NULL; } else { retval = g_strdup(qstring_get_str(qstring)); @@ -782,7 +782,7 @@ Object *object_property_get_link(Object *obj, const char *name, if (str && *str) { target = object_resolve_path(str, NULL); if (!target) { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", str); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", str); } } @@ -811,7 +811,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 */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name, "boolean"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name, "boolean"); retval = false; } else { retval = qbool_get_int(qbool); @@ -842,7 +842,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 */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name, "int"); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name, "int"); retval = -1; } else { retval = qint_get_int(qint); @@ -979,16 +979,16 @@ static void object_set_link_property(Object *obj, Visitor *v, void *opaque, target = object_resolve_path_type(path, target_type, &ambiguous); if (ambiguous) { - error_set(errp, /* QERR_AMBIGUOUS_PATH */ 1, "Path 'path=%s' does not uniquely identify an object", path); + error_set(errp, QERR_AMBIGUOUS_PATH, "Path 'path=%s' does not uniquely identify an object", path); } else if (target) { object_ref(target); *child = target; } else { target = object_resolve_path(path, &ambiguous); if (target || ambiguous) { - error_set(errp, /* QERR_INVALID_PARAMETER_TYPE */ 32, "Invalid parameter type for 'name=%s', expected: expected=%s", name, target_type); + error_set(errp, QERR_INVALID_PARAMETER_TYPE, "Invalid parameter type for 'name=%s', expected: expected=%s", name, target_type); } else { - error_set(errp, /* QERR_DEVICE_NOT_FOUND */ 22, "Device 'device=%s' not found", path); + error_set(errp, QERR_DEVICE_NOT_FOUND, "Device 'device=%s' not found", path); } } g_free(target_type); diff --git a/savevm.c b/savevm.c index 71ae5a7..495e0a7 100644 --- a/savevm.c +++ b/savevm.c @@ -1555,7 +1555,7 @@ bool qemu_savevm_state_blocked(Error **errp) QTAILQ_FOREACH(se, &savevm_handlers, entry) { if (se->no_migrate) { - error_set(errp, /* QERR_MIGRATION_NOT_SUPPORTED */ 41, "State blocked by non-migratable device 'device=%s'", se->idstr); + error_set(errp, QERR_MIGRATION_NOT_SUPPORTED, "State blocked by non-migratable device 'device=%s'", se->idstr); return true; } } @@ -2182,13 +2182,13 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp) f = qemu_fopen(filename, "wb"); if (!f) { - error_set(errp, /* QERR_OPEN_FILE_FAILED */ 45, "Could not open 'filename=%s'", filename); + error_set(errp, QERR_OPEN_FILE_FAILED, "Could not open 'filename=%s'", filename); goto the_end; } ret = qemu_save_device_state(f); qemu_fclose(f); if (ret < 0) { - error_set(errp, /* QERR_IO_ERROR */ 35, "An IO error has occurred"); + error_set(errp, QERR_IO_ERROR, "An IO error has occurred"); } the_end: diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 7da4dfc..6009bb8 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -631,7 +631,7 @@ static void x86_cpuid_version_set_family(Object *obj, Visitor *v, void *opaque, return; } if (value < min || value > max) { - error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max); + error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max); return; } @@ -669,7 +669,7 @@ static void x86_cpuid_version_set_model(Object *obj, Visitor *v, void *opaque, return; } if (value < min || value > max) { - error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max); + error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max); return; } @@ -704,7 +704,7 @@ static void x86_cpuid_version_set_stepping(Object *obj, Visitor *v, return; } if (value < min || value > max) { - error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max); + error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max); return; } @@ -769,7 +769,7 @@ static void x86_cpuid_set_vendor(Object *obj, const char *value, int i; if (strlen(value) != 12) { - error_set(errp, /* QERR_PROPERTY_VALUE_BAD */ 48, "Property 'device=%s.property=%s' doesn't take value 'value=%s'", "", "vendor", value); + error_set(errp, QERR_PROPERTY_VALUE_BAD, "Property 'device=%s.property=%s' doesn't take value 'value=%s'", "", "vendor", value); return; } @@ -844,7 +844,7 @@ static void x86_cpuid_set_tsc_freq(Object *obj, Visitor *v, void *opaque, return; } if (value < min || value > max) { - error_set(errp, /* QERR_PROPERTY_VALUE_OUT_OF_RANGE */ 52, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max); + error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, "Property 'device=%s.property=%s' doesn't take value value=%"PRId64" (minimum: min=%"PRId64", maximum: max=%"PRId64")", "", name ? name : "null", value, min, max); return; } diff --git a/ui/vnc.c b/ui/vnc.c index c448f09..f622d81 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -373,7 +373,7 @@ VncInfo *qmp_query_vnc(Error **errp) if (getsockname(vnc_display->lsock, (struct sockaddr *)&sa, &salen) == -1) { - error_set(errp, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred"); + error_set(errp, QERR_UNDEFINED_ERROR, "An undefined error has occurred"); goto out_error; } @@ -381,7 +381,7 @@ VncInfo *qmp_query_vnc(Error **errp) host, sizeof(host), serv, sizeof(serv), NI_NUMERICHOST | NI_NUMERICSERV) < 0) { - error_set(errp, /* QERR_UNDEFINED_ERROR */ 66, "An undefined error has occurred"); + error_set(errp, QERR_UNDEFINED_ERROR, "An undefined error has occurred"); goto out_error; } -- 1.7.11.2.249.g31c7954.dirty