netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: [RFC] network device ops phase 1
Date: Mon, 10 Nov 2008 17:21:07 -0800	[thread overview]
Message-ID: <20081110172107.4285b5b8@extreme> (raw)
In-Reply-To: <20081110.170211.149124971.davem@davemloft.net>

On Mon, 10 Nov 2008 17:02:11 -0800 (PST)
David Miller <davem@davemloft.net> wrote:

> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Fri, 7 Nov 2008 15:50:23 -0800
> 
> > This early work on a series of patches to separate the management portions
> > of the network device (immutable function pointers) from the data
> > structure part of the network device.
>  ...
> 
> I think this is a good way to attack this kind of transition.
> 
> Fix the build errors, do some testing, and please resubmit:
> 
> net/core/dev.c: In function ‘register_netdevice’:
> net/core/dev.c:4075: error: ‘struct net_device_ops’ has no member named ‘poll_controller’
> net/core/dev.c:4075: error: ‘struct net_device’ has no member named ‘poll_controller’
> make[2]: *** [net/core/dev.o] Error 1
> make[1]: *** [net/core] Error 2
> make: *** [net] Error 2
> make: *** Waiting for unfinished jobs....
> 
> Thanks.

This is one case where I wish GCC had more C++ style anonymous structures
so the following would work, and avoid the copying and allocation.

struct net_device_ops {
   int (*init)(struct net_device *);
...
};

struct net_device {
...
#ifdef CONFIG_COMPAT_XXX
   struct net_device_ops;
#endif
   struct net_device_ops *ops;
};


void register_netdevice(struct net_device *dev)
{
...

#ifdef CONFIG_COMPAT_XXX
      if (ops == NULL) {
         printk("loser device %s", dev->name);
         dev->ops = (struct net_device_ops *) dev->init;
      }
#endif

}


  reply	other threads:[~2008-11-11  1:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-07 23:50 [RFC] network device ops phase 1 Stephen Hemminger
2008-11-11  1:02 ` David Miller
2008-11-11  1:21   ` Stephen Hemminger [this message]
2008-11-14  6:11 ` Kumar Gala

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=20081110172107.4285b5b8@extreme \
    --to=shemminger@vyatta.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.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).