2005-09-28 21:43:07

by Roland Dreier

[permalink] [raw]
Subject: [PATCH] Make if_ether.h compile with CONFIG_SYSCTL=n

<linux/if_ether.h> tries to declare a sysctl table even if
CONFIG_SYSCTL is not defined, which breaks the build as below:

CC init/main.o
In file included from /scratch/Ksrc/linux-git/include/linux/netdevice.h:29,
from /scratch/Ksrc/linux-git/include/net/sock.h:48,
from /scratch/Ksrc/linux-git/init/main.c:50:
/scratch/Ksrc/linux-git/include/linux/if_ether.h:114: error: array type has incomplete element type

This patch wraps the declaration inside an #ifdef CONFIG_SYSCTL and
fixes my allnoconfig build.

Signed-off-by: Roland Dreier <[email protected]>

diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -104,6 +104,7 @@ struct ethhdr {
} __attribute__((packed));

#ifdef __KERNEL__
+#include <linux/config.h>
#include <linux/skbuff.h>

static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
@@ -111,7 +112,9 @@ static inline struct ethhdr *eth_hdr(con
return (struct ethhdr *)skb->mac.raw;
}

+#ifdef CONFIG_SYSCTL
extern struct ctl_table ether_table[];
#endif
+#endif

#endif /* _LINUX_IF_ETHER_H */