qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 01/11] QMP: Introduce specification file


From: Avi Kivity
Subject: Re: [Qemu-devel] [PATCH 01/11] QMP: Introduce specification file
Date: Wed, 01 Jul 2009 11:07:06 +0300
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2

On 06/30/2009 09:21 PM, Anthony Liguori wrote:
1. Add QValue, QArray, QDictionary

QValue is a polymorphic object that can be a number, a string, an array, or a dictionary. It needs a bunch of accessors like qvalue_to_qarray() to check if a value is an array, and things like qarray_get() or qdict_put() to manipulate them. For the simpler data types, qvalue_to_int64() and qvalue_from_int64() should suffice.


And add a return value to the monitor functions. I think this is a good first step.

Passing a QArray to each monitor function is one way to go. Another way to go is to use something like libffi to do proper dynamic dispatch. The later approach has the benefit of requiring less code churn and reusing the static type checking.

If/when we switch to passing dictionaries instead of arrays, this won't work. I also think libffi is a little to exotic for something like the monitor. You could potentially introduce some serious ninja action by doing something like:

value = qvalue_create("[%s, {'f': %s, 'b': %s', 'c': %d}]", ...);

Seriously nifty...

--
error compiling committee.c: too many arguments to function





reply via email to

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