From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55868) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJqWB-0004QY-8j for qemu-devel@nongnu.org; Thu, 04 Oct 2012 14:51:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJqW9-0000nR-GA for qemu-devel@nongnu.org; Thu, 04 Oct 2012 14:51:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33929) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJmdq-0005X2-6G for qemu-devel@nongnu.org; Thu, 04 Oct 2012 10:43:13 -0400 Message-ID: <506DA076.3080501@redhat.com> Date: Thu, 04 Oct 2012 16:43:02 +0200 From: Avi Kivity MIME-Version: 1.0 References: <1349280245-16341-1-git-send-email-avi@redhat.com> <1349280245-16341-20-git-send-email-avi@redhat.com> <87ehleiav7.fsf@codemonkey.ws> In-Reply-To: <87ehleiav7.fsf@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC v1 19/22] memory: per-AddressSpace dispatch List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Blue Swirl , Paolo Bonzini , "Michael S. Tsirkin" , qemu-devel@nongnu.org, liu ping fan 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