From: David Gibson Subject: Re: [Qemu-devel] [RFC PATCH 01/13] Generic DMA memory access interface Date: Thu, 2 Jun 2011 19:38:42 +1000 Message-ID: <20110602093842.GE5998@yookeroo.fritz.box> References: <1306892315-7306-1-git-send-email-eduard.munteanu@linux360.ro> <1306892315-7306-2-git-send-email-eduard.munteanu@linux360.ro> <4DE64646.3010505@twiddle.net> <20110601145227.GA2936@localhost> <4DE65629.1010300@twiddle.net> <20110601153510.GA3339@localhost> <4DE65EB4.1070104@twiddle.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Eduard - Gabriel Munteanu , mst@redhat.com, aliguori@us.ibm.com, kvm@vger.kernel.org, aik@ozlabs.ru, joro@8bytes.org, seabios@seabios.org, qemu-devel@nongnu.org, agraf@suse.de, blauwirbel@gmail.com, yamahata@valinux.co.jp, kevin@koconnor.net, avi@redhat.com, paul@codesourcery.com To: Richard Henderson Return-path: Received: from e23smtp04.au.ibm.com ([202.81.31.146]:39368 "EHLO e23smtp04.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932771Ab1FBJjN (ORCPT ); Thu, 2 Jun 2011 05:39:13 -0400 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245]) by e23smtp04.au.ibm.com (8.14.4/8.13.1) with ESMTP id p529X7nr022371 for ; Thu, 2 Jun 2011 19:33:07 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p529d8dk1278070 for ; Thu, 2 Jun 2011 19:39:08 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p529d667000423 for ; Thu, 2 Jun 2011 19:39:08 +1000 Content-Disposition: inline In-Reply-To: <4DE65EB4.1070104@twiddle.net> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jun 01, 2011 at 08:45:56AM -0700, Richard Henderson wrote: > On 06/01/2011 08:35 AM, Eduard - Gabriel Munteanu wrote: > > Maybe it's not nice, but you're missing the fact upcasting gives you > > some type safety. With opaques you have none. > > Lol. Do you understand what container_of does? > This is not dynamic_cast<> with RTTI. > > You can put any type name in there that you like, > so long as it has a field name to match. The type > of the field you give doesn't even have to match > the type of the pointer that you pass in. Uh, if that's true, that's a bug in the container_of implementation. The ccan container_of implementation, for example, certainly does check that the given field has type matching the pointer. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson