Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Centralize wedge ioctls in disk_ioctl.



details:   https://anonhg.NetBSD.org/src/rev/a3c4fcbd6e86
branches:  trunk
changeset: 335244:a3c4fcbd6e86
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 31 17:06:48 2014 +0000

description:
Centralize wedge ioctls in disk_ioctl.

diffstat:

 sys/arch/emips/ebus/ace_ebus.c     |  44 +----------------------
 sys/arch/emips/ebus/flash_ebus.c   |  44 +----------------------
 sys/dev/ata/wd.c                   |  44 +----------------------
 sys/dev/ccd.c                      |  40 +--------------------
 sys/dev/dksubr.c                   |  55 +++++------------------------
 sys/dev/ld.c                       |  46 +-----------------------
 sys/dev/mca/ed_mca.c               |  50 +++-----------------------
 sys/dev/mscp/mscp_disk.c           |  62 ++++++++------------------------
 sys/dev/ofw/ofdisk.c               |  71 ++++++++-----------------------------
 sys/dev/qbus/rl.c                  |  60 ++++++++------------------------
 sys/dev/raidframe/rf_netbsdkintf.c |  19 +---------
 sys/dev/scsipi/sd.c                |  46 +-----------------------
 sys/dev/vnd.c                      |  40 +--------------------
 sys/kern/subr_disk.c               |  63 +++++++++++++++++++++------------
 14 files changed, 118 insertions(+), 566 deletions(-)

diffs (truncated from 1093 to 300 lines):

diff -r 5c8e280bdcc1 -r a3c4fcbd6e86 sys/arch/emips/ebus/ace_ebus.c
--- a/sys/arch/emips/ebus/ace_ebus.c    Wed Dec 31 16:16:35 2014 +0000
+++ b/sys/arch/emips/ebus/ace_ebus.c    Wed Dec 31 17:06:48 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ace_ebus.c,v 1.14 2014/11/09 10:10:08 mlelstv Exp $    */
+/*     $NetBSD: ace_ebus.c,v 1.15 2014/12/31 17:06:48 christos Exp $   */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ace_ebus.c,v 1.14 2014/11/09 10:10:08 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ace_ebus.c,v 1.15 2014/12/31 17:06:48 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2247,46 +2247,6 @@
        case DIOCCACHESYNC:
                return 0;
 
