
On 12/02/2013 06:32 PM, Hu Tao wrote:
On Mon, Dec 02, 2013 at 02:34:44PM -0700, Eric Blake wrote:
On 12/01/2013 11:11 PM, Hu Tao wrote:
This patch adds a new xml element devices/pvpanic to support qemu device pvpanic. It can be used to receive guest panic notification.
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> --- docs/formatdomain.html.in | 25 +++++++++++++++++ src/conf/domain_conf.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 9 +++++++ 3 files changed, 102 insertions(+)
+static int virDomainPvpanicDefFormat(virBufferPtr buf, + virDomainPvpanicDefPtr def) +{ + if (def->ioport > 0) {
Isn't this an off-by-one if someone explicitly requests port 0 (since your parser initializes to -1 when left unspecified)?
port 0 means disable the device, so there is no need to add it when port is 0. But if you'd prefer to let the device handle port itself, then it's OK to add it in the case.
Then don't initialize port to -1. Instead, in your parser reject an explicit setting of 0, and use the default of 0 to mean unspecified port. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org