[libvirt] [PATCH] cpu: Unify CPUID data structures

Jiri Denemark jdenemar at redhat.com
Tue Dec 14 10:26:12 UTC 2010


> >  src/cpu/cpu_x86.c      |  576 +++++++++++++++++++++--------------------------
> >  src/cpu/cpu_x86_data.h |    4 +-
> >  2 files changed, 259 insertions(+), 321 deletions(-)
> > 
> 
> Nice cleanup.
> 
> ACK.

Thanks, I pushed the patch without any modifications.

> > +
> > +static void
> > +x86DataIteratorInit(struct data_iterator *iter,
> > +                    union cpuData *data)
> > +{
> > +    struct data_iterator init = DATA_ITERATOR_INIT(data);
> > +
> > +    *iter = init;
> 
> Is this any more efficient if init is marked static?

It might be more efficient but it is incorrect as we want to keep
x86DataIteratorInit() reentrant.

> Or can we even bypass the init variable and just do *iter =
> DATA_ITERATOR_INIT(data)?

Unfortunately we can't since it wouldn't compile. We could, however rewrite it
as

    iter->data = data;
    iter->pos = -1;
    iter->extended = false;

I prefer to reuse DATA_ITERATOR_INIT() instead.

Jirka




More information about the libvir-list mailing list