qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC 0/8]: QError v2


From: Anthony Liguori
Subject: Re: [Qemu-devel] [RFC 0/8]: QError v2
Date: Thu, 12 Nov 2009 09:26:31 -0600
User-agent: Thunderbird 2.0.0.23 (X11/20090825)

Luiz Capitulino wrote:
On Thu, 12 Nov 2009 08:44:03 -0600
Anthony Liguori <address@hidden> wrote:

Luiz Capitulino wrote:
#define QERR_DEVICE_ALREADY_OPEN "{'class': 'DeviceAlreadyOpen', 'data' : {'bus_num': %d, 'addr': %d}"

qemu_error_new(QERR_DEVICE_ALREADY_OPEN, bus_num, addr);
 What about DeviceAlreadyOpen errors with a different argument list?
Why would you have this? That would seem like a problem to me. I think the errors need to be very well structured (just like everything else in QMP).

 This can happen with errors that carry specific info which are different
among subsystems, eg. USB device info vs. PCI device info.

This example demonstrates the problem with this. You haven't included enough information in the error to properly distinguish what happened. I would suggest changing to:

'data' : { 'device_type' : %s, 'addr': %s }

qemu_error_new(QERR_DEVICE_ALREADY_OPEN, "pci", addr);

Or, if you really wanted to get fancy:

'data' : { 'device_type': %s, 'addr': %p }

qemu_error_new(QERR_DEVICE_ALREADY_OPEN, "pci",
qobject_from_jsonf("{'bus': %d, 'slot': %d, 'function': %d}", bus, dev, fn));

Personally, I'd stick with the first one though.

--
Regards,

Anthony Liguori





reply via email to

[Prev in Thread] Current Thread [Next in Thread]