Message ID | 20230207075115.1525-11-armbru@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | error: Reduce qerror.h usage a bit more | expand |
On 7/2/23 08:51, Markus Armbruster wrote: > The QERR_ macros are leftovers from the days of "rich" error objects. > We've been trying to reduce their remaining use. > > Get rid of a use of QERR_FEATURE_DISABLED, and improve the slightly > awkward error message > > (qemu) info hotpluggable-cpus > Error: The feature 'query-hotpluggable-cpus' is not enabled > > to > > Error: machine does not support hot-plugging CPUs > > Signed-off-by: Markus Armbruster <armbru@redhat.com> > --- > hw/core/machine-qmp-cmds.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c > index a6ed3a63c3..2d904747c0 100644 > --- a/hw/core/machine-qmp-cmds.c > +++ b/hw/core/machine-qmp-cmds.c > @@ -16,7 +16,6 @@ > #include "qapi/error.h" > #include "qapi/qapi-builtin-visit.h" > #include "qapi/qapi-commands-machine.h" > -#include "qapi/qmp/qerror.h" > #include "qapi/qmp/qobject.h" > #include "qapi/qobject-input-visitor.h" > #include "qapi/type-helpers.h" > @@ -141,7 +140,7 @@ HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp) > MachineClass *mc = MACHINE_GET_CLASS(ms); > > if (!mc->has_hotpluggable_cpus) { > - error_setg(errp, QERR_FEATURE_DISABLED, "query-hotpluggable-cpus"); > + error_setg(errp, "machine does not support hot-plugging CPUs"); "hotplug CPUs" or "hot-pluggable CPUs"? > return NULL; > } >
Philippe Mathieu-Daudé <philmd@linaro.org> writes: > On 7/2/23 08:51, Markus Armbruster wrote: >> The QERR_ macros are leftovers from the days of "rich" error objects. >> We've been trying to reduce their remaining use. >> Get rid of a use of QERR_FEATURE_DISABLED, and improve the slightly >> awkward error message >> (qemu) info hotpluggable-cpus >> Error: The feature 'query-hotpluggable-cpus' is not enabled >> to >> Error: machine does not support hot-plugging CPUs >> Signed-off-by: Markus Armbruster <armbru@redhat.com> >> --- >> hw/core/machine-qmp-cmds.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c >> index a6ed3a63c3..2d904747c0 100644 >> --- a/hw/core/machine-qmp-cmds.c >> +++ b/hw/core/machine-qmp-cmds.c >> @@ -16,7 +16,6 @@ >> #include "qapi/error.h" >> #include "qapi/qapi-builtin-visit.h" >> #include "qapi/qapi-commands-machine.h" >> -#include "qapi/qmp/qerror.h" >> #include "qapi/qmp/qobject.h" >> #include "qapi/qobject-input-visitor.h" >> #include "qapi/type-helpers.h" >> @@ -141,7 +140,7 @@ HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp) >> MachineClass *mc = MACHINE_GET_CLASS(ms); >> if (!mc->has_hotpluggable_cpus) { >> - error_setg(errp, QERR_FEATURE_DISABLED, "query-hotpluggable-cpus"); >> + error_setg(errp, "machine does not support hot-plugging CPUs"); > > "hotplug CPUs" or "hot-pluggable CPUs"? I think "hotplug CPUs" is strictly worse than "hotpluggable CPUs", because "hotpluggable" is an adjective, while "hotplug" is not. I slightly prefer "does not support hot-plugging CPUs" over "does not support hot-pluggable CPUs". As always, I'm happy to take advice from native speakers :) > >> return NULL; >> } >>
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c index a6ed3a63c3..2d904747c0 100644 --- a/hw/core/machine-qmp-cmds.c +++ b/hw/core/machine-qmp-cmds.c @@ -16,7 +16,6 @@ #include "qapi/error.h" #include "qapi/qapi-builtin-visit.h" #include "qapi/qapi-commands-machine.h" -#include "qapi/qmp/qerror.h" #include "qapi/qmp/qobject.h" #include "qapi/qobject-input-visitor.h" #include "qapi/type-helpers.h" @@ -141,7 +140,7 @@ HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp) MachineClass *mc = MACHINE_GET_CLASS(ms); if (!mc->has_hotpluggable_cpus) { - error_setg(errp, QERR_FEATURE_DISABLED, "query-hotpluggable-cpus"); + error_setg(errp, "machine does not support hot-plugging CPUs"); return NULL; }
The QERR_ macros are leftovers from the days of "rich" error objects. We've been trying to reduce their remaining use. Get rid of a use of QERR_FEATURE_DISABLED, and improve the slightly awkward error message (qemu) info hotpluggable-cpus Error: The feature 'query-hotpluggable-cpus' is not enabled to Error: machine does not support hot-plugging CPUs Signed-off-by: Markus Armbruster <armbru@redhat.com> --- hw/core/machine-qmp-cmds.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)