From 2f7920166d1aa402104d7b30d0225e71588f91f9 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 18 Feb 2010 16:24:31 +0100 Subject: error: Move qemu_error & friends into their own header --- qerror.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index 2f657f4f7b..a418bde37f 100644 --- a/qerror.c +++ b/qerror.c @@ -12,8 +12,8 @@ #include "qjson.h" #include "qerror.h" #include "qstring.h" -#include "sysemu.h" #include "qemu-common.h" +#include "qemu-error.h" static void qerror_destroy_obj(QObject *obj); -- cgit v1.2.3 From 1ecda02b24a13f501e747b8442934829d82698ae Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 18 Feb 2010 17:25:24 +0100 Subject: error: Replace qemu_error() by error_report() error_report() terminates the message with a newline. Strip it it from its arguments. This fixes a few error messages lacking a newline: net_handle_fd_param()'s "No file descriptor named %s found", and tap_open()'s "vnet_hdr=1 requested, but no kernel support for IFF_VNET_HDR available" (all three versions). There's one place that passes arguments without newlines intentionally: load_vmstate(). Fix it up. --- qerror.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index a418bde37f..a6f021395a 100644 --- a/qerror.c +++ b/qerror.c @@ -318,13 +318,13 @@ QString *qerror_human(const QError *qerror) * qerror_print(): Print QError data * * This function will print the member 'desc' of the specified QError object, - * it uses qemu_error() for this, so that the output is routed to the right + * it uses error_report() for this, so that the output is routed to the right * place (ie. stderr or Monitor's device). */ void qerror_print(const QError *qerror) { QString *qstring = qerror_human(qerror); - qemu_error("%s\n", qstring_get_str(qstring)); + error_report("%s", qstring_get_str(qstring)); QDECREF(qstring); } -- cgit v1.2.3 From 827b08139c8ba97c18bda19e4893fdf26878b531 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Thu, 18 Feb 2010 19:46:49 +0100 Subject: error: Infrastructure to track locations for error reporting New struct Location holds a location. So far, the only location is LOC_NONE, so this doesn't do anything useful yet. Passing the current location all over the place would be too cumbersome. Hide it away in static cur_loc instead, and provide accessors. Print it in error_report(). Store it in QError, and print it in qerror_print(). Store it in QemuOpt, for use by qemu_opts_foreach(). This makes error_report() do the right thing when it runs within qemu_opts_foreach(). We may still have to store it in other data structures holding user input for better error messages. Left for another day. --- qerror.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index a6f021395a..b400480611 100644 --- a/qerror.c +++ b/qerror.c @@ -224,6 +224,7 @@ QError *qerror_from_info(const char *file, int linenr, const char *func, QError *qerr; qerr = qerror_new(); + loc_save(&qerr->loc); qerr->linenr = linenr; qerr->file = file; qerr->func = func; @@ -321,10 +322,12 @@ QString *qerror_human(const QError *qerror) * it uses error_report() for this, so that the output is routed to the right * place (ie. stderr or Monitor's device). */ -void qerror_print(const QError *qerror) +void qerror_print(QError *qerror) { QString *qstring = qerror_human(qerror); + loc_push_restore(&qerror->loc); error_report("%s", qstring_get_str(qstring)); + loc_pop(&qerror->loc); QDECREF(qstring); } -- cgit v1.2.3 From fc5469d87b54bfbe06b76a9bb9da6589c326e0b2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 17:42:46 +0100 Subject: error: Polish human-readable error descriptions Also put error definitions in alphabetical order --- qerror.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index b400480611..41ff946c84 100644 --- a/qerror.c +++ b/qerror.c @@ -46,43 +46,39 @@ static const QErrorStringTable qerror_table[] = { }, { .error_fmt = QERR_DEVICE_ENCRYPTED, - .desc = "The %(device) is encrypted", + .desc = "Device '%(device)' is encrypted", }, { .error_fmt = QERR_DEVICE_LOCKED, - .desc = "Device %(device) is locked", + .desc = "Device '%(device)' is locked", }, { .error_fmt = QERR_DEVICE_NOT_ACTIVE, - .desc = "The %(device) device has not been activated by the guest", + .desc = "Device '%(device)' has not been activated by the guest", }, { .error_fmt = QERR_DEVICE_NOT_FOUND, - .desc = "The %(device) device has not been found", + .desc = "Device '%(device)' not found", }, { .error_fmt = QERR_DEVICE_NOT_REMOVABLE, - .desc = "Device %(device) is not removable", + .desc = "Device '%(device)' is not removable", }, { .error_fmt = QERR_FD_NOT_FOUND, - .desc = "Failed to find file descriptor named %(name)", + .desc = "File descriptor named '%(name)' not found", }, { .error_fmt = QERR_FD_NOT_SUPPLIED, .desc = "No file descriptor supplied via SCM_RIGHTS", }, - { - .error_fmt = QERR_OPEN_FILE_FAILED, - .desc = "Could not open '%(filename)'", - }, { .error_fmt = QERR_INVALID_BLOCK_FORMAT, - .desc = "Invalid block format %(name)", + .desc = "Invalid block format '%(name)'", }, { .error_fmt = QERR_INVALID_PARAMETER, - .desc = "Invalid parameter %(name)", + .desc = "Invalid parameter '%(name)'", }, { .error_fmt = QERR_INVALID_PARAMETER_TYPE, @@ -90,7 +86,7 @@ static const QErrorStringTable qerror_table[] = { }, { .error_fmt = QERR_INVALID_PASSWORD, - .desc = "The entered password is invalid", + .desc = "Password incorrect", }, { .error_fmt = QERR_JSON_PARSING, @@ -102,7 +98,11 @@ static const QErrorStringTable qerror_table[] = { }, { .error_fmt = QERR_MISSING_PARAMETER, - .desc = "Parameter %(name) is missing", + .desc = "Parameter '%(name)' is missing", + }, + { + .error_fmt = QERR_OPEN_FILE_FAILED, + .desc = "Could not open '%(filename)'", }, { .error_fmt = QERR_QMP_BAD_INPUT_OBJECT, -- cgit v1.2.3 From c58a35f8e32af621fab2b4f9c868f47971f67e59 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 13:11:41 +0100 Subject: error: New QERR_PROPERTY_NOT_FOUND --- qerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index 41ff946c84..4de1039544 100644 --- a/qerror.c +++ b/qerror.c @@ -104,6 +104,10 @@ static const QErrorStringTable qerror_table[] = { .error_fmt = QERR_OPEN_FILE_FAILED, .desc = "Could not open '%(filename)'", }, + { + .error_fmt = QERR_PROPERTY_NOT_FOUND, + .desc = "Property '%(device).%(property)' not found", + }, { .error_fmt = QERR_QMP_BAD_INPUT_OBJECT, .desc = "Bad QMP input object", -- cgit v1.2.3 From 06b4a703e0e87034a8b122f6ffc50c732e7ceddd Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 13:17:58 +0100 Subject: error: New QERR_PROPERTY_VALUE_BAD --- qerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index 4de1039544..62bb00fb1b 100644 --- a/qerror.c +++ b/qerror.c @@ -108,6 +108,10 @@ static const QErrorStringTable qerror_table[] = { .error_fmt = QERR_PROPERTY_NOT_FOUND, .desc = "Property '%(device).%(property)' not found", }, + { + .error_fmt = QERR_PROPERTY_VALUE_BAD, + .desc = "Property '%(device).%(property)' doesn't take value '%(value)'", + }, { .error_fmt = QERR_QMP_BAD_INPUT_OBJECT, .desc = "Bad QMP input object", -- cgit v1.2.3 From 9c5eff958d527d1803114a6f78d086fb313b9bd2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 16 Mar 2010 17:40:48 +0100 Subject: error: New QERR_PROPERTY_VALUE_IN_USE --- qerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index 62bb00fb1b..6b59388292 100644 --- a/qerror.c +++ b/qerror.c @@ -112,6 +112,10 @@ static const QErrorStringTable qerror_table[] = { .error_fmt = QERR_PROPERTY_VALUE_BAD, .desc = "Property '%(device).%(property)' doesn't take value '%(value)'", }, + { + .error_fmt = QERR_PROPERTY_VALUE_IN_USE, + .desc = "Property '%(device).%(property)' can't take value '%(value)', it's in use", + }, { .error_fmt = QERR_QMP_BAD_INPUT_OBJECT, .desc = "Bad QMP input object", -- cgit v1.2.3 From 84745d68e7338271f0f7ec567ab52abf20a0ce9c Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 16 Mar 2010 17:44:38 +0100 Subject: error: New QERR_PROPERTY_VALUE_NOT_FOUND --- qerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index 6b59388292..d8eb32998a 100644 --- a/qerror.c +++ b/qerror.c @@ -116,6 +116,10 @@ static const QErrorStringTable qerror_table[] = { .error_fmt = QERR_PROPERTY_VALUE_IN_USE, .desc = "Property '%(device).%(property)' can't take value '%(value)', it's in use", }, + { + .error_fmt = QERR_PROPERTY_VALUE_NOT_FOUND, + .desc = "Property '%(device).%(property)' can't find value '%(value)'", + }, { .error_fmt = QERR_QMP_BAD_INPUT_OBJECT, .desc = "Bad QMP input object", -- cgit v1.2.3 From 7bbd823701cf4447b5c23430f1ad78ce501793b4 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 18:05:39 +0100 Subject: error: New QERR_BUS_NOT_FOUND --- qerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index d8eb32998a..75f7b58465 100644 --- a/qerror.c +++ b/qerror.c @@ -40,6 +40,10 @@ static const QType qerror_type = { * "running out of foo: %(foo)%%" */ static const QErrorStringTable qerror_table[] = { + { + .error_fmt = QERR_BUS_NOT_FOUND, + .desc = "Bus '%(bus)' not found", + }, { .error_fmt = QERR_COMMAND_NOT_FOUND, .desc = "The command %(name) has not been found", -- cgit v1.2.3 From 1ae787184025b7e890a666e0041024a3d92529ce Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 18:05:59 +0100 Subject: error: New QERR_DEVICE_MULTIPLE_BUSSES --- qerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index 75f7b58465..c14ec80b81 100644 --- a/qerror.c +++ b/qerror.c @@ -56,6 +56,10 @@ static const QErrorStringTable qerror_table[] = { .error_fmt = QERR_DEVICE_LOCKED, .desc = "Device '%(device)' is locked", }, + { + .error_fmt = QERR_DEVICE_MULTIPLE_BUSSES, + .desc = "Device '%(device)' has multiple child busses", + }, { .error_fmt = QERR_DEVICE_NOT_ACTIVE, .desc = "Device '%(device)' has not been activated by the guest", -- cgit v1.2.3 From 07574baf7b714a10e35b716b0eb6ede197adfca7 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 18:06:18 +0100 Subject: error: New QERR_DEVICE_NO_BUS --- qerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index c14ec80b81..b176d7c5ac 100644 --- a/qerror.c +++ b/qerror.c @@ -72,6 +72,10 @@ static const QErrorStringTable qerror_table[] = { .error_fmt = QERR_DEVICE_NOT_REMOVABLE, .desc = "Device '%(device)' is not removable", }, + { + .error_fmt = QERR_DEVICE_NO_BUS, + .desc = "Device '%(device)' has no child bus", + }, { .error_fmt = QERR_FD_NOT_FOUND, .desc = "File descriptor named '%(name)' not found", -- cgit v1.2.3 From 56e9f56309b7c77dfb328dbf450d04fd54ce4542 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 19:52:45 +0100 Subject: error: New QERR_BAD_BUS_FOR_DEVICE --- qerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index b176d7c5ac..345bfefe47 100644 --- a/qerror.c +++ b/qerror.c @@ -40,6 +40,10 @@ static const QType qerror_type = { * "running out of foo: %(foo)%%" */ static const QErrorStringTable qerror_table[] = { + { + .error_fmt = QERR_BAD_BUS_FOR_DEVICE, + .desc = "Device '%(device)' can't go on a %(bad_bus_type) bus", + }, { .error_fmt = QERR_BUS_NOT_FOUND, .desc = "Bus '%(bus)' not found", -- cgit v1.2.3 From 8eae73b5d7085b0f9b087033c328fdbbbcc6271d Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 19:53:36 +0100 Subject: error: New QERR_BUS_NO_HOTPLUG --- qerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index 345bfefe47..d0fc1ae8ba 100644 --- a/qerror.c +++ b/qerror.c @@ -48,6 +48,10 @@ static const QErrorStringTable qerror_table[] = { .error_fmt = QERR_BUS_NOT_FOUND, .desc = "Bus '%(bus)' not found", }, + { + .error_fmt = QERR_BUS_NO_HOTPLUG, + .desc = "Bus '%(bus)' does not support hotplugging", + }, { .error_fmt = QERR_COMMAND_NOT_FOUND, .desc = "The command %(name) has not been found", -- cgit v1.2.3 From 4d9a1a15214c01dcbff2d7c02cef027e80442d79 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 19:53:54 +0100 Subject: error: New QERR_DEVICE_INIT_FAILED --- qerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index d0fc1ae8ba..a369204588 100644 --- a/qerror.c +++ b/qerror.c @@ -60,6 +60,10 @@ static const QErrorStringTable qerror_table[] = { .error_fmt = QERR_DEVICE_ENCRYPTED, .desc = "Device '%(device)' is encrypted", }, + { + .error_fmt = QERR_DEVICE_INIT_FAILED, + .desc = "Device '%(device)' could not be initialized", + }, { .error_fmt = QERR_DEVICE_LOCKED, .desc = "Device '%(device)' is locked", -- cgit v1.2.3 From fab5767f90c96194f918d39af683fff3d9ea421a Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 19 Feb 2010 19:54:06 +0100 Subject: error: New QERR_NO_BUS_FOR_DEVICE --- qerror.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'qerror.c') diff --git a/qerror.c b/qerror.c index a369204588..26eb70472e 100644 --- a/qerror.c +++ b/qerror.c @@ -124,6 +124,10 @@ static const QErrorStringTable qerror_table[] = { .error_fmt = QERR_MISSING_PARAMETER, .desc = "Parameter '%(name)' is missing", }, + { + .error_fmt = QERR_NO_BUS_FOR_DEVICE, + .desc = "No '%(bus)' bus found for device '%(device)'", + }, { .error_fmt = QERR_OPEN_FILE_FAILED, .desc = "Could not open '%(filename)'", -- cgit v1.2.3