-       case DIOCAWEDGE:
-           {
-               struct dkwedge_info *dkw = (void *) addr;
-
-               if ((flag & FWRITE) == 0)
-                       return EBADF;
-
-               /* If the ioctl happens here, the parent is us. */
-               strcpy(dkw->dkw_parent, device_xname(ace->sc_dev));
-               return dkwedge_add(dkw);
-           }
-
-       case DIOCDWEDGE:
-           {
-               struct dkwedge_info *dkw = (void *) addr;
-
-               if ((flag & FWRITE) == 0)
-                       return EBADF;
-
-               /* If the ioctl happens here, the parent is us. */
-               strcpy(dkw->dkw_parent, device_xname(ace->sc_dev));
-               return dkwedge_del(dkw);
-           }
-
-       case DIOCLWEDGES:
-           {
-               struct dkwedge_list *dkwl = (void *) addr;
-
-               return dkwedge_list(&ace->sc_dk, dkwl, l);
-           }
-
-       case DIOCMWEDGES:
-           {
-               if ((flag & FWRITE) == 0)
-                       return EBADF;
-
-               dkwedge_discover(&ace->sc_dk);
-               return 0;
-           }
-
        case DIOCGSTRATEGY:
            {
                struct disk_strategy *dks = (void *)addr;
diff -r 5c8e280bdcc1 -r a3c4fcbd6e86 sys/arch/emips/ebus/flash_ebus.c
--- a/sys/arch/emips/ebus/flash_ebus.c  Wed Dec 31 16:16:35 2014 +0000
+++ b/sys/arch/emips/ebus/flash_ebus.c  Wed Dec 31 17:06:48 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: flash_ebus.c,v 1.12 2014/11/09 10:10:08 mlelstv Exp $  */
+/*     $NetBSD: flash_ebus.c,v 1.13 2014/12/31 17:06:48 christos Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: flash_ebus.c,v 1.12 2014/11/09 10:10:08 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: flash_ebus.c,v 1.13 2014/12/31 17:06:48 christos Exp $");
 
 /* Driver for the Intel 28F320/640/128 (J3A150) StrataFlash memory device
  * Extended to include the Intel JS28F256P30T95.
@@ -2164,46 +2164,6 @@
        case DIOCCACHESYNC:
                return 0;
 
-       case DIOCAWEDGE:
-           {
-               struct dkwedge_info *dkw = (void *) addr;
-
-               if ((flag & FWRITE) == 0)
-                       return (EBADF);
-
-               /* If the ioctl happens here, the parent is us. */
-               strcpy(dkw->dkw_parent, device_xname(sc->sc_dev));
-               return (dkwedge_add(dkw));
-           }
-
-       case DIOCDWEDGE:
-           {
-               struct dkwedge_info *dkw = (void *) addr;
-
-               if ((flag & FWRITE) == 0)
-                       return (EBADF);
-
-               /* If the ioctl happens here, the parent is us. */
-               strcpy(dkw->dkw_parent, device_xname(sc->sc_dev));
-               return (dkwedge_del(dkw));
-           }
-
-       case DIOCLWEDGES:
-           {
-               struct dkwedge_list *dkwl = (void *) addr;
-
-               return (dkwedge_list(&sc->sc_dk, dkwl, l));
-           }
-
-       case DIOCMWEDGES:
-           {
-               if ((flag & FWRITE) == 0)
-                       return (EBADF);
-
-               dkwedge_discover(&sc->sc_dk);
-               return 0;
-           }
-
        case DIOCGSTRATEGY:
            {
                struct disk_strategy *dks = (void *)addr;
diff -r 5c8e280bdcc1 -r a3c4fcbd6e86 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Wed Dec 31 16:16:35 2014 +0000
+++ b/sys/dev/ata/wd.c  Wed Dec 31 17:06:48 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.415 2014/11/04 07:51:55 mlelstv Exp $ */
+/*     $NetBSD: wd.c,v 1.416 2014/12/31 17:06:48 christos Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.415 2014/11/04 07:51:55 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.416 2014/12/31 17:06:48 christos Exp $");
 
 #include "opt_ata.h"
 
@@ -1479,46 +1479,6 @@
                return(error1);
                }
 
-       case DIOCAWEDGE:
-           {
-               struct dkwedge_info *dkw = (void *) addr;
-
-               if ((flag & FWRITE) == 0)
-                       return (EBADF);
-
-               /* If the ioctl happens here, the parent is us. */
-               strcpy(dkw->dkw_parent, device_xname(wd->sc_dev));
-               return (dkwedge_add(dkw));
-           }
-
-       case DIOCDWEDGE:
-           {
-               struct dkwedge_info *dkw = (void *) addr;
-
-               if ((flag & FWRITE) == 0)
-                       return (EBADF);
-
-               /* If the ioctl happens here, the parent is us. */
-               strcpy(dkw->dkw_parent, device_xname(wd->sc_dev));
-               return (dkwedge_del(dkw));
-           }
-
-       case DIOCLWEDGES:
-           {
-               struct dkwedge_list *dkwl = (void *) addr;
-
-               return (dkwedge_list(&wd->sc_dk, dkwl, l));
-           }
-
-       case DIOCMWEDGES:
-           {
-               if ((flag & FWRITE) == 0)
-                       return (EBADF);
-
-               dkwedge_discover(&wd->sc_dk);
-               return 0;
-           }
-
        case DIOCGSTRATEGY:
            {
                struct disk_strategy *dks = (void *)addr;
diff -r 5c8e280bdcc1 -r a3c4fcbd6e86 sys/dev/ccd.c
--- a/sys/dev/ccd.c     Wed Dec 31 16:16:35 2014 +0000
+++ b/sys/dev/ccd.c     Wed Dec 31 17:06:48 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ccd.c,v 1.159 2014/12/30 20:57:37 christos Exp $       */
+/*     $NetBSD: ccd.c,v 1.160 2014/12/31 17:06:48 christos Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.159 2014/12/30 20:57:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.160 2014/12/31 17:06:48 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -1415,42 +1415,6 @@
                }
                break;
 
-       case DIOCAWEDGE:
-           {
-               struct dkwedge_info *dkw = (void *) data;
-
-               /* If the ioctl happens here, the parent is us. */
-               strlcpy(dkw->dkw_parent, cs->sc_xname,
-                       sizeof(dkw->dkw_parent));
-               error = dkwedge_add(dkw);
-               break;
-           }
-
-       case DIOCDWEDGE:
-           {
-               struct dkwedge_info *dkw = (void *) data;
-
-               /* If the ioctl happens here, the parent is us. */
-               strlcpy(dkw->dkw_parent, cs->sc_xname,
-                       sizeof(dkw->dkw_parent));
-               error = dkwedge_del(dkw);
-               break;
-           }
-
-       case DIOCLWEDGES:
-           {
-               struct dkwedge_list *dkwl = (void *) data;
-
-               error = dkwedge_list(&cs->sc_dkdev, dkwl, l);
-               break;
-           }
-
-       case DIOCMWEDGES:
-           {
-               dkwedge_discover(&cs->sc_dkdev);
-               break;
-           }
-
        case DIOCWDINFO:
        case DIOCSDINFO:
 #ifdef __HAVE_OLD_DISKLABEL
diff -r 5c8e280bdcc1 -r a3c4fcbd6e86 sys/dev/dksubr.c
--- a/sys/dev/dksubr.c  Wed Dec 31 16:16:35 2014 +0000
+++ b/sys/dev/dksubr.c  Wed Dec 31 17:06:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.56 2014/12/29 18:41:20 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.57 2014/12/31 17:06:48 christos Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.56 2014/12/29 18:41:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.57 2014/12/31 17:06:48 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -285,11 +285,11 @@
            u_long cmd, void *data, int flag, struct lwp *l)
 {
        struct  disklabel *lp;
-       struct  disk *dk;
+       struct  disk *dk = &dksc->sc_dkdev;
 #ifdef __HAVE_OLD_DISKLABEL
        struct  disklabel newlabel;
 #endif
-       int     error = 0;
+       int     error;
 
        DPRINTF_FOLLOW(("dk_ioctl(%s, %p, 0x%"PRIx64", 0x%lx)\n",
            di->di_dkname, dksc, dev, cmd));
@@ -332,6 +332,12 @@
                        return ENXIO;
        }
 
+       error = disk_ioctl(dk, cmd, data, flag, l);
+       if (error != EPASSTHROUGH)
+               return error;
+       else
+               error = 0;
+
        switch (cmd) {
        case DIOCGDINFO:



Home | Main Index | Thread Index | Old Index