From: David S. Miller
Sent: 1/17/2006 3:18:08 PM
> From: "Kris Katterjohn" <[EMAIL PROTECTED]>
> Date: Tue, 17 Jan 2006 09:03:22 -0800
> 
> > Are there any headers I'm deleting that _should_ be there, but not
> > necessarily required for a clean compilation? If so, let me know and
> > I'll redo the patch.
> 
> If the build still works, that doesn't mean much :-)
> 
> Often you get the necessary headers by accident through another header
> you are actually including.
> 
> The only tried and true way to go about this is to really look at what
> interfaces and data types the whole C file uses and make sure the
> necessary headers are there.
> 
> Other folks take another approach, wherein you pick a specific header
> file or interface, and walk over the tree making sure the header is
> used where it is needed and only where it is needed.
> 
> It would be nice to automate this, but that's not easy.

I went through and after following the structures, macros and functions, I was
still able to strip out most of the #includes.

You may want to double check, but these are the things that require extra
headers:

u32
struct sk_buff
struct sk_filter
struct sock_fprog
struct sock_filter
skb_header_pointer()
ntohl()/ntohs()/htons()
sock_kmalloc()
spin_lock_bh()/spin_unlock_bh()
atomic_set()
copy_from_user()
BPF_*
SKF_*_OFF

..and all are accounted for in the remaining headers.

And, yes, it would be very nice to automate this :)

Thanks!

Signed-off-by: Kris Katterjohn <[EMAIL PROTECTED]>

--- x/net/core/filter.c 2006-01-17 19:36:06.000000000 -0600
+++ y/net/core/filter.c 2006-01-17 20:22:25.000000000 -0600
@@ -16,23 +16,11 @@
  * Kris Katterjohn - Added many additional checks in sk_chk_filter()
  */
 
-#include <linux/module.h>
 #include <linux/types.h>
-#include <linux/sched.h>
 #include <linux/mm.h>
-#include <linux/fcntl.h>
-#include <linux/socket.h>
-#include <linux/in.h>
-#include <linux/inet.h>
-#include <linux/netdevice.h>
-#include <linux/if_packet.h>
-#include <net/ip.h>
-#include <net/protocol.h>
 #include <linux/skbuff.h>
 #include <net/sock.h>
 #include <linux/errno.h>
-#include <linux/timer.h>
-#include <asm/system.h>
 #include <asm/uaccess.h>
 #include <linux/filter.h>
 


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to