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: Avi Kivity
Subject: Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch
Date: Thu, 04 Oct 2012 16:43:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1

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.

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



reply via email to

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