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

Eric Blake eblake at redhat.com
Mon Dec 13 17:50:24 UTC 2010


On 12/13/2010 02:06 AM, Jiri Denemark wrote:
> So far, CPUID data were stored in two different data structures. First
> of them was a structure allowing direct access for CPUID data according
> to function number and the second was a plain array of struct
> cpuX86cpuid. This was a silly design which resulted in converting data
> from one type to the other and back again or implementing similar
> functionality for both data structures.
> 
> The patch leaves only the direct access structure. This makes the code
> both smaller and more maintainable since operations on different objects
> can use common low-level operations.
> 
> All 57 tests for cpu subsystem still pass after this rewrite.
> ---
>  src/cpu/cpu_x86.c      |  576 +++++++++++++++++++++--------------------------
>  src/cpu/cpu_x86_data.h |    4 +-
>  2 files changed, 259 insertions(+), 321 deletions(-)
> 

Nice cleanup.

ACK.

> +
> +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?  Or can we even
bypass the init variable and just do *iter = DATA_ITERATOR_INIT(data)?

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20101213/33c2bdb4/attachment-0001.sig>


More information about the libvir-list mailing list