Skip to contentSkip to conversation

Shrink ip_vs_*.c includes

RFC PATCH In review Roberto Nibali 3 participants 6 messages Feb 6, 2006 – Feb 7, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Shrink ip_vs_*.c includes

Hello,

This patch against the latest GIT HEAD reduces the includes to the necessary ones. I've compile-tested it against following (and s/y/m/) configuration on x86:

CONFIG_IP_VS=y
CONFIG_IP_VS_DEBUG=y
CONFIG_IP_VS_TAB_BITS=12
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y
CONFIG_IP_VS_RR=y
CONFIG_IP_VS_WRR=y
CONFIG_IP_VS_LC=y
CONFIG_IP_VS_WLC=y
CONFIG_IP_VS_LBLC=y
CONFIG_IP_VS_LBLCR=y
CONFIG_IP_VS_DH=y
CONFIG_IP_VS_SH=y
CONFIG_IP_VS_SED=y
CONFIG_IP_VS_NQ=y
CONFIG_IP_VS_FTP=y

Please consider applying (but test it first on your local tree since we don't want stupid breakage resulting from such changes).

Alternatively/additionally I could envision a patch on top of this one that completely removes the includes from the ../net/ipv4/ipvs/*.c except the ../include/net/ip_vs.h, which would carry all the needed header includes.

Best regards,
Roberto Nibali, ratz

Signature · 1 line
echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq' | dc
net/ipv4/ipvs/ip_vs_app.c +0 -8
index 9b176a9..9f5676b 100644
@@ -20,17 +20,9 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
-#include <linux/in.h>
-#include <linux/ip.h>
-#include <net/protocol.h>
 #include <net/tcp.h>
-#include <asm/system.h>
-#include <linux/stat.h>
 #include <linux/proc_fs.h>
-#include <linux/seq_file.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_conn.c +2 -5
index 87b8381..b3e8dc5 100644
@@ -24,14 +24,11 @@
  *
  */
 
-#include <linux/interrupt.h>
 #include <linux/in.h>
 #include <linux/net.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/vmalloc.h>
-#include <linux/proc_fs.h>		/* for proc_net_* */
-#include <linux/seq_file.h>
+#include <linux/proc_fs.h>
 #include <linux/jhash.h>
 #include <linux/random.h>
 
net/ipv4/ipvs/ip_vs_core.c +1 -7
index 3f47ad8..927fbc0 100644
@@ -26,19 +26,13 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/ip.h>
 #include <linux/tcp.h>
 #include <linux/icmp.h>
 
 #include <net/ip.h>
-#include <net/tcp.h>
-#include <net/udp.h>
 #include <net/icmp.h>                   /* for icmp_send */
-#include <net/route.h>
+#include <net/route.h>			/* for inet_addr_type */
 
-#include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_ctl.c +1 -13
index 7f0288b..a130c5f 100644
@@ -20,26 +20,14 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/capability.h>
-#include <linux/fs.h>
-#include <linux/sysctl.h>
 #include <linux/proc_fs.h>
-#include <linux/workqueue.h>
-#include <linux/swap.h>
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-
-#include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip.h>
 #include <net/route.h>
 #include <net/sock.h>
 
-#include <asm/uaccess.h>
+//#include <asm/uaccess.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_dh.c +0 -2
index 9fee19c..e40998c 100644
@@ -38,8 +38,6 @@
  */
 
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_est.c +0 -4
index c453e1e..ce3d3c3 100644
@@ -13,12 +13,8 @@
  * Changes:
  *
  */
-#include <linux/config.h>
-#include <linux/kernel.h>
 #include <linux/jiffies.h>
 #include <linux/slab.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_ftp.c +0 -6
index a19a33c..ab730b1 100644
@@ -24,13 +24,7 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
-#include <linux/in.h>
-#include <linux/ip.h>
-#include <net/protocol.h>
 #include <net/tcp.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_lblc.c +0 -6
index 6e5cb92..ae51ae8 100644
@@ -42,14 +42,8 @@
  */
 
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
 
-/* for sysctl */
-#include <linux/fs.h>
-#include <linux/sysctl.h>
-
 #include <net/ip_vs.h>
 
 
net/ipv4/ipvs/ip_vs_lblcr.c +0 -8
index 32ba37b..ebe05a8 100644
@@ -40,16 +40,8 @@
  */
 
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
 
-/* for sysctl */
-#include <linux/fs.h>
-#include <linux/sysctl.h>
-/* for proc_net_create/proc_net_remove */
-#include <linux/proc_fs.h>
-
 #include <net/ip_vs.h>
 
 
net/ipv4/ipvs/ip_vs_lc.c +0 -1
index d88fef9..db63c0f 100644
@@ -17,7 +17,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_nq.c +0 -1
index bc2a9e5..f1b4341 100644
@@ -34,7 +34,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_proto.c +0 -9
index 867d4e9..9084338 100644
@@ -15,17 +15,8 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
-#include <linux/in.h>
-#include <linux/ip.h>
-#include <net/protocol.h>
 #include <net/tcp.h>
-#include <net/udp.h>
-#include <asm/system.h>
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_proto_ah.c +0 -3
index 8b0505b..cb95f58 100644
@@ -14,9 +14,6 @@
 
 #include <linux/in.h>
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_proto_esp.c +0 -3
index c36ccf0..bcbad11 100644
@@ -14,9 +14,6 @@
 
 #include <linux/in.h>
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_proto_tcp.c +1 -5
index bc28b11..deb98e7 100644
@@ -15,11 +15,7 @@
  *
  */
 
-#include <linux/kernel.h>
-#include <linux/ip.h>
-#include <linux/tcp.h>                  /* for tcphdr */
-#include <net/ip.h>
-#include <net/tcp.h>                    /* for csum_tcpudp_magic */
+#include <net/tcp.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_proto_udp.c +1 -2
index 89d9175..7ffd5c2 100644
@@ -17,9 +17,8 @@
 
 #include <linux/in.h>
 #include <linux/ip.h>
-#include <linux/kernel.h>
-#include <linux/netfilter_ipv4.h>
 #include <linux/udp.h>
+#include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_rr.c +0 -1
index b23bab2..00ebed8 100644
@@ -22,7 +22,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_sched.c +0 -5
index 8bc42b7..8abc2e9 100644
@@ -20,11 +20,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/spinlock.h>
-#include <linux/interrupt.h>
-#include <asm/string.h>
-#include <linux/kmod.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_sed.c +0 -1
index ff366f7..8269e6c 100644
@@ -38,7 +38,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_sh.c +0 -2
index 7775e6c..878c63f 100644
@@ -35,8 +35,6 @@
  */
 
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_sync.c +1 -8
index 1bca714..8d2dba4 100644
@@ -19,20 +19,13 @@
  *	Justin Ossevoort	:	Fix endian problem on sync message size.
  */
 
-#include <linux/module.h>
-#include <linux/slab.h>
 #include <linux/inetdevice.h>
-#include <linux/net.h>
-#include <linux/completion.h>
 #include <linux/delay.h>
-#include <linux/skbuff.h>
-#include <linux/in.h>
 #include <linux/igmp.h>                 /* for ip_mc_join_group */
 #include <linux/udp.h>
+#include <linux/sched.h>
 
 #include <net/ip.h>
-#include <net/sock.h>
-#include <asm/uaccess.h>                /* for get_fs and set_fs */
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_wlc.c +0 -1
index 8a9d913..6d90a7c 100644
@@ -22,7 +22,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_wrr.c +0 -1
index 749fa04..bfcd5fb 100644
@@ -21,7 +21,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_xmit.c +1 -6
index 52c12e9..19d85e3 100644
@@ -15,14 +15,9 @@
  *
  */
 
-#include <linux/kernel.h>
-#include <linux/ip.h>
-#include <linux/tcp.h>                  /* for tcphdr */
-#include <net/tcp.h>                    /* for csum_tcpudp_magic */
-#include <net/udp.h>
+#include <net/ip.h>
 #include <net/icmp.h>                   /* for icmp_send */
 #include <net/route.h>                  /* for ip_route_output */
-#include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
#1 lore raw
Quoted 25 lines · Roberto Nibali

Hello,

This patch against the latest GIT HEAD reduces the includes to the necessary ones. I've compile-tested it against following (and s/y/m/) configuration on x86:

CONFIG_IP_VS=y
CONFIG_IP_VS_DEBUG=y
CONFIG_IP_VS_TAB_BITS=12
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y
CONFIG_IP_VS_RR=y
CONFIG_IP_VS_WRR=y
CONFIG_IP_VS_LC=y
CONFIG_IP_VS_WLC=y
CONFIG_IP_VS_LBLC=y
CONFIG_IP_VS_LBLCR=y
CONFIG_IP_VS_DH=y
CONFIG_IP_VS_SH=y
CONFIG_IP_VS_SED=y
CONFIG_IP_VS_NQ=y
CONFIG_IP_VS_FTP=y

Quoted 7 lines

Please consider applying (but test it first on your local tree since we don't want stupid breakage resulting from such changes).

Alternatively/additionally I could envision a patch on top of this one that completely removes the includes from the ../net/ipv4/ipvs/*.c except the ../include/net/ip_vs.h, which would carry all the needed header includes.

Hi Rats,

I'm all for this patch, but I get horrible breakage with the following config (I can give the rest if you need it).

CONFIG_IP_VS=m
# CONFIG_IP_VS_DEBUG is not set
CONFIG_IP_VS_TAB_BITS=12
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y
CONFIG_IP_VS_RR=m
CONFIG_IP_VS_WRR=m
CONFIG_IP_VS_LC=m
CONFIG_IP_VS_WLC=m
CONFIG_IP_VS_LBLC=m
CONFIG_IP_VS_LBLCR=m
CONFIG_IP_VS_DH=m
CONFIG_IP_VS_SH=m
CONFIG_IP_VS_SED=m
CONFIG_IP_VS_NQ=m
CONFIG_IP_VS_FTP=m

# make
  CHK     include/linux/version.h
  CHK     include/linux/compile.h
  CHK     usr/initramfs_list
  CC [M]  net/ipv4/ipvs/ip_vs_conn.o
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_array':
net/ipv4/ipvs/ip_vs_conn.c:672: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_seq_start':
net/ipv4/ipvs/ip_vs_conn.c:684: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c:685: error: 'SEQ_START_TOKEN' undeclared (first use in this function)
net/ipv4/ipvs/ip_vs_conn.c:685: error: (Each undeclared identifier is reported only once
net/ipv4/ipvs/ip_vs_conn.c:685: error: for each function it appears in.)
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_seq_next':
net/ipv4/ipvs/ip_vs_conn.c:691: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c:695: error: 'SEQ_START_TOKEN' undeclared (first use in this function)
net/ipv4/ipvs/ip_vs_conn.c:708: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c:713: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_seq_stop':
net/ipv4/ipvs/ip_vs_conn.c:719: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_seq_show':
net/ipv4/ipvs/ip_vs_conn.c:728: error: 'SEQ_START_TOKEN' undeclared (first use in this function)
net/ipv4/ipvs/ip_vs_conn.c:729: warning: implicit declaration of function 'seq_puts'
net/ipv4/ipvs/ip_vs_conn.c:734: warning: implicit declaration of function 'seq_printf'
net/ipv4/ipvs/ip_vs_conn.c: At top level:
net/ipv4/ipvs/ip_vs_conn.c:746: error: variable 'ip_vs_conn_seq_ops' has initializer but incomplete type
net/ipv4/ipvs/ip_vs_conn.c:747: error: unknown field 'start' specified in initializer
net/ipv4/ipvs/ip_vs_conn.c:747: warning: excess elements in struct initializer
net/ipv4/ipvs/ip_vs_conn.c:747: warning: (near initialization for 'ip_vs_conn_seq_ops')
net/ipv4/ipvs/ip_vs_conn.c:748: error: unknown field 'next' specified in initializer
net/ipv4/ipvs/ip_vs_conn.c:748: warning: excess elements in struct initializer
net/ipv4/ipvs/ip_vs_conn.c:748: warning: (near initialization for 'ip_vs_conn_seq_ops')
net/ipv4/ipvs/ip_vs_conn.c:749: error: unknown field 'stop' specified in initializer
net/ipv4/ipvs/ip_vs_conn.c:749: warning: excess elements in struct initializer
net/ipv4/ipvs/ip_vs_conn.c:749: warning: (near initialization for 'ip_vs_conn_seq_ops')
net/ipv4/ipvs/ip_vs_conn.c:750: error: unknown field 'show' specified in initializer
net/ipv4/ipvs/ip_vs_conn.c:750: warning: excess elements in struct initializer
net/ipv4/ipvs/ip_vs_conn.c:750: warning: (near initialization for 'ip_vs_conn_seq_ops')
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_open':
net/ipv4/ipvs/ip_vs_conn.c:755: warning: implicit declaration of function 'seq_open'
net/ipv4/ipvs/ip_vs_conn.c: At top level:
net/ipv4/ipvs/ip_vs_conn.c:759: error: 'THIS_MODULE' undeclared here (not in a function)
net/ipv4/ipvs/ip_vs_conn.c:761: error: 'seq_read' undeclared here (not in a function)
net/ipv4/ipvs/ip_vs_conn.c:762: error: 'seq_lseek' undeclared here (not in a function)
net/ipv4/ipvs/ip_vs_conn.c:763: error: 'seq_release' undeclared here (not in a function)
make[3]: *** [net/ipv4/ipvs/ip_vs_conn.o] Error 1
make[2]: *** [net/ipv4/ipvs] Error 2
make[1]: *** [net/ipv4] Error 2
make: *** [net] Error 2
Signature · 1 line
Horms
#2 lore raw
Quoted 4 lines

Hi Rats,

I'm all for this patch, but I get horrible breakage with the following config (I can give the rest if you need it).

Darn!

Quoted 10 lines

CONFIG_IP_VS=m
# CONFIG_IP_VS_DEBUG is not set
CONFIG_IP_VS_TAB_BITS=12
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y
CONFIG_IP_VS_RR=m
CONFIG_IP_VS_WRR=m
CONFIG_IP_VS_LC=m

Quoted 8 lines

CONFIG_IP_VS_WLC=m
CONFIG_IP_VS_LBLC=m
CONFIG_IP_VS_LBLCR=m
CONFIG_IP_VS_DH=m
CONFIG_IP_VS_SH=m
CONFIG_IP_VS_SED=m
CONFIG_IP_VS_NQ=m
CONFIG_IP_VS_FTP=m

Ok, this is m/y mixed. Haven't tried it yet.

Quoted 40 lines
# make
  CHK     include/linux/version.h
  CHK     include/linux/compile.h
  CHK     usr/initramfs_list
  CC [M]  net/ipv4/ipvs/ip_vs_conn.o
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_array':
net/ipv4/ipvs/ip_vs_conn.c:672: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_seq_start':
net/ipv4/ipvs/ip_vs_conn.c:684: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c:685: error: 'SEQ_START_TOKEN' undeclared (first use in this function)
net/ipv4/ipvs/ip_vs_conn.c:685: error: (Each undeclared identifier is reported only once
net/ipv4/ipvs/ip_vs_conn.c:685: error: for each function it appears in.)
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_seq_next':
net/ipv4/ipvs/ip_vs_conn.c:691: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c:695: error: 'SEQ_START_TOKEN' undeclared (first use in this function)
net/ipv4/ipvs/ip_vs_conn.c:708: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c:713: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_seq_stop':
net/ipv4/ipvs/ip_vs_conn.c:719: error: dereferencing pointer to incomplete type
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_seq_show':
net/ipv4/ipvs/ip_vs_conn.c:728: error: 'SEQ_START_TOKEN' undeclared (first use in this function)
net/ipv4/ipvs/ip_vs_conn.c:729: warning: implicit declaration of function 'seq_puts'
net/ipv4/ipvs/ip_vs_conn.c:734: warning: implicit declaration of function 'seq_printf'
net/ipv4/ipvs/ip_vs_conn.c: At top level:
net/ipv4/ipvs/ip_vs_conn.c:746: error: variable 'ip_vs_conn_seq_ops' has initializer but incomplete type
net/ipv4/ipvs/ip_vs_conn.c:747: error: unknown field 'start' specified in initializer
net/ipv4/ipvs/ip_vs_conn.c:747: warning: excess elements in struct initializer
net/ipv4/ipvs/ip_vs_conn.c:747: warning: (near initialization for 'ip_vs_conn_seq_ops')
net/ipv4/ipvs/ip_vs_conn.c:748: error: unknown field 'next' specified in initializer
net/ipv4/ipvs/ip_vs_conn.c:748: warning: excess elements in struct initializer
net/ipv4/ipvs/ip_vs_conn.c:748: warning: (near initialization for 'ip_vs_conn_seq_ops')
net/ipv4/ipvs/ip_vs_conn.c:749: error: unknown field 'stop' specified in initializer
net/ipv4/ipvs/ip_vs_conn.c:749: warning: excess elements in struct initializer
net/ipv4/ipvs/ip_vs_conn.c:749: warning: (near initialization for 'ip_vs_conn_seq_ops')
net/ipv4/ipvs/ip_vs_conn.c:750: error: unknown field 'show' specified in initializer
net/ipv4/ipvs/ip_vs_conn.c:750: warning: excess elements in struct initializer
net/ipv4/ipvs/ip_vs_conn.c:750: warning: (near initialization for 'ip_vs_conn_seq_ops')
net/ipv4/ipvs/ip_vs_conn.c: In function 'ip_vs_conn_open':
net/ipv4/ipvs/ip_vs_conn.c:755: warning: implicit declaration of function 'seq_open'
net/ipv4/ipvs/ip_vs_conn.c: At top level:
Quoted 9 lines
net/ipv4/ipvs/ip_vs_conn.c:759: error: 'THIS_MODULE' undeclared here (not in a function)
net/ipv4/ipvs/ip_vs_conn.c:761: error: 'seq_read' undeclared here (not in a function)
net/ipv4/ipvs/ip_vs_conn.c:762: error: 'seq_lseek' undeclared here (not in a function)
net/ipv4/ipvs/ip_vs_conn.c:763: error: 'seq_release' undeclared here (not in a function)
make[3]: *** [net/ipv4/ipvs/ip_vs_conn.o] Error 1
make[2]: *** [net/ipv4/ipvs] Error 2
make[1]: *** [net/ipv4] Error 2
make: *** [net] Error 2

I'll reproduce it with your config. I didn't think of trying it with mixed y/m settings. Following include is missing then:

#include <linux/seq_file.h>

Or do you think we could put all the needed includes into ip_vs.h and simply be done with it?

Best regards,
Roberto Nibali, ratz

Signature · 7 lines
-------------------------------------------------------------
addr://Kasinostrasse 30, CH-5001 Aarau tel://++41 62 823 9355
http://www.terreactive.com             fax://++41 62 823 9356
-------------------------------------------------------------
10 Jahre Kompetenz in IT-Sicherheit.              1996 - 2006
Wir sichern Ihren Erfolg.                      terreActive AG
-------------------------------------------------------------
#3 lore raw
Quoted 26 lines · In gmane.comp.linux.lvs.user Roberto Nibali
Quoted 4 lines

Hi Rats,

I'm all for this patch, but I get horrible breakage with the following config (I can give the rest if you need it).

Darn!

Quoted 10 lines

CONFIG_IP_VS=m
# CONFIG_IP_VS_DEBUG is not set
CONFIG_IP_VS_TAB_BITS=12
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y
CONFIG_IP_VS_RR=m
CONFIG_IP_VS_WRR=m
CONFIG_IP_VS_LC=m

Quoted 8 lines

CONFIG_IP_VS_WLC=m
CONFIG_IP_VS_LBLC=m
CONFIG_IP_VS_LBLCR=m
CONFIG_IP_VS_DH=m
CONFIG_IP_VS_SH=m
CONFIG_IP_VS_SED=m
CONFIG_IP_VS_NQ=m
CONFIG_IP_VS_FTP=m

Quoted 1 line

Ok, this is m/y mixed. Haven't tried it yet.

Actually, I think that its completely modular.

[snip]

Quoted 4 lines

I'll reproduce it with your config. I didn't think of trying it with mixed y/m settings. Following include is missing then:

#include <linux/seq_file.h>

Thanks, I found that linux/module.h was also needed.
After putting those two back into ip_vs_conn.c the build went find. I also tried a few other combinations, all on ia64, without issue. My diff is below. Could you recheck it?

Quoted 2 lines

Or do you think we could put all the needed includes into ip_vs.h and simply be done with it?

I spoke breifly with Dave about this, and he isn't very keen on it. The problem with that approach, is that while its less work to maintain the headers by hand, it will likely result in uneeded includes in some cases. So all of LVS will get built when a given header is touched, where perhaps only half of it needed to be built. So with that in mind, could you continue in the vein of your original patch?

Signature · 37 lines
Horms

Hello,

This patch against the latest GIT HEAD reduces the includes to the
necessary ones. I've compile-tested it against following (and s/y/m/)
configuration on x86:

CONFIG_IP_VS=y
CONFIG_IP_VS_DEBUG=y
CONFIG_IP_VS_TAB_BITS=12
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y
CONFIG_IP_VS_RR=y
CONFIG_IP_VS_WRR=y
CONFIG_IP_VS_LC=y
CONFIG_IP_VS_WLC=y
CONFIG_IP_VS_LBLC=y
CONFIG_IP_VS_LBLCR=y
CONFIG_IP_VS_DH=y
CONFIG_IP_VS_SH=y
CONFIG_IP_VS_SED=y
CONFIG_IP_VS_NQ=y
CONFIG_IP_VS_FTP=y

Please consider applying (but test it first on your local tree since we
don't want stupid breakage resulting from such changes).

Alternatively/additionally I could envision a patch on top of this one
that completely removes the includes from the ../net/ipv4/ipvs/*.c
except the ../include/net/ip_vs.h, which would carry all the needed
header includes.

Signed-off-by: Roberto Nibali <[email protected]>
Signed-off-by: Horms <[email protected]>
net/ipv4/ipvs/ip_vs_app.c +0 -8
index 9b176a9..9f5676b 100644
@@ -20,17 +20,9 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
-#include <linux/in.h>
-#include <linux/ip.h>
-#include <net/protocol.h>
 #include <net/tcp.h>
-#include <asm/system.h>
-#include <linux/stat.h>
 #include <linux/proc_fs.h>
-#include <linux/seq_file.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_conn.c +2 -3
index 87b8381..157b9ad 100644
@@ -24,13 +24,12 @@
  *
  */
 
-#include <linux/interrupt.h>
 #include <linux/in.h>
 #include <linux/net.h>
-#include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 #include <linux/vmalloc.h>
-#include <linux/proc_fs.h>		/* for proc_net_* */
+#include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/jhash.h>
 #include <linux/random.h>
net/ipv4/ipvs/ip_vs_core.c +1 -7
index 3f47ad8..927fbc0 100644
@@ -26,19 +26,13 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/ip.h>
 #include <linux/tcp.h>
 #include <linux/icmp.h>
 
 #include <net/ip.h>
-#include <net/tcp.h>
-#include <net/udp.h>
 #include <net/icmp.h>                   /* for icmp_send */
-#include <net/route.h>
+#include <net/route.h>			/* for inet_addr_type */
 
-#include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_ctl.c +1 -13
index 7f0288b..a130c5f 100644
@@ -20,26 +20,14 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/capability.h>
-#include <linux/fs.h>
-#include <linux/sysctl.h>
 #include <linux/proc_fs.h>
-#include <linux/workqueue.h>
-#include <linux/swap.h>
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-
-#include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip.h>
 #include <net/route.h>
 #include <net/sock.h>
 
-#include <asm/uaccess.h>
+//#include <asm/uaccess.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_dh.c +0 -2
index 9fee19c..e40998c 100644
@@ -38,8 +38,6 @@
  */
 
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_est.c +0 -4
index c453e1e..ce3d3c3 100644
@@ -13,12 +13,8 @@
  * Changes:
  *
  */
-#include <linux/config.h>
-#include <linux/kernel.h>
 #include <linux/jiffies.h>
 #include <linux/slab.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_ftp.c +0 -6
index a19a33c..ab730b1 100644
@@ -24,13 +24,7 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
-#include <linux/in.h>
-#include <linux/ip.h>
-#include <net/protocol.h>
 #include <net/tcp.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_lblc.c +0 -6
index 6e5cb92..ae51ae8 100644
@@ -42,14 +42,8 @@
  */
 
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
 
-/* for sysctl */
-#include <linux/fs.h>
-#include <linux/sysctl.h>
-
 #include <net/ip_vs.h>
 
 
net/ipv4/ipvs/ip_vs_lblcr.c +0 -8
index 32ba37b..ebe05a8 100644
@@ -40,16 +40,8 @@
  */
 
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
 
-/* for sysctl */
-#include <linux/fs.h>
-#include <linux/sysctl.h>
-/* for proc_net_create/proc_net_remove */
-#include <linux/proc_fs.h>
-
 #include <net/ip_vs.h>
 
 
net/ipv4/ipvs/ip_vs_lc.c +0 -1
index d88fef9..db63c0f 100644
@@ -17,7 +17,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_nq.c +0 -1
index bc2a9e5..f1b4341 100644
@@ -34,7 +34,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_proto.c +0 -9
index 867d4e9..9084338 100644
@@ -15,17 +15,8 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
-#include <linux/in.h>
-#include <linux/ip.h>
-#include <net/protocol.h>
 #include <net/tcp.h>
-#include <net/udp.h>
-#include <asm/system.h>
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_proto_ah.c +0 -3
index 8b0505b..cb95f58 100644
@@ -14,9 +14,6 @@
 
 #include <linux/in.h>
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_proto_esp.c +0 -3
index c36ccf0..bcbad11 100644
@@ -14,9 +14,6 @@
 
 #include <linux/in.h>
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_proto_tcp.c +1 -5
index bc28b11..deb98e7 100644
@@ -15,11 +15,7 @@
  *
  */
 
-#include <linux/kernel.h>
-#include <linux/ip.h>
-#include <linux/tcp.h>                  /* for tcphdr */
-#include <net/ip.h>
-#include <net/tcp.h>                    /* for csum_tcpudp_magic */
+#include <net/tcp.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_proto_udp.c +1 -2
index 89d9175..7ffd5c2 100644
@@ -17,9 +17,8 @@
 
 #include <linux/in.h>
 #include <linux/ip.h>
-#include <linux/kernel.h>
-#include <linux/netfilter_ipv4.h>
 #include <linux/udp.h>
+#include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_rr.c +0 -1
index b23bab2..00ebed8 100644
@@ -22,7 +22,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_sched.c +0 -5
index 8bc42b7..8abc2e9 100644
@@ -20,11 +20,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/spinlock.h>
-#include <linux/interrupt.h>
-#include <asm/string.h>
-#include <linux/kmod.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_sed.c +0 -1
index ff366f7..8269e6c 100644
@@ -38,7 +38,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_sh.c +0 -2
index 7775e6c..878c63f 100644
@@ -35,8 +35,6 @@
  */
 
 #include <linux/ip.h>
-#include <linux/module.h>
-#include <linux/kernel.h>
 #include <linux/skbuff.h>
 
 #include <net/ip_vs.h>
net/ipv4/ipvs/ip_vs_sync.c +1 -8
index 1bca714..8d2dba4 100644
@@ -19,20 +19,13 @@
  *	Justin Ossevoort	:	Fix endian problem on sync message size.
  */
 
-#include <linux/module.h>
-#include <linux/slab.h>
 #include <linux/inetdevice.h>
-#include <linux/net.h>
-#include <linux/completion.h>
 #include <linux/delay.h>
-#include <linux/skbuff.h>
-#include <linux/in.h>
 #include <linux/igmp.h>                 /* for ip_mc_join_group */
 #include <linux/udp.h>
+#include <linux/sched.h>
 
 #include <net/ip.h>
-#include <net/sock.h>
-#include <asm/uaccess.h>                /* for get_fs and set_fs */
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_wlc.c +0 -1
index 8a9d913..6d90a7c 100644
@@ -22,7 +22,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_wrr.c +0 -1
index 749fa04..bfcd5fb 100644
@@ -21,7 +21,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/kernel.h>
 
 #include <net/ip_vs.h>
 
net/ipv4/ipvs/ip_vs_xmit.c +1 -6
index 52c12e9..19d85e3 100644
@@ -15,14 +15,9 @@
  *
  */
 
-#include <linux/kernel.h>
-#include <linux/ip.h>
-#include <linux/tcp.h>                  /* for tcphdr */
-#include <net/tcp.h>                    /* for csum_tcpudp_magic */
-#include <net/udp.h>
+#include <net/ip.h>
 #include <net/icmp.h>                   /* for icmp_send */
 #include <net/route.h>                  /* for ip_route_output */
-#include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
 
 #include <net/ip_vs.h>
#4 lore raw
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

CONFIG_IP_VS=m
# CONFIG_IP_VS_DEBUG is not set
CONFIG_IP_VS_TAB_BITS=12
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y

These 'y' caused me to think that it wasn't modular.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

CONFIG_IP_VS_RR=m
CONFIG_IP_VS_WRR=m
CONFIG_IP_VS_LC=m
CONFIG_IP_VS_WLC=m
CONFIG_IP_VS_LBLC=m
CONFIG_IP_VS_LBLCR=m
CONFIG_IP_VS_DH=m
CONFIG_IP_VS_SH=m
CONFIG_IP_VS_SED=m
CONFIG_IP_VS_NQ=m
CONFIG_IP_VS_FTP=m

Quoted 3 lines
Quoted 1 line

Ok, this is m/y mixed. Haven't tried it yet.

Actually, I think that its completely modular.

So why the heck didn't it trigger on my system? Is it because the include/net/* headers are not always included on ia64? Well, tant pis!

Quoted 6 lines
Quoted 4 lines

I'll reproduce it with your config. I didn't think of trying it with mixed y/m settings. Following include is missing then:

#include <linux/seq_file.h>

Thanks, I found that linux/module.h was also needed.

Ok. I thought this would get included by any of the other headers. Well, so long as it also compiles fine on your system, I'm good.

Quoted 3 lines

After putting those two back into ip_vs_conn.c the build went find. I also tried a few other combinations, all on ia64, without issue. My diff is below. Could you recheck it?

Seems fine to me, thanks for testing this. I would have felt really bad if I broke IPVS in mainline because of such changes.

Quoted 4 lines
Quoted 2 lines

Or do you think we could put all the needed includes into ip_vs.h and simply be done with it?

I spoke breifly with Dave about this, and he isn't very keen on it.

Fair enough.

Quoted 3 lines

The problem with that approach, is that while its less work to maintain the headers by hand, it will likely result in uneeded includes in some cases.

How so? All includes nota bene have the prevailing:

#ifndef _FOOBAR_H
#define _FOOBAR_H
[...]
#endif /* _FOOBAR_H */

framework. So would this speak slightely against that? Also, from the includes we take today, I reckon that in the end we half of the include/{net,linux}/*.h is in our objects :). But you guys decide. I could maybe run a call-graph.

Quoted 3 lines

So all of LVS will get built when
a given header is touched, where perhaps only half of it needed to be built.

Well, it does not happen so ofter that a core network related header is touched to my avail.

Quoted 2 lines

So with that in mind, could you continue in the vein of your original patch?

Sure thing. Your attached patch is fine; if you feel confident with our changes, submit it.

Best regards,
Roberto Nibali, ratz

Signature · 7 lines
-------------------------------------------------------------
addr://Kasinostrasse 30, CH-5001 Aarau tel://++41 62 823 9355
http://www.terreactive.com             fax://++41 62 823 9356
-------------------------------------------------------------
10 Jahre Kompetenz in IT-Sicherheit.              1996 - 2006
Wir sichern Ihren Erfolg.                      terreActive AG
-------------------------------------------------------------
#5 lore raw
Quoted 9 lines · In gmane.comp.linux.lvs.user Roberto Nibali
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

CONFIG_IP_VS=m
# CONFIG_IP_VS_DEBUG is not set
CONFIG_IP_VS_TAB_BITS=12
CONFIG_IP_VS_PROTO_TCP=y
CONFIG_IP_VS_PROTO_UDP=y
CONFIG_IP_VS_PROTO_ESP=y
CONFIG_IP_VS_PROTO_AH=y

These 'y' caused me to think that it wasn't modular.

Me too :)

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

CONFIG_IP_VS_RR=m
CONFIG_IP_VS_WRR=m
CONFIG_IP_VS_LC=m
CONFIG_IP_VS_WLC=m
CONFIG_IP_VS_LBLC=m
CONFIG_IP_VS_LBLCR=m
CONFIG_IP_VS_DH=m
CONFIG_IP_VS_SH=m
CONFIG_IP_VS_SED=m
CONFIG_IP_VS_NQ=m
CONFIG_IP_VS_FTP=m

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Ok, this is m/y mixed. Haven't tried it yet.

Actually, I think that its completely modular.

So why the heck didn't it trigger on my system? Is it because the include/net/* headers are not always included on ia64? Well, tant pis!

I can reproduce the problem on x86 too.

Quoted 28 lines
Quoted 6 lines
Quoted 4 lines

I'll reproduce it with your config. I didn't think of trying it with mixed y/m settings. Following include is missing then:

#include <linux/seq_file.h>

Thanks, I found that linux/module.h was also needed.

Ok. I thought this would get included by any of the other headers. Well, so long as it also compiles fine on your system, I'm good.

Quoted 3 lines

After putting those two back into ip_vs_conn.c the build went find. I also tried a few other combinations, all on ia64, without issue. My diff is below. Could you recheck it?

Seems fine to me, thanks for testing this. I would have felt really bad if I broke IPVS in mainline because of such changes.

Quoted 4 lines
Quoted 2 lines

Or do you think we could put all the needed includes into ip_vs.h and simply be done with it?

I spoke breifly with Dave about this, and he isn't very keen on it.

Fair enough.

Quoted 3 lines

The problem with that approach, is that while its less work to maintain the headers by hand, it will likely result in uneeded includes in some cases.

Quoted 8 lines

How so? All includes nota bene have the prevailing:

#ifndef _FOOBAR_H
#define _FOOBAR_H
[...]
#endif /* _FOOBAR_H */

framework. So would this speak slightely against that?

I dare say that they do. However thats actually not the issue at hand. The problem is, lets say that a.h is listed in ip_vs.h because some of ipvs/*.c need it. Well, a.h is going to end up inclded in all of ipvs/*.c, even the ones that don't need it, and thus would otherwise not have it (assuming that we prune things by hand, as you have done). So if a.h gets touched, for some reason, then all of ipvs/*.c will be recompiled, some of which is not neccessary.

This of course assumes that there is some variance in the includes needed by the ipvs/*.c files. I think that is a fair assumption, though I haven't done any analysis on it. Its also a reasonable expectation that this could be the case in the future, even if it is not the case now.

Quoted 4 lines

Also, from the
includes we take today, I reckon that in the end we half of the include/{net,linux}/*.h is in our objects :). But you guys decide. I could maybe run a call-graph.

Thats a slightly different issue. Perhaps the headers should be cleaned up a little. But at least by taking the approach that your current patch does, IPVS can get the benifit of any subsequent cleanups, rather than partially annuling them.

Quoted 6 lines
Quoted 3 lines

So all of LVS will get built when
a given header is touched, where perhaps only half of it needed to be built.

Well, it does not happen so ofter that a core network related header is touched to my avail.

That I would tend to agree with. But Dave seemed to think it is worth the effort to break the headers out in IPVS, as they currently are. And I think its reasonable enough.

Quoted 5 lines
Quoted 2 lines

So with that in mind, could you continue in the vein of your original patch?

Sure thing. Your attached patch is fine; if you feel confident with our changes, submit it.

Will do. I'll drop the lvs-users CC as its a closed list whereas netdev isn't. For the benifit of people who are on lvs-users and not netdev, the patch will be the same as what I posted yesterday.

Signature · 1 line
Horms