qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mark McLoughlin <markmc@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 2/7] net: Add VLAN client cleanup handler
Date: Wed, 15 Apr 2009 18:00:51 +0100	[thread overview]
Message-ID: <1239814851.4431.147.camel@blaa> (raw)
In-Reply-To: <49E5E953.8060207@siemens.com>

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.

Cheers,
Mark.

  reply	other threads:[~2009-04-15 17:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14 17:29 [Qemu-devel] [PATCH 0/7] Various small networking improvements Jan Kiszka
2009-04-14 17:29 ` [Qemu-devel] [PATCH 3/7] net: Check device passed to host_net_remove Jan Kiszka
2009-04-15 13:09   ` Mark McLoughlin
2009-04-15 14:04     ` [Qemu-devel] " Jan Kiszka
2009-04-14 17:29 ` [Qemu-devel] [PATCH 2/7] net: Add VLAN client cleanup handler Jan Kiszka
2009-04-15 13:09   ` Mark McLoughlin
2009-04-15 13:40     ` Mark McLoughlin
2009-04-15 14:13       ` [Qemu-devel] " Jan Kiszka
2009-04-15 17:15         ` Mark McLoughlin
2009-04-15 14:04     ` Jan Kiszka
2009-04-15 17:00       ` Mark McLoughlin [this message]
2009-04-15 17:03         ` Jan Kiszka
2009-04-14 17:29 ` [Qemu-devel] [PATCH 1/7] net: Fix -net socket,listen Jan Kiszka
2009-04-15 13:09   ` Mark McLoughlin
2009-04-14 17:29 ` [Qemu-devel] [PATCH 6/7] net: Add support for capturing VLANs Jan Kiszka
2009-04-15 13:10   ` Mark McLoughlin
2009-04-15 14:09     ` [Qemu-devel] " Jan Kiszka
2009-04-15 17:13       ` Mark McLoughlin
2009-04-15 17:16         ` Jan Kiszka
2009-04-14 17:29 ` [Qemu-devel] [PATCH 4/7] net: Prevent multiple slirp instances Jan Kiszka
2009-04-15 13:09   ` Mark McLoughlin
2009-04-14 17:29 ` [Qemu-devel] [PATCH 5/7] monitor: Improve host_net_add Jan Kiszka
2009-04-15 13:09   ` Mark McLoughlin
2009-04-14 17:29 ` [Qemu-devel] [PATCH 7/7] slirp: Handle DHCP requests for specific IP Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1239814851.4431.147.camel@blaa \
    --to=markmc@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).