[Top][All Lists]

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

[Qemu-devel] Re: [PATCH 2/7] net: Add VLAN client cleanup handler

From: Jan Kiszka
Subject: [Qemu-devel] Re: [PATCH 2/7] net: Add VLAN client cleanup handler
Date: Wed, 15 Apr 2009 19:03:49 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv: Gecko/20080226 SUSE/ Thunderbird/ Mnenhy/

Mark McLoughlin wrote:
> On Wed, 2009-04-15 at 16:04 +0200, Jan Kiszka wrote:
>> Mark McLoughlin wrote:
>>>  - Rather than adding yet another param to new_vlan_client(), I just 
>>>    initialize vc->cleanup after creating the client; another patch in
>>>    my queue removes all callbacks to new_vlan_client() because as more
>>>    are added it just gets terribly unwieldy.
>> Personally, I prefer a function-based API over, well, hacking the
>> structures directly. The driver should not have to poke into its device
>> descriptor.
> I see this as similar to filing out a vtable. Perhaps it makes sense to
> split the function pointers out into a separate struct.
>>  Yes, this breaks existing code each time you add another
>> callback, but this has the effect that you
>>  a) normally think twice if you really need it before doing this,
>>  b) likely enhance all users, and
>>  c) that new users will find prominent information about this
>>     (hopefully) useful callback.
> The way I see it is that often when you're adding a new callback, you
> don't want to require all users to implement it. Instead you make sure
> there is a reasonable default behaviour for when the callback is NULL,
> and only set it to non-NULL for the users that really need it.

Based on our patches, one could easily argue that the cleanup handler
does not fall into this category - nearly everyone wants it, no?


Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

reply via email to

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