On 10/15/21 11:49 AM, Hiroki Narukawa wrote: > One of qemuDomainGetStatsWorkers requires capabilities to run. > > This commit adds capability information to qemuDomainGetStatsWorkers. > > Signed-off-by: Hiroki Narukawa <hnarukaw@xxxxxxxxxxxxx> > --- > src/qemu/qemu_driver.c | 32 +++++++++++++++++++++----------- > 1 file changed, 21 insertions(+), 11 deletions(-) > > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index 2b759f5719..ac5eaf139e 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > @@ -18685,20 +18685,30 @@ struct qemuDomainGetStatsWorker { > qemuDomainGetStatsFunc func; > unsigned int stats; > bool monitor; > + virQEMUCapsFlags* requiredCaps; We prefer the '*' char next to variable, like this: virQEMUCapsFlags *requiredCaps; > +}; > + > +static virQEMUCapsFlags noCapsRequired[] = { > + QEMU_CAPS_LAST, > +}; > + > +static virQEMUCapsFlags queryDirtyRateRequired[] = { > + QEMU_CAPS_QUERY_DIRTY_RATE, > + QEMU_CAPS_LAST, > }; > > static struct qemuDomainGetStatsWorker qemuDomainGetStatsWorkers[] = { > - { qemuDomainGetStatsState, VIR_DOMAIN_STATS_STATE, false }, > - { qemuDomainGetStatsCpu, VIR_DOMAIN_STATS_CPU_TOTAL, false }, > - { qemuDomainGetStatsBalloon, VIR_DOMAIN_STATS_BALLOON, true }, > - { qemuDomainGetStatsVcpu, VIR_DOMAIN_STATS_VCPU, true }, > - { qemuDomainGetStatsInterface, VIR_DOMAIN_STATS_INTERFACE, false }, > - { qemuDomainGetStatsBlock, VIR_DOMAIN_STATS_BLOCK, true }, > - { qemuDomainGetStatsPerf, VIR_DOMAIN_STATS_PERF, false }, > - { qemuDomainGetStatsIOThread, VIR_DOMAIN_STATS_IOTHREAD, true }, > - { qemuDomainGetStatsMemory, VIR_DOMAIN_STATS_MEMORY, false }, > - { qemuDomainGetStatsDirtyRate, VIR_DOMAIN_STATS_DIRTYRATE, true }, > - { NULL, 0, false } > + { qemuDomainGetStatsState, VIR_DOMAIN_STATS_STATE, false, noCapsRequired }, > + { qemuDomainGetStatsCpu, VIR_DOMAIN_STATS_CPU_TOTAL, false, noCapsRequired }, > + { qemuDomainGetStatsBalloon, VIR_DOMAIN_STATS_BALLOON, true, noCapsRequired }, > + { qemuDomainGetStatsVcpu, VIR_DOMAIN_STATS_VCPU, true, noCapsRequired }, > + { qemuDomainGetStatsInterface, VIR_DOMAIN_STATS_INTERFACE, false, noCapsRequired }, > + { qemuDomainGetStatsBlock, VIR_DOMAIN_STATS_BLOCK, true, noCapsRequired }, > + { qemuDomainGetStatsPerf, VIR_DOMAIN_STATS_PERF, false, noCapsRequired }, > + { qemuDomainGetStatsIOThread, VIR_DOMAIN_STATS_IOTHREAD, true, noCapsRequired }, > + { qemuDomainGetStatsMemory, VIR_DOMAIN_STATS_MEMORY, false, noCapsRequired }, > + { qemuDomainGetStatsDirtyRate, VIR_DOMAIN_STATS_DIRTYRATE, true, queryDirtyRateRequired }, > + { NULL, 0, false, NULL } How about instead of noCapsRequired a simple NULL would be passed? The consumer can then check for NULL and skip the loop completely. Michal