aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2008-11-04 17:19:00 +0100
committerWilly Tarreau <w@1wt.eu>2008-11-08 11:05:48 +0100
commit5e734b007c3072883d17d4a9e940f55acb4f351e (patch)
tree0aa5fb0f13c5fb133f7b23952e51ae2702e3411a
parentba1d099a08c23a17f8ff025954a74a1db7e6962b (diff)
downloadlinux-2.4-5e734b007c3072883d17d4a9e940f55acb4f351e.tar.gz
sanitise mii.h for userspace
In the 2.4 kernel mii.h is not suitable for normal inclusion outside the kernel. This was fixed for 2.6 by David Woodhouse <dwmw2@infradead.org> in April 2006. A patch for 2.4 (basically the same as the one committed for 2.6) is included [1]. Inclusion of mii.h was necessary for me when I developed a userspace networkdriver for OpenWRT. Regards, Jouke Witteveen
-rw-r--r--include/linux/mii.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/include/linux/mii.h b/include/linux/mii.h
index c87b17ff2cc36c..0c1271d2c5050a 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -9,7 +9,6 @@
#define __LINUX_MII_H__
#include <linux/types.h>
-#include <linux/if.h>
/* Generic MII registers. */
@@ -104,6 +103,19 @@
#define NWAYTEST_LOOPBACK 0x0100 /* Enable loopback for N-way */
#define NWAYTEST_RESV2 0xfe00 /* Unused... */
+/* This structure is used in all SIOCxMIIxxx ioctl calls */
+struct mii_ioctl_data {
+ __u16 phy_id;
+ __u16 reg_num;
+ __u16 val_in;
+ __u16 val_out;
+};
+
+#ifdef __KERNEL__
+
+#include <linux/if.h>
+
+struct ethtool_cmd;
struct mii_if_info {
int phy_id;
@@ -119,9 +131,6 @@ struct mii_if_info {
void (*mdio_write) (struct net_device *dev, int phy_id, int location, int val);
};
-struct ethtool_cmd;
-struct mii_ioctl_data;
-
extern int mii_link_ok (struct mii_if_info *mii);
extern int mii_nway_restart (struct mii_if_info *mii);
extern int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd);
@@ -135,16 +144,6 @@ extern int generic_mii_ioctl(struct mii_if_info *mii_if,
unsigned int *duplex_changed);
-
-/* This structure is used in all SIOCxMIIxxx ioctl calls */
-struct mii_ioctl_data {
- u16 phy_id;
- u16 reg_num;
- u16 val_in;
- u16 val_out;
-};
-
-
static inline struct mii_ioctl_data *if_mii(struct ifreq *rq)
{
return (struct mii_ioctl_data *) &rq->ifr_ifru;
@@ -202,5 +201,5 @@ static inline unsigned int mii_duplex (unsigned int duplex_lock,
return 0;
}
-
+#endif /* __KERNEL__ */
#endif /* __LINUX_MII_H__ */