vlan:remove duplicate <linux/if_vlan.h>
Subsystems (2)
cover vlan:remove duplicate <linux/if_vlan.h>
As net/8021q/vlan.h already includes <linux/if_vlan.h>, so other files that includes vlan.h need not to include it.
But before we remove it from net/8021q/vlan_gvrp.c, we should first add add netdevice.h into stp.h.
[PATCH net-next 1/2]:add netdevice.h into stp.h [PATCH net-next 2/2]:remove duplicate <linux/if_vlan.h>
Weiping Pan (2):
stp:add netdevice.h into stp.h
vlan:remove duplicate <linux/if_vlan.h>
include/net/stp.h | 2 ++ net/8021q/vlan.c | 1 - net/8021q/vlan_core.c | 1 - net/8021q/vlan_dev.c | 1 - net/8021q/vlan_gvrp.c | 1 - net/8021q/vlan_netlink.c | 1 - net/8021q/vlanproc.c | 1 - 7 files changed, 2 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.4.4
PATCH 1/2 stp:add netdevice.h into stp.h
We don't meet a compile error becasue <linux/netdevice.h> is added by ohter header files, luckily.
I find this problem when I want to remove the duplicate <linux/if_vlan.h>. As net/8021q/vlan.h already includes it, so other files that includes vlan.h need not to include it.
But when I remove <linux/if_vlan.h> from net/8021q/vlan_gvrp.c, I met a compile error.
[pwp@localhost net-next]$ make O=../net-next_build/ M=net/8021q
CC net/8021q/vlan_core.o
LD net/8021q/built-in.o
CC [M] net/8021q/vlan.o
CC [M] net/8021q/vlan_dev.o
CC [M] net/8021q/vlan_netlink.o
CC [M] net/8021q/vlan_gvrp.o
In file included from /home/pwp/mysvn/linux/net-next/include/net/garp.h:4:0,
from /home/pwp/mysvn/linux/net-next/net/8021q/vlan_gvrp.c:12:/home/pwp/mysvn/linux/net-next/include/net/stp.h:5:30: error: ‘ETH_ALEN’ undeclared here (not in a function) /home/pwp/mysvn/linux/net-next/include/net/stp.h:7:18: warning: ‘struct net_device’ declared inside parameter list /home/pwp/mysvn/linux/net-next/include/net/stp.h:7:18: warning: its scope is only this definition or declaration, which is probably not what you want /home/pwp/mysvn/linux/net-next/include/net/stp.h:7:18: warning: ‘struct sk_buff’ declared inside parameter list
In file included from /home/pwp/mysvn/linux/net-next/net/8021q/vlan_gvrp.c:12:0:/home/pwp/mysvn/linux/net-next/include/net/garp.h:36:50: warning: ‘struct sk_buff’ declared inside parameter list /home/pwp/mysvn/linux/net-next/include/net/garp.h: In function ‘garp_cb’:/home/pwp/mysvn/linux/net-next/include/net/garp.h:38:2: error: implicit declaration of function ‘BUILD_BUG_ON’ /home/pwp/mysvn/linux/net-next/include/net/garp.h:39:8: error: implicit declaration of function ‘FIELD_SIZEOF’ /home/pwp/mysvn/linux/net-next/include/net/garp.h:39:21: error: expected expression before ‘struct’ /home/pwp/mysvn/linux/net-next/include/net/garp.h:40:34: error: dereferencing pointer to incomplete type /home/pwp/mysvn/linux/net-next/include/net/garp.h: At top level:/home/pwp/mysvn/linux/net-next/include/net/garp.h:79:19: error: field ‘node’ has incomplete type /home/pwp/mysvn/linux/net-next/include/net/garp.h:101:20: error: field ‘join_timer’ has incomplete type /home/pwp/mysvn/linux/net-next/include/net/garp.h:103:2: error: expected specifier-qualifier-list before ‘spinlock_t’ /home/pwp/mysvn/linux/net-next/include/net/garp.h:112:20: error: field ‘rcu’ has incomplete type
make[2]: *** [net/8021q/vlan_gvrp.o] Error 1
make[1]: *** [_module_net/8021q] Error 2
make: *** [sub-make] Error 2
--- include/net/stp.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/net/stp.h +2 -0
@@ -1,6 +1,8 @@ #ifndef _NET_STP_H #define _NET_STP_H +#include <linux/netdevice.h> + struct stp_proto { unsigned char group_address[ETH_ALEN]; void (*rcv)(const struct stp_proto *, struct sk_buff *,
Signature · 1 line
1.7.4.4
PATCH 2/2 vlan:remove duplicate <linux/if_vlan.h>
In reply to Weiping PanAs net/8021q/vlan.h already includes <linux/if_vlan.h>, so other files that includes vlan.h need not to include it.
--- net/8021q/vlan.c | 1 - net/8021q/vlan_core.c | 1 - net/8021q/vlan_dev.c | 1 - net/8021q/vlan_gvrp.c | 1 - net/8021q/vlan_netlink.c | 1 - net/8021q/vlanproc.c | 1 - 6 files changed, 0 insertions(+), 6 deletions(-)
net/8021q/vlan.c +0 -1
@@ -36,7 +36,6 @@#include <net/netns/generic.h> #include <asm/uaccess.h> -#include <linux/if_vlan.h> #include "vlan.h" #include "vlanproc.h"
net/8021q/vlan_core.c +0 -1
@@ -1,6 +1,5 @@#include <linux/skbuff.h> #include <linux/netdevice.h> -#include <linux/if_vlan.h> #include <linux/netpoll.h> #include "vlan.h"
net/8021q/vlan_dev.c +0 -1
@@ -32,7 +32,6 @@#include "vlan.h" #include "vlanproc.h" -#include <linux/if_vlan.h> /* * Rebuild the Ethernet MAC header. This is called after an ARP
net/8021q/vlan_gvrp.c +0 -1
@@ -8,7 +8,6 @@* version 2 as published by the Free Software Foundation. */ #include <linux/types.h> -#include <linux/if_vlan.h> #include <net/garp.h> #include "vlan.h"
net/8021q/vlan_netlink.c +0 -1
@@ -10,7 +10,6 @@#include <linux/kernel.h> #include <linux/netdevice.h> -#include <linux/if_vlan.h> #include <net/net_namespace.h> #include <net/netlink.h> #include <net/rtnetlink.h>
net/8021q/vlanproc.c +0 -1
@@ -27,7 +27,6 @@#include <linux/seq_file.h> #include <linux/fs.h> #include <linux/netdevice.h> -#include <linux/if_vlan.h> #include <net/net_namespace.h> #include <net/netns/generic.h> #include "vlanproc.h"
Signature · 1 line
1.7.4.4
David Miller
maintainerFrom: Weiping Pan <[email protected]>
Date: Thu, 28 Jul 2011 16:37:38 +0800
Quoted 2 lines
As
net/8021q/vlan.halready includes <linux/if_vlan.h>, so other files that includesvlan.hneed not to include it.
Please do not do this.
If someone wants to remove this implicit header dependency, that someone will need to add all of the includes back.
It is better for people to include all the headers they need, rather than rely upon such indirect inclusions.
I am not applying these patches.
Quoted 5 lines · David Miller
From: Weiping Pan<[email protected]>
Date: Thu, 28 Jul 2011 16:37:38 +0800Quoted 2 lines
As
net/8021q/vlan.halready includes<linux/if_vlan.h>, so other files that includesvlan.hneed not to include it.
Quoted 7 lines
Please do not do this.
If someone wants to remove this implicit header dependency, that someone will need to add all of the includes back.
It is better for people to include all the headers they need, rather than rely upon such indirect inclusions.
Ok, thanks.
Weiping Pan
Quoted 2 lines
I am not applying these patches.