From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [Qemu-devel] [PATCH v4 26/39] pcnet: convert to memory API Date: Tue, 09 Aug 2011 15:52:59 +0300 Message-ID: <4E412DAB.90106@redhat.com> References: <1312808972-1718-1-git-send-email-avi@redhat.com> <1312808972-1718-27-git-send-email-avi@redhat.com> <4E40D9F3.5080309@mc.net> <4E40D921.9080700@redhat.com> <20110809124246.GF524@redhat.com> <4E412BB3.9070703@redhat.com> <20110809124856.GI524@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Bob Breuer , Anthony Liguori , qemu-devel@nongnu.org, kvm@vger.kernel.org, Blue Swirl To: "Michael S. Tsirkin" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:34487 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753581Ab1HIMxM (ORCPT ); Tue, 9 Aug 2011 08:53:12 -0400 In-Reply-To: <20110809124856.GI524@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/09/2011 03:48 PM, Michael S. Tsirkin wrote: > > > > But in some cases, we can't, and the it's a pain having to wrap > > MemoryRegion in another structure containing an opaque. > > I guess, even though that wrapping structure would > use a proper type, not an opaque. Yes, of course - that's what the first version did. > > Maybe a good compromise is to: > > > > - keep MemoryRegion::opaque > > - pass a MemoryRegion *mr to callbacks instead of opaque > > - use container_of() when possible > > - use mr->opaque otherwise > > Right. This even saves a memory dereference when opaque is > unused. > I'll put this on the TODO (as well as writing the TODO). -- error compiling committee.c: too many arguments to function From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45848) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qqmcj-0007gt-8h for qemu-devel@nongnu.org; Tue, 09 Aug 2011 09:45:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqmcZ-0004Bo-8N for qemu-devel@nongnu.org; Tue, 09 Aug 2011 09:45:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36353) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqmcY-00041n-Fb for qemu-devel@nongnu.org; Tue, 09 Aug 2011 09:45:26 -0400 Message-ID: <4E412DAB.90106@redhat.com> Date: Tue, 09 Aug 2011 15:52:59 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1312808972-1718-1-git-send-email-avi@redhat.com> <1312808972-1718-27-git-send-email-avi@redhat.com> <4E40D9F3.5080309@mc.net> <4E40D921.9080700@redhat.com> <20110809124246.GF524@redhat.com> <4E412BB3.9070703@redhat.com> <20110809124856.GI524@redhat.com> In-Reply-To: <20110809124856.GI524@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 26/39] pcnet: convert to memory API List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Blue Swirl , Bob Breuer , qemu-devel@nongnu.org, kvm@vger.kernel.org On 08/09/2011 03:48 PM, Michael S. Tsirkin wrote: > > > > But in some cases, we can't, and the it's a pain having to wrap > > MemoryRegion in another structure containing an opaque. > > I guess, even though that wrapping structure would > use a proper type, not an opaque. Yes, of course - that's what the first version did. > > Maybe a good compromise is to: > > > > - keep MemoryRegion::opaque > > - pass a MemoryRegion *mr to callbacks instead of opaque > > - use container_of() when possible > > - use mr->opaque otherwise > > Right. This even saves a memory dereference when opaque is > unused. > I'll put this on the TODO (as well as writing the TODO). -- error compiling committee.c: too many arguments to function