diff --git a/backends/rng-egd.c b/backends/rng-egd.c index 2962795a8fc0218fcf52e7d75cb61715bb321cdf..849bd7ab61a45023bb5e66781e67e9ece59c91af 100644 --- a/backends/rng-egd.c +++ b/backends/rng-egd.c @@ -147,7 +147,8 @@ static void rng_egd_opened(RngBackend *b, Error **errp) s->chr = qemu_chr_find(s->chr_name); if (s->chr == NULL) { - error_set(errp, QERR_DEVICE_NOT_FOUND, s->chr_name); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", s->chr_name); return; } diff --git a/blockdev-nbd.c b/blockdev-nbd.c index 0d9df47ce47d1225f54ee33bb87b3437e90d9ef8..128e810461d8d564827575bc5196fbeeb08dff1d 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -91,7 +91,8 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable, blk = blk_by_name(device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); return; } if (!blk_is_inserted(blk)) { diff --git a/blockdev.c b/blockdev.c index 3950e90edd6e37c5cc793e141b32ee9501a9bb95..c54bb70e9436075c00b665b8f6c2775303813741 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1111,7 +1111,8 @@ SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device, blk = blk_by_name(device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); return NULL; } bs = blk_bs(blk); @@ -1300,7 +1301,8 @@ static void internal_snapshot_prepare(BlkTransactionState *common, /* 2. check for validation */ blk = blk_by_name(device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); return; } bs = blk_bs(blk); @@ -1580,7 +1582,8 @@ static void drive_backup_prepare(BlkTransactionState *common, Error **errp) blk = blk_by_name(backup->device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, backup->device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", backup->device); return; } bs = blk_bs(blk); @@ -1850,7 +1853,8 @@ void qmp_eject(const char *device, bool has_force, bool force, Error **errp) blk = blk_by_name(device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); return; } @@ -1910,7 +1914,8 @@ void qmp_change_blockdev(const char *device, const char *filename, blk = blk_by_name(device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); return; } bs = blk_bs(blk); @@ -1971,7 +1976,8 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd, blk = blk_by_name(device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); return; } bs = blk_bs(blk); @@ -2291,7 +2297,8 @@ void qmp_block_stream(const char *device, blk = blk_by_name(device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); return; } bs = blk_bs(blk); @@ -2365,7 +2372,8 @@ void qmp_block_commit(const char *device, * scenario in which all optional arguments are omitted. */ blk = blk_by_name(device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); return; } bs = blk_bs(blk); @@ -2477,7 +2485,8 @@ void qmp_drive_backup(const char *device, const char *target, blk = blk_by_name(device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); return; } bs = blk_bs(blk); @@ -2691,7 +2700,8 @@ void qmp_drive_mirror(const char *device, const char *target, blk = blk_by_name(device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); return; } bs = blk_bs(blk); @@ -2957,7 +2967,8 @@ void qmp_change_backing_file(const char *device, blk = blk_by_name(device); if (!blk) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); return; } bs = blk_bs(blk); diff --git a/hmp.c b/hmp.c index 1375b0d85cbf6de637258f8aa9f279fb08830d7d..bf9fbeedb2bb71ad657e925ab0824bc33edcfadf 100644 --- a/hmp.c +++ b/hmp.c @@ -1867,7 +1867,8 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict) if (blk) { qemuio_command(blk, command); } else { - error_set(&err, QERR_DEVICE_NOT_FOUND, device); + error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device); } hmp_handle_error(mon, &err); @@ -1995,7 +1996,8 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict) obj = object_resolve_path(path, &ambiguous); if (obj == NULL) { - error_set(&err, QERR_DEVICE_NOT_FOUND, path); + error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", path); } else { if (ambiguous) { monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path); diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index 6468e40098ab517d522875bbd6c7aa385cfd043d..2841344bcbf1f852a9ab3a7550ccc7c9b91ce813 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -55,9 +55,6 @@ void qerror_report_err(Error *err); #define QERR_DEVICE_NO_HOTPLUG \ ERROR_CLASS_GENERIC_ERROR, "Device '%s' does not support hotplugging" -#define QERR_DEVICE_NOT_FOUND \ - ERROR_CLASS_DEVICE_NOT_FOUND, "Device '%s' not found" - #define QERR_FD_NOT_FOUND \ ERROR_CLASS_GENERIC_ERROR, "File descriptor named '%s' not found" diff --git a/net/net.c b/net/net.c index 85c4b20d8f1343b512ba89bf8dd8b4ec3441c65e..7b5f519293b29af1a5d3c29d545b0af776ce1015 100644 --- a/net/net.c +++ b/net/net.c @@ -1127,7 +1127,8 @@ void qmp_netdev_del(const char *id, Error **errp) nc = qemu_find_netdev(id); if (!nc) { - error_set(errp, QERR_DEVICE_NOT_FOUND, id); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", id); return; } @@ -1238,7 +1239,8 @@ void qmp_set_link(const char *name, bool up, Error **errp) MAX_QUEUE_NUM); if (queues == 0) { - error_set(errp, QERR_DEVICE_NOT_FOUND, name); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", name); return; } nc = ncs[0]; diff --git a/qdev-monitor.c b/qdev-monitor.c index e1223b27f4195437ab66b0bf765fe6dffb8bfac2..31c6398286f9b943d6b89c4ec1d9bdc39faa5fea 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -457,7 +457,8 @@ static BusState *qbus_find(const char *path, Error **errp) pos += len; dev = qbus_find_dev(bus, elem); if (!dev) { - error_set(errp, QERR_DEVICE_NOT_FOUND, elem); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", elem); #if 0 /* conversion from qerror_report() to error_set() broke this: */ if (!monitor_cur_is_qmp()) { qbus_list_dev(bus); @@ -793,7 +794,8 @@ void qmp_device_del(const char *id, Error **errp) g_free(path); if (!obj) { - error_set(errp, QERR_DEVICE_NOT_FOUND, id); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", id); return; } diff --git a/qmp.c b/qmp.c index f2981de706a712b9e575474c9da1552130b93ab9..87d1d862ba72d05aab30bd6c11f160951cf76a85 100644 --- a/qmp.c +++ b/qmp.c @@ -206,7 +206,8 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp) if (ambiguous) { error_setg(errp, "Path '%s' is ambiguous", path); } else { - error_set(errp, QERR_DEVICE_NOT_FOUND, path); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", path); } return NULL; } @@ -236,7 +237,8 @@ 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, path); + error_set(&local_err, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", path); goto out; } @@ -261,7 +263,8 @@ 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, path); + error_set(&local_err, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", path); goto out; } @@ -518,7 +521,8 @@ DevicePropertyInfoList *qmp_device_list_properties(const char *typename, klass = object_class_by_name(typename); if (klass == NULL) { - error_set(errp, QERR_DEVICE_NOT_FOUND, typename); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", typename); return NULL; } diff --git a/qom/object.c b/qom/object.c index 7ed17bc779d6d61dc9a9f0fef1786122aee28ab3..5dcb8214e63f2880845a1304e3fe0885b72ab31c 100644 --- a/qom/object.c +++ b/qom/object.c @@ -999,7 +999,8 @@ 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, str); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", str); } } @@ -1305,7 +1306,8 @@ static Object *object_resolve_link(Object *obj, const char *name, if (target || ambiguous) { error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, target_type); } else { - error_set(errp, QERR_DEVICE_NOT_FOUND, path); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", path); } target = NULL; } diff --git a/ui/input.c b/ui/input.c index eeeabe844c08b872fcece8c595f4fb3ac0b80e5b..e96e1ea0f02fd2c50df54fb6ab6a7bae4601f0b0 100644 --- a/ui/input.c +++ b/ui/input.c @@ -84,7 +84,8 @@ void qemu_input_handler_bind(QemuInputHandlerState *s, dev = qdev_find_recursive(sysbus_get_default(), device_id); if (dev == NULL) { - error_set(errp, QERR_DEVICE_NOT_FOUND, device_id); + error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND, + "Device '%s' not found", device_id); return; }