[Top][All Lists]
[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
- Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch, (continued)
- Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch, Avi Kivity, 2012/10/04
- Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch, Blue Swirl, 2012/10/04
- Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch, Avi Kivity, 2012/10/04
- Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch, Blue Swirl, 2012/10/04
- Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch, Anthony Liguori, 2012/10/04
- Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch, Peter Maydell, 2012/10/04
- Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch, Avi Kivity, 2012/10/07
- Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch, Blue Swirl, 2012/10/04
Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch, Anthony Liguori, 2012/10/04
[Qemu-devel] [RFC v1 17/22] memory: use AddressSpace for MemoryListener filtering, Avi Kivity, 2012/10/03
Re: [Qemu-devel] [RFC v1 17/22] memory: use AddressSpace for MemoryListener filtering, Anthony Liguori, 2012/10/04
[Qemu-devel] [RFC v1 18/22] s390: avoid reaching into memory core internals, Avi Kivity, 2012/10/03
Re: [Qemu-devel] [RFC v1 00/22] Integrate DMA into the memory API, Blue Swirl, 2012/10/03
Re: [Qemu-devel] [RFC v1 00/22] Integrate DMA into the memory API, Avi Kivity, 2012/10/04