diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-10-02 20:21:16 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-10-02 20:21:16 +0000 |
commit | 8d3b73e0ab70c1110b5b479b02809b80891945cc (patch) | |
tree | 6f9f4aecd17358436877da1307c753e5db774045 /sys/arch | |
parent | 6d6833da157e83635382235a3f52b938de757cc4 (diff) |
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@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mac68k/dev/if_mc.c | 6 | ||||
-rw-r--r-- | sys/arch/mac68k/dev/if_sn.c | 6 | ||||
-rw-r--r-- | sys/arch/macppc/dev/if_bm.c | 5 | ||||
-rw-r--r-- | sys/arch/macppc/dev/if_mc.c | 6 | ||||
-rw-r--r-- | sys/arch/mvme68k/dev/if_ie.c | 11 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/if_ie.c | 11 | ||||
-rw-r--r-- | sys/arch/sgi/dev/if_mec.c | 12 | ||||
-rw-r--r-- | sys/arch/socppc/dev/if_tsec.c | 11 | ||||
-rw-r--r-- | sys/arch/sparc/dev/be.c | 10 | ||||
-rw-r--r-- | sys/arch/sparc/dev/hme.c | 9 | ||||
-rw-r--r-- | sys/arch/sparc/dev/if_ie.c | 6 | ||||
-rw-r--r-- | sys/arch/sparc/dev/qe.c | 10 | ||||
-rw-r--r-- | sys/arch/vax/bi/if_ni.c | 7 | ||||
-rw-r--r-- | sys/arch/vax/if/if_qe.c | 7 | ||||
-rw-r--r-- | sys/arch/vax/if/sgec.c | 7 |
15 files changed, 43 insertions, 81 deletions
diff --git a/sys/arch/mac68k/dev/if_mc.c b/sys/arch/mac68k/dev/if_mc.c index 28d4ed8dd43..d485f35c9f4 100644 --- a/sys/arch/mac68k/dev/if_mc.c +++ b/sys/arch/mac68k/dev/if_mc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mc.c,v 1.16 2007/10/14 15:12:59 krw Exp $ */ +/* $OpenBSD: if_mc.c,v 1.17 2008/10/02 20:21:13 brad Exp $ */ /* $NetBSD: if_mc.c,v 1.24 2004/10/30 18:08:34 thorpej Exp $ */ /*- @@ -182,7 +182,6 @@ mcioctl(ifp, cmd, data) int s = splnet(), err = 0; switch (cmd) { - case SIOCSIFADDR: ifa = (struct ifaddr *)data; ifp->if_flags |= IFF_UP; @@ -243,8 +242,9 @@ mcioctl(ifp, cmd, data) } break; default: - err = EINVAL; + err = ether_ioctl(ifp, &sc->sc_ethercom, cmd, data); } + splx(s); return (err); } diff --git a/sys/arch/mac68k/dev/if_sn.c b/sys/arch/mac68k/dev/if_sn.c index b1a0590a0b6..5e2e50a15c3 100644 --- a/sys/arch/mac68k/dev/if_sn.c +++ b/sys/arch/mac68k/dev/if_sn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sn.c,v 1.47 2007/09/04 17:55:15 miod Exp $ */ +/* $OpenBSD: if_sn.c,v 1.48 2008/10/02 20:21:13 brad Exp $ */ /* $NetBSD: if_sn.c,v 1.13 1997/04/25 03:40:10 briggs Exp $ */ /* @@ -257,7 +257,6 @@ snioctl(struct ifnet *ifp, u_long cmd, caddr_t data) int s = splnet(), err = 0; switch (cmd) { - case SIOCSIFADDR: ifa = (struct ifaddr *)data; ifp->if_flags |= IFF_UP; @@ -319,8 +318,9 @@ snioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; default: - err = EINVAL; + err = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + splx(s); return (err); } diff --git a/sys/arch/macppc/dev/if_bm.c b/sys/arch/macppc/dev/if_bm.c index 67cf62e873c..eb0d056eb56 100644 --- a/sys/arch/macppc/dev/if_bm.c +++ b/sys/arch/macppc/dev/if_bm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bm.c,v 1.22 2007/04/22 22:31:14 deraadt Exp $ */ +/* $OpenBSD: if_bm.c,v 1.23 2008/10/02 20:21:13 brad Exp $ */ /* $NetBSD: if_bm.c,v 1.1 1999/01/01 01:27:52 tsubai Exp $ */ /*- @@ -753,7 +753,6 @@ bmac_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) s = splnet(); switch (cmd) { - case SIOCSIFADDR: ifp->if_flags |= IFF_UP; @@ -827,7 +826,7 @@ bmac_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; default: - error = EINVAL; + error = ether_ioctl(ifp, &sc->arpcom, cmd, data); } splx(s); diff --git a/sys/arch/macppc/dev/if_mc.c b/sys/arch/macppc/dev/if_mc.c index 54e89adbb0f..d2c9d086989 100644 --- a/sys/arch/macppc/dev/if_mc.c +++ b/sys/arch/macppc/dev/if_mc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mc.c,v 1.10 2007/04/22 22:31:14 deraadt Exp $ */ +/* $OpenBSD: if_mc.c,v 1.11 2008/10/02 20:21:13 brad Exp $ */ /* $NetBSD: if_mc.c,v 1.9.16.1 2006/06/21 14:53:13 yamt Exp $ */ /*- @@ -501,7 +501,6 @@ mc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) int s = splnet(), err = 0; switch (cmd) { - case SIOCSIFADDR: ifp->if_flags |= IFF_UP; if (!(ifp->if_flags & IFF_RUNNING)) @@ -555,8 +554,9 @@ mc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; default: - err = EINVAL; + err = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + splx(s); return (err); } diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c index e878731c6e1..6ae74e8b4b7 100644 --- a/sys/arch/mvme68k/dev/if_ie.c +++ b/sys/arch/mvme68k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.35 2006/04/16 00:46:32 pascoe Exp $ */ +/* $OpenBSD: if_ie.c,v 1.36 2008/10/02 20:21:13 brad Exp $ */ /*- * Copyright (c) 1999 Steve Murphree, Jr. @@ -1811,13 +1811,7 @@ ieioctl(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; @@ -1885,8 +1879,9 @@ ieioctl(ifp, cmd, data) break; default: - error = EINVAL; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + splx(s); return error; } diff --git a/sys/arch/mvme88k/dev/if_ie.c b/sys/arch/mvme88k/dev/if_ie.c index 107cb65fcbe..fc20ea22c19 100644 --- a/sys/arch/mvme88k/dev/if_ie.c +++ b/sys/arch/mvme88k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.41 2006/05/08 14:36:10 miod Exp $ */ +/* $OpenBSD: if_ie.c,v 1.42 2008/10/02 20:21:13 brad Exp $ */ /*- * Copyright (c) 1998 Steve Murphree, Jr. @@ -1794,13 +1794,7 @@ ieioctl(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; @@ -1868,8 +1862,9 @@ ieioctl(ifp, cmd, data) break; default: - error = EINVAL; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + splx(s); return error; } diff --git a/sys/arch/sgi/dev/if_mec.c b/sys/arch/sgi/dev/if_mec.c index c9b45f11635..064543c0f1e 100644 --- a/sys/arch/sgi/dev/if_mec.c +++ b/sys/arch/sgi/dev/if_mec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mec.c,v 1.15 2008/02/20 18:46:20 miod Exp $ */ +/* $OpenBSD: if_mec.c,v 1.16 2008/10/02 20:21:13 brad Exp $ */ /* $NetBSD: if_mec_mace.c,v 1.5 2004/08/01 06:36:36 tsutsui Exp $ */ /* @@ -1040,15 +1040,10 @@ mec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) struct mec_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; - int s, error; + int s, error = 0; s = splnet(); - if ((error = ether_ioctl(ifp, &sc->sc_ac, cmd, data)) > 0) { - splx(s); - return (error); - } - switch (cmd) { case SIOCSIFADDR: ifp->if_flags |= IFF_UP; @@ -1108,8 +1103,7 @@ mec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; default: - error = ENXIO; - break; + error = ether_ioctl(ifp, &sc->sc_ac, cmd, data); } splx(s); diff --git a/sys/arch/socppc/dev/if_tsec.c b/sys/arch/socppc/dev/if_tsec.c index cd8bf14c61f..170eb68e2e4 100644 --- a/sys/arch/socppc/dev/if_tsec.c +++ b/sys/arch/socppc/dev/if_tsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tsec.c,v 1.11 2008/08/07 17:56:51 brad Exp $ */ +/* $OpenBSD: if_tsec.c,v 1.12 2008/10/02 20:21:13 brad Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -456,14 +456,10 @@ tsec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) struct tsec_softc *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr *)addr; struct ifreq *ifr = (struct ifreq *)addr; - int error, s; + int error = 0, s; s = splnet(); - error = ether_ioctl(ifp, &sc->sc_ac, cmd, addr); - if (error) - goto err; - switch (cmd) { case SIOCSIFADDR: ifp->if_flags |= IFF_UP; @@ -510,11 +506,10 @@ tsec_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) break; default: - error = ENOTTY; + error = ether_ioctl(ifp, &sc->sc_ac, cmd, addr); break; } -err: splx(s); return (error); } diff --git a/sys/arch/sparc/dev/be.c b/sys/arch/sparc/dev/be.c index 50a5126a552..9cf5a694449 100644 --- a/sys/arch/sparc/dev/be.c +++ b/sys/arch/sparc/dev/be.c @@ -1,4 +1,4 @@ -/* $OpenBSD: be.c,v 1.40 2006/05/27 23:59:07 jason Exp $ */ +/* $OpenBSD: be.c,v 1.41 2008/10/02 20:21:13 brad Exp $ */ /* * Copyright (c) 1998 Theo de Raadt and Jason L. Wright. @@ -636,13 +636,9 @@ beioctl(ifp, cmd, data) error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd); break; default: - if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) { - splx(s); - return error; - } - error = ENOTTY; - break; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + splx(s); return error; } diff --git a/sys/arch/sparc/dev/hme.c b/sys/arch/sparc/dev/hme.c index 75883c28501..a9984cb6b21 100644 --- a/sys/arch/sparc/dev/hme.c +++ b/sys/arch/sparc/dev/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.55 2006/06/25 21:53:44 brad Exp $ */ +/* $OpenBSD: hme.c,v 1.56 2008/10/02 20:21:13 brad Exp $ */ /* * Copyright (c) 1998 Jason L. Wright (jason@thought.net) @@ -385,11 +385,6 @@ hmeioctl(ifp, cmd, data) s = splnet(); - if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) { - splx(s); - return (error); - } - switch (cmd) { case SIOCSIFADDR: switch (ifa->ifa_addr->sa_family) { @@ -466,7 +461,7 @@ hmeioctl(ifp, cmd, data) error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); break; default: - error = ENOTTY; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } sc->sc_if_flags = ifp->if_flags; diff --git a/sys/arch/sparc/dev/if_ie.c b/sys/arch/sparc/dev/if_ie.c index 61400a7f868..b26ae16859d 100644 --- a/sys/arch/sparc/dev/if_ie.c +++ b/sys/arch/sparc/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.37 2006/12/03 16:35:25 miod Exp $ */ +/* $OpenBSD: if_ie.c,v 1.38 2008/10/02 20:21:13 brad Exp $ */ /* $NetBSD: if_ie.c,v 1.33 1997/07/29 17:55:38 fair Exp $ */ /*- @@ -1954,7 +1954,6 @@ ieioctl(ifp, cmd, data) s = splnet(); switch(cmd) { - case SIOCSIFADDR: ifp->if_flags |= IFF_UP; @@ -2022,8 +2021,9 @@ ieioctl(ifp, cmd, data) break; default: - error = ENOTTY; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + splx(s); return error; } diff --git a/sys/arch/sparc/dev/qe.c b/sys/arch/sparc/dev/qe.c index f3599a03a7c..360ee17842a 100644 --- a/sys/arch/sparc/dev/qe.c +++ b/sys/arch/sparc/dev/qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qe.c,v 1.30 2006/05/27 23:59:07 jason Exp $ */ +/* $OpenBSD: qe.c,v 1.31 2008/10/02 20:21:13 brad Exp $ */ /* * Copyright (c) 1998, 2000 Jason L. Wright. @@ -655,13 +655,9 @@ qeioctl(ifp, cmd, data) error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd); break; default: - if ((error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data)) > 0) { - splx(s); - return (error); - } - error = ENOTTY; - break; + error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + splx(s); return (error); } diff --git a/sys/arch/vax/bi/if_ni.c b/sys/arch/vax/bi/if_ni.c index cdd803754e3..fb314d17770 100644 --- a/sys/arch/vax/bi/if_ni.c +++ b/sys/arch/vax/bi/if_ni.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ni.c,v 1.10 2007/05/11 10:06:55 pedro Exp $ */ +/* $OpenBSD: if_ni.c,v 1.11 2008/10/02 20:21:13 brad Exp $ */ /* $NetBSD: if_ni.c,v 1.15 2002/05/22 16:03:14 wiz Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved. @@ -700,7 +700,6 @@ niioctl(ifp, cmd, data) int s = splnet(), error = 0; switch (cmd) { - case SIOCSIFADDR: ifp->if_flags |= IFF_UP; switch(ifa->ifa_addr->sa_family) { @@ -759,9 +758,9 @@ niioctl(ifp, cmd, data) break; default: - error = EINVAL; - + error = ether_ioctl(ifp, &sc->sc_ec, cmd, data); } + splx(s); return (error); } diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c index 24dce6176a5..e1ac2c63350 100644 --- a/sys/arch/vax/if/if_qe.c +++ b/sys/arch/vax/if/if_qe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_qe.c,v 1.21 2007/09/17 01:33:33 krw Exp $ */ +/* $OpenBSD: if_qe.c,v 1.22 2008/10/02 20:21:13 brad Exp $ */ /* $NetBSD: if_qe.c,v 1.51 2002/06/08 12:28:37 ragge Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -636,7 +636,6 @@ qeioctl(struct ifnet *ifp, u_long cmd, caddr_t data) int s = splnet(), error = 0; switch (cmd) { - case SIOCSIFADDR: ifp->if_flags |= IFF_UP; switch(ifa->ifa_addr->sa_family) { @@ -695,9 +694,9 @@ qeioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; default: - error = EINVAL; - + error = ether_ioctl(ifp, &sc->sc_ac, cmd, data); } + splx(s); return (error); } diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c index e7dce2eddcc..f87af9772e8 100644 --- a/sys/arch/vax/if/sgec.c +++ b/sys/arch/vax/if/sgec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sgec.c,v 1.16 2008/08/22 17:09:06 deraadt Exp $ */ +/* $OpenBSD: sgec.c,v 1.17 2008/10/02 20:21:13 brad Exp $ */ /* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -630,7 +630,6 @@ zeioctl(ifp, cmd, data) int s = splnet(), error = 0; switch (cmd) { - case SIOCSIFADDR: ifp->if_flags |= IFF_UP; switch(ifa->ifa_addr->sa_family) { @@ -696,9 +695,9 @@ zeioctl(ifp, cmd, data) break; default: - error = EINVAL; - + error = ether_ioctl(ifp, &sc->sc_ac, cmd, data); } + splx(s); return (error); } |