qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH 1/7] Add support for generic notifier lists


From: Anthony Liguori
Subject: Re: [Qemu-devel] Re: [PATCH 1/7] Add support for generic notifier lists
Date: Thu, 11 Mar 2010 09:08:03 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Lightning/1.0pre Thunderbird/3.0

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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]