From 8d3b73e0ab70c1110b5b479b02809b80891945cc Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Thu, 2 Oct 2008 20:21:16 +0000 Subject: First step towards cleaning up the Ethernet driver ioctl handling. Move calling ether_ioctl() from the top of the ioctl function, which at the moment does absolutely nothing, to the default switch case. Thus allowing drivers to define their own ioctl handlers and then falling back on ether_ioctl(). The only functional change this results in at the moment is having all Ethernet drivers returning the proper errno of ENOTTY instead of EINVAL/ENXIO when encountering unknown ioctl's. Shrinks the i386 kernels by.. RAMDISK - 1024 bytes RAMDISKB - 1120 bytes RAMDISKC - 832 bytes Tested by martin@/jsing@/todd@/brad@ Build tested on almost all archs by todd@/brad@ ok jsing@ --- sys/dev/sbus/be.c | 11 +++-------- sys/dev/sbus/qe.c | 10 ++-------- 2 files changed, 5 insertions(+), 16 deletions(-) (limited to 'sys/dev/sbus') diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c index 6c5d738cc2d..c73ef6b2ec0 100644 --- a/sys/dev/sbus/be.c +++ b/sys/dev/sbus/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.21 2008/09/10 14:01:23 blambert Exp $ */ +/* $OpenBSD: be.c,v 1.22 2008/10/02 20:21:14 brad Exp $ */ /* $NetBSD: be.c,v 1.26 2001/03/20 15:39:20 pk Exp $ */ /*- @@ -933,11 +933,6 @@ beioctl(struct ifnet *ifp, u_long cmd, caddr_t data) s = splnet(); - if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) { - splx(s); - return (error); - } - switch (cmd) { case SIOCSIFADDR: ifp->if_flags |= IFF_UP; @@ -1007,9 +1002,9 @@ beioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); break; default: - error = EINVAL; - break; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + splx(s); return (error); } diff --git a/sys/dev/sbus/qe.c b/sys/dev/sbus/qe.c index a242c7c2e26..e75e0ef2600 100644 --- a/sys/dev/sbus/qe.c +++ b/sys/dev/sbus/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.21 2008/06/26 05:42:18 ray Exp $ */ +/* $OpenBSD: qe.c,v 1.22 2008/10/02 20:21:14 brad Exp $ */ /* $NetBSD: qe.c,v 1.16 2001/03/30 17:30:18 christos Exp $ */ /*- @@ -905,11 +905,6 @@ qeioctl(ifp, cmd, data) s = splnet(); - if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) { - splx(s); - return (error); - } - switch (cmd) { case SIOCSIFADDR: ifp->if_flags |= IFF_UP; @@ -978,8 +973,7 @@ qeioctl(ifp, cmd, data) break; default: - error = EINVAL; - break; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } splx(s); -- cgit v1.2.3