From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Npjzf-0000AN-Gp for qemu-devel@nongnu.org; Thu, 11 Mar 2010 10:08:11 -0500 Received: from [199.232.76.173] (port=59128 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Npjzd-00007X-RU for qemu-devel@nongnu.org; Thu, 11 Mar 2010 10:08:09 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Npjzc-0001HX-Cq for qemu-devel@nongnu.org; Thu, 11 Mar 2010 10:08:09 -0500 Received: from mail-gw0-f45.google.com ([74.125.83.45]:40223) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Npjzc-0001HR-3h for qemu-devel@nongnu.org; Thu, 11 Mar 2010 10:08:08 -0500 Received: by gwaa18 with SMTP id a18so62450gwa.4 for ; Thu, 11 Mar 2010 07:08:07 -0800 (PST) Message-ID: <4B990753.5030103@codemonkey.ws> Date: Thu, 11 Mar 2010 09:08:03 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH 1/7] Add support for generic notifier lists References: <1268239869-16058-1-git-send-email-aliguori@us.ibm.com> <201003111257.59828.paul@codesourcery.com> <4B98EF51.7040905@redhat.com> <4B98F32B.7070706@redhat.com> <4B98FFF8.3060000@redhat.com> <4B990149.8010308@redhat.com> In-Reply-To: <4B990149.8010308@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: Anthony Liguori , qemu-devel@nongnu.org, Luiz Capitulino , Paul Brook , Paolo Bonzini , Gerd Hoffman On 03/11/2010 08:42 AM, Avi Kivity wrote: > On 03/11/2010 04:36 PM, Paolo Bonzini wrote: >> On 03/11/2010 02:42 PM, Avi Kivity wrote: >>> On 03/11/2010 03:25 PM, Paolo Bonzini wrote: >>>> I didn't understand the advantage of making QEMUNotifier a >>>> struct. Instead of using container_of, reusing QEMUBHFunc (renamed to >>>> QEMUCallbackFunc maybe?) in QEMUNotifierNode [...] >>>> seems cleaner. You would place the QEMUNotifierNode in VncState in >>>> order to do the removal later. >>> >>> I disagree. container_of() is both a little more type safe, and removes >>> the need for an extra pointer and memory object. >> > The caller will almost always have an object in which to embed the >> > notifier, best to make use of it. >> >> It doesn't remove the need for an extra memory object. Anthony's >> design embeds the Notifier but not the NotifierNode. Indeed, my >> design does have an extra pointer (in the NotifierNode, which grows >> from 3 to 4 words). > > Right. Well, it should. It's certainly possible (and reasonable) to stick the QTAIL_NODE() into QEMUNotifier. Regards, Anthony Liguori >> I still don't like container_of much, but maybe I'll grow my >> appreciation of it with time. :-) > > Or grow your dislike of void pointers. >