Re: [PATCH 02/41] domcaps: Add support for listing supported CPU models

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

 



On Mon, Aug 29, 2016 at 12:31:44 -0400, John Ferlan wrote:
> > +int
> > +virDomainCapsCPUModelsAddSteal(virDomainCapsCPUModelsPtr cpuModels,
> > +                               char **name)
> > +{
> > +    if (VIR_RESIZE_N(cpuModels->models, cpuModels->alloc,
> > +                     cpuModels->count, 1) < 0)
> > +        return -1;
> > +
> > +    cpuModels->models[cpuModels->count++].name = *name;
> > +    *name = NULL;
> 
> Similar to VIR_STEAL_PTR with the added count++ twist...

Right, I changed it to use VIR_STEAL_PTR.

...
> > diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
> > index 492a9cf..509c306 100644
> > --- a/src/conf/domain_capabilities.h
> > +++ b/src/conf/domain_capabilities.h
> > @@ -102,6 +102,30 @@ struct _virDomainCapsFeatureGIC {
> >      virDomainCapsEnum version; /* Info about virGICVersion */
> >  };
> >  
> > +typedef struct _virDomainCapsCPUModel virDomainCapsCPUModel;
> > +typedef virDomainCapsCPUModel *virDomainCapsCPUModelPtr;
> > +struct _virDomainCapsCPUModel {
> > +    char *name;
> > +};
> > +
> > +typedef struct _virDomainCapsCPUModels virDomainCapsCPUModels;
> > +typedef virDomainCapsCPUModels *virDomainCapsCPUModelsPtr;
> > +struct _virDomainCapsCPUModels {
> > +    virObject parent;
> > +
> > +    size_t alloc;
> > +    size_t count;
> 
> Easier for me to read/see "->nmodels_max" and "->nmodels"... Not sure
> how pervasive it is to change... Not a requirement, your call...

Yeah, nmodels{,_max} is more common in our code base. Fixed.

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]