Re: [PATCH 05/23] cpu: Use virDomainCapsCPUModelsPtr in cpu driver APIs

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

 



On Thu, Oct 12, 2017 at 07:27:22 -0400, John Ferlan wrote:
> 
> 
> On 10/04/2017 10:58 AM, Jiri Denemark wrote:
> > All APIs which expect a list of CPU models supported by hypervisors were
> > switched from char **models and int models to just accept a pointer to
> > virDomainCapsCPUModels object stored in domain capabilities. This avoids
> > the need to transform virDomainCapsCPUModelsPtr into a NULL-terminated
> > list of model names and also allows the various cpu driver APIs to
> > access additional details (such as its usability) about each CPU model.
...
> > @@ -514,21 +503,20 @@ virCPUProbeHost(virArch arch)
> >  virCPUDefPtr
> >  cpuBaseline(virCPUDefPtr *cpus,
> >              unsigned int ncpus,
> > -            const char **models,
> > -            unsigned int nmodels,
> > +            virDomainCapsCPUModelsPtr models,
> >              bool migratable)
> >  {
> >      struct cpuArchDriver *driver;
> >      size_t i;
> >  
> > -    VIR_DEBUG("ncpus=%u, nmodels=%u", ncpus, nmodels);
> > +    VIR_DEBUG("ncpus=%u", ncpus);
> 
> You could add models=%p...  not that it's necessary

Done.

> > diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
> > index 7ddc6cafd4..225cee4ef9 100644
> > --- a/src/qemu/qemu_capabilities.c
> > +++ b/src/qemu/qemu_capabilities.c
> [...]
> > -int
> > +virDomainCapsCPUModelsPtr
> >  virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
> > -                             virDomainVirtType type,
> > -                             char ***names,
> > -                             size_t *count)
> > +                             virDomainVirtType type)
> >  {
> > -    size_t i;
> > -    char **models = NULL;
> > -    virDomainCapsCPUModelsPtr cpus;
> > -
> > -    *count = 0;
> > -    if (names)
> > -        *names = NULL;
> > -
> >      if (type == VIR_DOMAIN_VIRT_KVM)
> > -        cpus = qemuCaps->kvmCPUModels;
> > +        return qemuCaps->kvmCPUModels;
> >      else
> > -        cpus = qemuCaps->tcgCPUModels;
> > +        return qemuCaps->tcgCPUModels;
> >  
...
> > +    return NULL;
> 
> Nice overall simplification, but how do we reach here?

Eh, the "return NULL;" shouldn't be there.

Jirka

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux