[libvirt] [PATCH 10/10] qemu: monitor: Return struct from qemuMonitor(Text|Json)QueryCPUs
John Ferlan
jferlan at redhat.com
Wed Aug 3 17:12:15 UTC 2016
On 08/03/2016 01:00 PM, Peter Krempa wrote:
> On Wed, Aug 03, 2016 at 12:04:02 -0400, John Ferlan wrote:
>>
>>
>> On 08/03/2016 04:11 AM, Peter Krempa wrote:
>>> Prepare to extract more data by returning a array of structs rather than
>>> just an array of thread ids. Additionally report fatal errors separately
>>> from qemu not being able to produce data.
>>> ---
>>> src/qemu/qemu_monitor.c | 31 ++++++++++++-------
>>> src/qemu/qemu_monitor.h | 6 ++++
>>> src/qemu/qemu_monitor_json.c | 71 ++++++++++++++++++++++----------------------
>>> src/qemu/qemu_monitor_json.h | 2 +-
>>> src/qemu/qemu_monitor_text.c | 37 +++++++++++------------
>>> src/qemu/qemu_monitor_text.h | 2 +-
>>> tests/qemumonitorjsontest.c | 31 ++++++++++++++-----
>>> 7 files changed, 104 insertions(+), 76 deletions(-)
>>>
>>> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
>>> index 0011ceb..578b078 100644
>>> --- a/src/qemu/qemu_monitor.c
>>> +++ b/src/qemu/qemu_monitor.c
>>> @@ -1666,6 +1666,16 @@ qemuMonitorCPUInfoFree(qemuMonitorCPUInfoPtr cpus,
>>> VIR_FREE(cpus);
>>> }
>>>
>>> +void
>>> +qemuMonitorQueryCpusFree(struct qemuMonitorQueryCpusEntry *entries,
>>> + size_t nentries ATTRIBUTE_UNUSED)
>>> +{
>>> + if (!entries)
>>> + return;
>>
>> [1] Maybe this should be a 'int' parameter and a <= 0 check...
>
> What?! That's a freeing function. That does not make any sense.
>
oh right - my eyes read nentries... and I even noted in the caller that
nentries is not used.... Anyway, I suppose part of me was trying to
forward think why you would add nentries and that passing a -2 or -1
here may not end quickly...
John
More information about the libvir-list
mailing list