qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch


From: Anthony Liguori
Subject: Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch
Date: Tue, 09 Oct 2012 10:17:21 -0500
User-agent: Notmuch/0.13.2+93~ged93d79 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu)

Avi Kivity <address@hidden> writes:

> On 10/04/2012 04:13 PM, Anthony Liguori wrote:
>>>  
>>> +void address_space_init_dispatch(AddressSpace *as)
>>> +{
>>> +    AddressSpaceDispatch *d = g_new(AddressSpaceDispatch, 1);
>>> +
>>> +    d->phys_map  = (PhysPageEntry) { .ptr = PHYS_MAP_NODE_NIL, .is_leaf = 
>>> 0 };
>>> +    d->listener = (MemoryListener) {
>>> +        MEMORY_LISTENER_DEFAULT_OPS,
>>> +        .begin = mem_begin,
>>> +        .region_add = mem_add,
>>> +        .region_nop = mem_add,
>>> +        .priority = 0,
>>> +    };
>> 
>> I see you've become fond of this extension :-)
>
> It's not an extension.
>
>> I'd personally avoid it...  You're typing more than you need to.
>
> Don't see why, it seems to me to be a direct way of specifying what you
> want.  You can read it literally as "d->phys_map is assigned a
> PhysPageEntry structure with ptr = this and is_leaf = that.
>
> The alternatives are:
>
>    memset(&d->phys_map, 0, sizeof(d->phys_map);
>    d->phys_map.ptr = PHYS_MAP_NODE_NIL;
>    d->phys_map.is_leaf = 0;
>
> or
>
>    PhysPageEntry tmp = { .ptr = PHYS_MAP_NODE_NIL, .is_leaf = 0 };
>
>    d->phys_map = tmp;
>
> I find both of these less appealing than the original.

I don't really care about the use of struct literals...

You are typing more than you need to.  The bit that I think really
matters is using zero-initialization as the default vs. using a macro.

Regards,

Anthony Liguori

>
> -- 
> error compiling committee.c: too many arguments to function



reply via email to

[Prev in Thread] Current Thread [Next in Thread]