netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: net_device flags is an unsigned int
@ 2011-12-01  4:34 Eric Dumazet
  2011-12-01  4:39 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2011-12-01  4:34 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

commit b00055aacdb ([NET] core: add RFC2863 operstate) changed
net_device flags from unsigned short to unsigned int.

Some core functions still assume its an unsigned short.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/core/dev.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 1482eea..1c345cf 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4538,7 +4538,7 @@ static void dev_change_rx_flags(struct net_device *dev, int flags)
 
 static int __dev_set_promiscuity(struct net_device *dev, int inc)
 {
-	unsigned short old_flags = dev->flags;
+	typeof(dev->flags) old_flags = dev->flags;
 	uid_t uid;
 	gid_t gid;
 
@@ -4595,7 +4595,7 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc)
  */
 int dev_set_promiscuity(struct net_device *dev, int inc)
 {
-	unsigned short old_flags = dev->flags;
+	typeof(dev->flags) old_flags = dev->flags;
 	int err;
 
 	err = __dev_set_promiscuity(dev, inc);
@@ -4622,7 +4622,7 @@ EXPORT_SYMBOL(dev_set_promiscuity);
 
 int dev_set_allmulti(struct net_device *dev, int inc)
 {
-	unsigned short old_flags = dev->flags;
+	typeof(dev->flags) old_flags = dev->flags;
 
 	ASSERT_RTNL();
 

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

* Re: [PATCH] net: net_device flags is an unsigned int
  2011-12-01  4:34 [PATCH] net: net_device flags is an unsigned int Eric Dumazet
@ 2011-12-01  4:39 ` David Miller
  2011-12-01  4:48   ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2011-12-01  4:39 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 01 Dec 2011 05:34:37 +0100

> -	unsigned short old_flags = dev->flags;
> +	typeof(dev->flags) old_flags = dev->flags;

Please, create netdev_flags_t or similar, anything but this :-)

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

* Re: [PATCH] net: net_device flags is an unsigned int
  2011-12-01  4:39 ` David Miller
@ 2011-12-01  4:48   ` Eric Dumazet
  2011-12-01  5:05     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2011-12-01  4:48 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Le mercredi 30 novembre 2011 à 23:39 -0500, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Thu, 01 Dec 2011 05:34:37 +0100
> 
> > -	unsigned short old_flags = dev->flags;
> > +	typeof(dev->flags) old_flags = dev->flags;
> 
> Please, create netdev_flags_t or similar, anything but this :-)

Hmm, I thought Linus hated types like this...

Or how explain we dont have jiffies_t or similar ? ;)

Other choice would be a generic macro...

int dev_set_promiscuity(struct net_device *dev, int inc)
{
DEFINE_VARIABLE(temp, dev->flags);
...
}

Hmm...

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

* Re: [PATCH] net: net_device flags is an unsigned int
  2011-12-01  4:48   ` Eric Dumazet
@ 2011-12-01  5:05     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2011-12-01  5:05 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 01 Dec 2011 05:48:14 +0100

> Le mercredi 30 novembre 2011 à 23:39 -0500, David Miller a écrit :
>> From: Eric Dumazet <eric.dumazet@gmail.com>
>> Date: Thu, 01 Dec 2011 05:34:37 +0100
>> 
>> > -	unsigned short old_flags = dev->flags;
>> > +	typeof(dev->flags) old_flags = dev->flags;
>> 
>> Please, create netdev_flags_t or similar, anything but this :-)
> 
> Hmm, I thought Linus hated types like this...

Yes, it is true.  But look at netdev_features_t

> Or how explain we dont have jiffies_t or similar ? ;)

:-)

Like you I just want something that automatically tracks any future
changes to the type.  However I want something that doesn't look so
ugly like that typeof() thing.

Sure, use typeof() in macros, you can hide it in such places.

But please not in plain sight in *.c files.

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

end of thread, other threads:[~2011-12-01  5:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-01  4:34 [PATCH] net: net_device flags is an unsigned int Eric Dumazet
2011-12-01  4:39 ` David Miller
2011-12-01  4:48   ` Eric Dumazet
2011-12-01  5:05     ` David Miller

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).