public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* a couple questions about drivers/net/macv*.c
@ 2010-07-10 23:44 Robert P. J. Day
  2010-07-11  2:26 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Robert P. J. Day @ 2010-07-10 23:44 UTC (permalink / raw)
  To: netdev


  first (trivial) point, i notice that both macvlan.c and macvtap.c
are still both listed as EXPERIMENTAL -- is that still accurate?

  bigger issue in macvtap.c -- notice this declaration:

static unsigned int macvtap_major;

that seems like a violation of coding style since that variable is
used later on in:

        devt = MKDEV(MAJOR(macvtap_major), dev->ifindex);
 and

       err = alloc_chrdev_region(&macvtap_major, 0,
                                MACVTAP_NUM_DEVS, "macvtap");

where its type should simply be the typedef "dev_t" for transparency,
should it not?  hardcoding that variable as an unsigned int seems like
a bad idea.

rday

-- 

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Top-notch, inexpensive online Linux/OSS/kernel courses
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: a couple questions about drivers/net/macv*.c
  2010-07-10 23:44 a couple questions about drivers/net/macv*.c Robert P. J. Day
@ 2010-07-11  2:26 ` David Miller
  2010-07-11  2:31   ` Robert P. J. Day
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2010-07-11  2:26 UTC (permalink / raw)
  To: rpjday; +Cc: netdev

From: "Robert P. J. Day" <rpjday@crashcourse.ca>
Date: Sat, 10 Jul 2010 19:44:59 -0400 (EDT)

> 
>   first (trivial) point, i notice that both macvlan.c and macvtap.c
> are still both listed as EXPERIMENTAL -- is that still accurate?

Probably the tag should be removed, a lot of people use this
facility and it works quite well as far as I can tell.

>   bigger issue in macvtap.c -- notice this declaration:
> 
> static unsigned int macvtap_major;
> 
> that seems like a violation of coding style since that variable is
> used later on in:
> 
>         devt = MKDEV(MAJOR(macvtap_major), dev->ifindex);
>  and
> 
>        err = alloc_chrdev_region(&macvtap_major, 0,
>                                 MACVTAP_NUM_DEVS, "macvtap");
> 
> where its type should simply be the typedef "dev_t" for transparency,
> should it not?

Yep, I'll check in the following to net-next-2.6, thanks.

--------------------
macvtap: Use dev_t for macvtap_major.

Reported-by: "Robert P. J. Day" <rpjday@crashcourse.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/macvtap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index a8a94e2..2b4d59b 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -58,7 +58,7 @@ static struct proto macvtap_proto = {
  * only has one tap, the interface numbers assure that the
  * device nodes are unique.
  */
-static unsigned int macvtap_major;
+static dev_t macvtap_major;
 #define MACVTAP_NUM_DEVS 65536
 static struct class *macvtap_class;
 static struct cdev macvtap_cdev;
-- 
1.7.1.1




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: a couple questions about drivers/net/macv*.c
  2010-07-11  2:26 ` David Miller
@ 2010-07-11  2:31   ` Robert P. J. Day
  0 siblings, 0 replies; 3+ messages in thread
From: Robert P. J. Day @ 2010-07-11  2:31 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Sat, 10 Jul 2010, David Miller wrote:

> From: "Robert P. J. Day" <rpjday@crashcourse.ca>
> Date: Sat, 10 Jul 2010 19:44:59 -0400 (EDT)
>
> >
> >   first (trivial) point, i notice that both macvlan.c and macvtap.c
> > are still both listed as EXPERIMENTAL -- is that still accurate?
>
> Probably the tag should be removed, a lot of people use this
> facility and it works quite well as far as I can tell.
>
> >   bigger issue in macvtap.c -- notice this declaration:
> >
> > static unsigned int macvtap_major;
> >
> > that seems like a violation of coding style since that variable is
> > used later on in:
> >
> >         devt = MKDEV(MAJOR(macvtap_major), dev->ifindex);
> >  and
> >
> >        err = alloc_chrdev_region(&macvtap_major, 0,
> >                                 MACVTAP_NUM_DEVS, "macvtap");
> >
> > where its type should simply be the typedef "dev_t" for transparency,
> > should it not?
>
> Yep, I'll check in the following to net-next-2.6, thanks.
>
> --------------------
> macvtap: Use dev_t for macvtap_major.
>
> Reported-by: "Robert P. J. Day" <rpjday@crashcourse.ca>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
>  drivers/net/macvtap.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index a8a94e2..2b4d59b 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -58,7 +58,7 @@ static struct proto macvtap_proto = {
>   * only has one tap, the interface numbers assure that the
>   * device nodes are unique.
>   */
> -static unsigned int macvtap_major;
> +static dev_t macvtap_major;

  technically, i would drop the "_major" suffix since that variable
doesn't represent simply the major device number but the entire dev_t
typedef, but that's your call.

rday

-- 

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Top-notch, inexpensive online Linux/OSS/kernel courses
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-11  2:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-10 23:44 a couple questions about drivers/net/macv*.c Robert P. J. Day
2010-07-11  2:26 ` David Miller
2010-07-11  2:31   ` Robert P. J. Day

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox