From 8a7c0708b6fb7be245c21e9f6aabb0d8fd968a03 Mon Sep 17 00:00:00 2001 From: Alexander Duyck Date: Wed, 4 May 2011 11:41:40 -0700 Subject: Cleanup defines and header includes to address several issues This change is meant to address several issues. First it moves the check for ethtool-config.h into ethtool-util.h the reason for this change is so that any references to ethtool-util.h outside of ethtool.c will use the correct defines for the endian types. In addition I have pulled several headers that will be common to both ethtool.c and rxclass.c into the ethtool-util.h header file. I am also centralizing several macros that will be needed across multiple files when I implement the network flow classifier rules. Signed-off-by: Alexander Duyck Signed-off-by: Ben Hutchings --- ethtool-util.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'ethtool-util.h') diff --git a/ethtool-util.h b/ethtool-util.h index f053028..6a4f3f4 100644 --- a/ethtool-util.h +++ b/ethtool-util.h @@ -3,8 +3,13 @@ #ifndef ETHTOOL_UTIL_H__ #define ETHTOOL_UTIL_H__ +#ifdef HAVE_CONFIG_H +#include "ethtool-config.h" +#endif #include #include +#include +#include /* ethtool.h expects these to be defined by */ #ifndef HAVE_BE_TYPES @@ -12,14 +17,14 @@ typedef __uint16_t __be16; typedef __uint32_t __be32; #endif -#include "ethtool-copy.h" - typedef unsigned long long u64; typedef __uint32_t u32; typedef __uint16_t u16; typedef __uint8_t u8; typedef __int32_t s32; +#include "ethtool-copy.h" + #if __BYTE_ORDER == __BIG_ENDIAN static inline u16 cpu_to_be16(u16 value) { @@ -40,6 +45,14 @@ static inline u32 cpu_to_be32(u32 value) } #endif +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#endif + +#ifndef SIOCETHTOOL +#define SIOCETHTOOL 0x8946 +#endif + /* National Semiconductor DP83815, DP83816 */ int natsemi_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs); int natsemi_dump_eeprom(struct ethtool_drvinfo *info, -- cgit v1.2.1