Skip to content

RFC QError v1

Luiz Capitulino qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest7 patches 24 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7QJSon: Introduce qobject_from_json_va()qjson.c qjson.h+7 -00 replies
2/7Introduce QErrorMakefile qerror.c qerror.h +1 more+290 -16 replies
3/7monitor: QError supportmonitor.c sysemu.h+49 -10 replies
4/7QError: Add QERR_DEV_NFOUNDqerror.c qerror.h+5 -00 replies
5/7qdev: Use QError for not found errorhw/qdev.c+2 -20 replies
6/7QError: Add do_info_balloon() errorsqerror.c qerror.h+10 -00 replies
7/7monitor: do_info_balloon(): use QErrormonitor.c+2 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [RFC 0/7] QError v1

Hi there,

This is a new version of the QError framework.

I've been through the last QError thread and tried to collect the best
suggestions. The important changes are:

- Dropped the .user_print function
- Added Paolo's suggestion on having a printf-like format for 'desc'
- Line number and filename are also stored in the QError object
- Uses QJSon

Now, a call like:

monitor_printf(mon, "husb: host usb device %d.%d is already open\n",

                      bus_num, addr);

Would become:

qemu_error_structed("{ 'bus_num': %d, 'addr': %d }", bus_num, addr);

Its error table entry should be:

{
.code = QERR_USB_EOPEN,
.desc = "husb: host usb device %(bus_num)d.%(addr)d is already open",
}

Finally, on the wire we'd have:

{ "error": { "code": 45,

             "data": { "bus_num": 1, "addr": 0xff } } }

As the previous version, qemu_error_structed() builds on top of Gerd's
QemuErrorSink API.

Besides introducing QError, this series also has simple usage examples for
qdev_device_add() and do_info_balloon().

A last note: this series is on top of the (to be merged) QJSon module,
that's why it's a RFC and.. I didn't test it too much. :)

Thanks.