summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2014-12-31 19:52:04 +0000
committerchristos <christos@NetBSD.org>2014-12-31 19:52:04 +0000
commit4a331aac448bc6ebd006fa2ea80af68f57c666eb (patch)
treea61e69370e02aa55f74db2134eb4c32a0ce55868 /sys/arch
parent7e0dbe4aff861a57f08f15f13b40808d8bd26a6f (diff)
make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will go do dk_ioctl once all the drivers have been converted.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amiga/dev/fd.c16
-rw-r--r--sys/arch/atari/dev/fd.c16
-rw-r--r--sys/arch/atari/dev/hdfd.c19
-rw-r--r--sys/arch/emips/ebus/ace_ebus.c15
-rw-r--r--sys/arch/emips/ebus/flash_ebus.c15
-rw-r--r--sys/arch/hp300/dev/rd.c18
-rw-r--r--sys/arch/mac68k/obio/iwm_fd.c24
-rw-r--r--sys/arch/sun3/dev/xd.c22
-rw-r--r--sys/arch/sun3/dev/xy.c22
-rw-r--r--sys/arch/vax/mba/hp.c18
-rw-r--r--sys/arch/vax/vsa/hdc9224.c21
-rw-r--r--sys/arch/x68k/dev/bmd.c13
-rw-r--r--sys/arch/x68k/dev/fd.c35
13 files changed, 82 insertions, 172 deletions
diff --git a/sys/arch/amiga/dev/fd.c b/sys/arch/amiga/dev/fd.c
index 6ef2c4b5753..f318a8ce9b6 100644
--- a/sys/arch/amiga/dev/fd.c
+++ b/sys/arch/amiga/dev/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.92 2014/08/08 21:13:52 joerg Exp $ */
+/* $NetBSD: fd.c,v 1.93 2014/12/31 19:52:04 christos Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.92 2014/08/08 21:13:52 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.93 2014/12/31 19:52:04 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -573,6 +573,10 @@ fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
if ((sc->flags & FDF_HAVELABEL) == 0)
return(EBADF);
+ error = disk_ioctl(&sk->dkdev, dev, cmd, addr, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
+
switch (cmd) {
case DIOCSBAD:
return(EINVAL);
@@ -586,14 +590,6 @@ fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
return(EINVAL);
sc->dkdev.dk_label->d_trkseek = sc->stepdelay = *(int *)addr;
return(0);
- case DIOCGDINFO:
- *(struct disklabel *)addr = *(sc->dkdev.dk_label);
- return(0);
- case DIOCGPART:
- ((struct partinfo *)addr)->disklab = sc->dkdev.dk_label;
- ((struct partinfo *)addr)->part =
- &sc->dkdev.dk_label->d_partitions[FDPART(dev)];
- return(0);
case DIOCSDINFO:
if ((flag & FWRITE) == 0)
return(EBADF);
diff --git a/sys/arch/atari/dev/fd.c b/sys/arch/atari/dev/fd.c
index 02e2a060163..a694010cdaa 100644
--- a/sys/arch/atari/dev/fd.c
+++ b/sys/arch/atari/dev/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.80 2014/10/18 08:33:25 snj Exp $ */
+/* $NetBSD: fd.c,v 1.81 2014/12/31 19:52:04 christos Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.80 2014/10/18 08:33:25 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.81 2014/12/31 19:52:04 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -432,17 +432,13 @@ fdioctl(dev_t dev, u_long cmd, void * addr, int flag, struct lwp *l)
if ((sc->flags & FLPF_HAVELAB) == 0)
return EBADF;
+ error = disk_ioctl(&sc->dkdev, RAW_PART, cmd, addr, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
+
switch (cmd) {
case DIOCSBAD:
return EINVAL;
- case DIOCGDINFO:
- *(struct disklabel *)addr = *(sc->dkdev.dk_label);
- return 0;
- case DIOCGPART:
- ((struct partinfo *)addr)->disklab = sc->dkdev.dk_label;
- ((struct partinfo *)addr)->part =
- &sc->dkdev.dk_label->d_partitions[RAW_PART];
- return 0;
#ifdef notyet /* XXX LWP */
case DIOCSRETRIES:
case DIOCSSTEP:
diff --git a/sys/arch/atari/dev/hdfd.c b/sys/arch/atari/dev/hdfd.c
index 6c2fb17732b..01bdf99d490 100644
--- a/sys/arch/atari/dev/hdfd.c
+++ b/sys/arch/atari/dev/hdfd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hdfd.c,v 1.78 2014/07/25 08:10:32 dholland Exp $ */
+/* $NetBSD: hdfd.c,v 1.79 2014/12/31 19:52:04 christos Exp $ */
/*-
* Copyright (c) 1996 Leo Weppelman
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.78 2014/07/25 08:10:32 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdfd.c,v 1.79 2014/12/31 19:52:04 christos Exp $");
#include "opt_ddb.h"
@@ -1304,17 +1304,16 @@ fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
switch (cmd) {
case DIOCGDINFO:
- fdgetdisklabel(fd, dev);
- *(struct disklabel *)addr = *(fd->sc_dk.dk_label);
- return 0;
-
case DIOCGPART:
fdgetdisklabel(fd, dev);
- ((struct partinfo *)addr)->disklab = fd->sc_dk.dk_label;
- ((struct partinfo *)addr)->part =
- &fd->sc_dk.dk_label->d_partitions[RAW_PART];
- return 0;
+ break;
+ }
+
+ error = disk_ioctl(&fd->sc_dk, RAW_PART, cmd, addr, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
+ switch (cmd) {
case DIOCWLABEL:
if ((flag & FWRITE) == 0)
return EBADF;
diff --git a/sys/arch/emips/ebus/ace_ebus.c b/sys/arch/emips/ebus/ace_ebus.c
index 1a431b4da59..0c47a948f58 100644
--- a/sys/arch/emips/ebus/ace_ebus.c
+++ b/sys/arch/emips/ebus/ace_ebus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ace_ebus.c,v 1.15 2014/12/31 17:06:48 christos Exp $ */
+/* $NetBSD: ace_ebus.c,v 1.16 2014/12/31 19:52:04 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.15 2014/12/31 17:06:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ace_ebus.c,v 1.16 2014/12/31 19:52:04 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -2172,7 +2172,7 @@ aceioctl(dev_t dev, u_long xfer, void *addr, int flag, struct lwp *l)
if ((ace->sc_flags & ACEF_LOADED) == 0)
return EIO;
- error = disk_ioctl(&ace->sc_dk, xfer, addr, flag, l);
+ error = disk_ioctl(&ace->sc_dk, dev, xfer, addr, flag, l);
if (error != EPASSTHROUGH)
return error;
@@ -2186,15 +2186,6 @@ aceioctl(dev_t dev, u_long xfer, void *addr, int flag, struct lwp *l)
bad144intern(ace);
return 0;
#endif
- case DIOCGDINFO:
- *(struct disklabel *)addr = *(ace->sc_dk.dk_label);
- return 0;
-
- case DIOCGPART:
- ((struct partinfo *)addr)->disklab = ace->sc_dk.dk_label;
- ((struct partinfo *)addr)->part =
- &ace->sc_dk.dk_label->d_partitions[ACEPART(dev)];
- return 0;
case DIOCWDINFO:
case DIOCSDINFO:
diff --git a/sys/arch/emips/ebus/flash_ebus.c b/sys/arch/emips/ebus/flash_ebus.c
index 275e1469ab0..8aba1439251 100644
--- a/sys/arch/emips/ebus/flash_ebus.c
+++ b/sys/arch/emips/ebus/flash_ebus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: flash_ebus.c,v 1.13 2014/12/31 17:06:48 christos Exp $ */
+/* $NetBSD: flash_ebus.c,v 1.14 2014/12/31 19:52:04 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.13 2014/12/31 17:06:48 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: flash_ebus.c,v 1.14 2014/12/31 19:52:04 christos Exp $");
/* Driver for the Intel 28F320/640/128 (J3A150) StrataFlash memory device
* Extended to include the Intel JS28F256P30T95.
@@ -2089,7 +2089,7 @@ eflashioctl(dev_t dev, u_long xfer, void *addr, int flag, struct lwp *l)
if ((sc->sc_flags & EFLASHF_LOADED) == 0)
return EIO;
- error = disk_ioctl(&sc->sc_dk, xfer, addr, flag, l);
+ error = disk_ioctl(&sc->sc_dk, dev, xfer, addr, flag, l);
if (error != EPASSTHROUGH)
return (error);
@@ -2103,15 +2103,6 @@ eflashioctl(dev_t dev, u_long xfer, void *addr, int flag, struct lwp *l)
bad144intern(sc);
return 0;
#endif
- case DIOCGDINFO:
- *(struct disklabel *)addr = *(sc->sc_dk.dk_label);
- return 0;
-
- case DIOCGPART:
- ((struct partinfo *)addr)->disklab = sc->sc_dk.dk_label;
- ((struct partinfo *)addr)->part =
- &sc->sc_dk.dk_label->d_partitions[EFLASHPART(dev)];
- return 0;
case DIOCWDINFO:
case DIOCSDINFO:
diff --git a/sys/arch/hp300/dev/rd.c b/sys/arch/hp300/dev/rd.c
index 419e033f9bd..81bd644d247 100644
--- a/sys/arch/hp300/dev/rd.c
+++ b/sys/arch/hp300/dev/rd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rd.c,v 1.98 2014/08/10 16:44:34 tls Exp $ */
+/* $NetBSD: rd.c,v 1.99 2014/12/31 19:52:05 christos Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.98 2014/08/10 16:44:34 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.99 2014/12/31 19:52:05 christos Exp $");
#include "opt_useleds.h"
@@ -1116,17 +1116,11 @@ rdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
struct disklabel *lp = sc->sc_dkdev.dk_label;
int error, flags;
- switch (cmd) {
- case DIOCGDINFO:
- *(struct disklabel *)data = *lp;
- return 0;
-
- case DIOCGPART:
- ((struct partinfo *)data)->disklab = lp;
- ((struct partinfo *)data)->part =
- &lp->d_partitions[rdpart(dev)];
- return 0;
+ error = disk_ioctl(&sc->sc_dkdev, rdpart(dev), cmd, data, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
+ switch (cmd) {
case DIOCWLABEL:
if ((flag & FWRITE) == 0)
return EBADF;
diff --git a/sys/arch/mac68k/obio/iwm_fd.c b/sys/arch/mac68k/obio/iwm_fd.c
index d190c191c3a..2b81daf0ed8 100644
--- a/sys/arch/mac68k/obio/iwm_fd.c
+++ b/sys/arch/mac68k/obio/iwm_fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: iwm_fd.c,v 1.50 2014/07/25 08:10:34 dholland Exp $ */
+/* $NetBSD: iwm_fd.c,v 1.51 2014/12/31 19:52:05 christos Exp $ */
/*
* Copyright (c) 1997, 1998 Hauke Fath. All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iwm_fd.c,v 1.50 2014/07/25 08:10:34 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iwm_fd.c,v 1.51 2014/12/31 19:52:05 christos Exp $");
#include "locators.h"
@@ -720,14 +720,11 @@ fdioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l)
fd = iwm->fd[fdUnit];
result = 0;
- switch (cmd) {
- case DIOCGDINFO:
- if (TRACE_IOCTL)
- printf(" DIOCGDINFO: Get in-core disklabel.\n");
- *(struct disklabel *) data = *(fd->diskInfo.dk_label);
- result = 0;
- break;
+ error = disk_ioctl(&fd->diskIndfo, fdType, cmd, data, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
+ switch (cmd) {
case DIOCSDINFO:
if (TRACE_IOCTL)
printf(" DIOCSDINFO: Set in-core disklabel.\n");
@@ -754,15 +751,6 @@ fdioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l)
fd->diskInfo.dk_cpulabel);
break;
- case DIOCGPART:
- if (TRACE_IOCTL)
- printf(" DIOCGPART: Get disklabel & partition table.\n");
- ((struct partinfo *)data)->disklab = fd->diskInfo.dk_label;
- ((struct partinfo *)data)->part =
- &fd->diskInfo.dk_label->d_partitions[fdType];
- result = 0;
- break;
-
case DIOCRFORMAT:
case DIOCWFORMAT:
if (TRACE_IOCTL)
diff --git a/sys/arch/sun3/dev/xd.c b/sys/arch/sun3/dev/xd.c
index b2745fb8ae4..4100a96213e 100644
--- a/sys/arch/sun3/dev/xd.c
+++ b/sys/arch/sun3/dev/xd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xd.c,v 1.71 2014/07/25 08:10:35 dholland Exp $ */
+/* $NetBSD: xd.c,v 1.72 2014/12/31 19:52:05 christos Exp $ */
/*
* Copyright (c) 1995 Charles D. Cranor
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.71 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.72 2014/12/31 19:52:05 christos Exp $");
#undef XDC_DEBUG /* full debug */
#define XDC_DIAG /* extra sanity checks */
@@ -853,7 +853,7 @@ xd_getkauthreq(u_char cmd)
* xdioctl: ioctls on XD drives. based on ioctl's of other netbsd disks.
*/
int
-xdioctl(dev_t dev, u_long command, void *addr, int flag, struct lwp *l)
+xdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
{
struct xd_softc *xd;
struct xd_iocmd *xio;
@@ -865,9 +865,13 @@ xdioctl(dev_t dev, u_long command, void *addr, int flag, struct lwp *l)
if (xd == NULL)
return (ENXIO);
+ error = disk_ioctl(&xd->sc_dk, dev, cmd, addr, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
+
/* switch on ioctl type */
- switch (command) {
+ switch (cmd) {
case DIOCSBAD: /* set bad144 info */
if ((flag & FWRITE) == 0)
return EBADF;
@@ -876,16 +880,6 @@ xdioctl(dev_t dev, u_long command, void *addr, int flag, struct lwp *l)
splx(s);
return 0;
- case DIOCGDINFO: /* get disk label */
- memcpy(addr, xd->sc_dk.dk_label, sizeof(struct disklabel));
- return 0;
-
- case DIOCGPART: /* get partition info */
- ((struct partinfo *)addr)->disklab = xd->sc_dk.dk_label;
- ((struct partinfo *)addr)->part =
- &xd->sc_dk.dk_label->d_partitions[DISKPART(dev)];
- return 0;
-
case DIOCSDINFO: /* set disk label */
if ((flag & FWRITE) == 0)
return EBADF;
diff --git a/sys/arch/sun3/dev/xy.c b/sys/arch/sun3/dev/xy.c
index 6732ae9cd4b..f7ddd785681 100644
--- a/sys/arch/sun3/dev/xy.c
+++ b/sys/arch/sun3/dev/xy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: xy.c,v 1.76 2014/07/25 08:10:35 dholland Exp $ */
+/* $NetBSD: xy.c,v 1.77 2014/12/31 19:52:05 christos Exp $ */
/*
* Copyright (c) 1995 Charles D. Cranor
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.76 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.77 2014/12/31 19:52:05 christos Exp $");
#undef XYC_DEBUG /* full debug */
#undef XYC_DIAG /* extra sanity checks */
@@ -806,7 +806,7 @@ xy_getkauthreq(u_char cmd)
* xyioctl: ioctls on XY drives. based on ioctl's of other netbsd disks.
*/
int
-xyioctl(dev_t dev, u_long command, void *addr, int flag, struct lwp *l)
+xyioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
{
struct xy_softc *xy;
struct xd_iocmd *xio;
@@ -818,9 +818,13 @@ xyioctl(dev_t dev, u_long command, void *addr, int flag, struct lwp *l)
if (xy == NULL)
return ENXIO;
+ error = disk_ioctl(&xy->sc_dk, dev, cmd, addr, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
+
/* switch on ioctl type */
- switch (command) {
+ switch (cmd) {
case DIOCSBAD: /* set bad144 info */
if ((flag & FWRITE) == 0)
return EBADF;
@@ -829,16 +833,6 @@ xyioctl(dev_t dev, u_long command, void *addr, int flag, struct lwp *l)
splx(s);
return 0;
- case DIOCGDINFO: /* get disk label */
- memcpy(addr, xy->sc_dk.dk_label, sizeof(struct disklabel));
- return 0;
-
- case DIOCGPART: /* get partition info */
- ((struct partinfo *)addr)->disklab = xy->sc_dk.dk_label;
- ((struct partinfo *)addr)->part =
- &xy->sc_dk.dk_label->d_partitions[DISKPART(dev)];
- return 0;
-
case DIOCSDINFO: /* set disk label */
if ((flag & FWRITE) == 0)
return EBADF;
diff --git a/sys/arch/vax/mba/hp.c b/sys/arch/vax/mba/hp.c
index 6b5d267fd1c..251767048f1 100644
--- a/sys/arch/vax/mba/hp.c
+++ b/sys/arch/vax/mba/hp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hp.c,v 1.50 2014/07/25 08:10:35 dholland Exp $ */
+/* $NetBSD: hp.c,v 1.51 2014/12/31 19:52:05 christos Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hp.c,v 1.50 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hp.c,v 1.51 2014/12/31 19:52:05 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -324,17 +324,11 @@ hpioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
struct disklabel * const lp = sc->sc_disk.dk_label;
int error;
- switch (cmd) {
- case DIOCGDINFO:
- *(struct disklabel *)addr = *lp;
- return 0;
-
- case DIOCGPART:
- ((struct partinfo *)addr)->disklab = lp;
- ((struct partinfo *)addr)->part =
- &lp->d_partitions[DISKPART(dev)];
- break;
+ error = disk_ioctl(&sc->sc_disk, dev, cmd, addr, flag, l);
+ if (error != EPASSTHROUGH)
+ goto out;
+ switch (cmd) {
case DIOCSDINFO:
if ((flag & FWRITE) == 0)
return EBADF;
diff --git a/sys/arch/vax/vsa/hdc9224.c b/sys/arch/vax/vsa/hdc9224.c
index d80e7cf3ce1..909561ff694 100644
--- a/sys/arch/vax/vsa/hdc9224.c
+++ b/sys/arch/vax/vsa/hdc9224.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hdc9224.c,v 1.54 2014/07/25 08:10:35 dholland Exp $ */
+/* $NetBSD: hdc9224.c,v 1.55 2014/12/31 19:52:05 christos Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -51,7 +51,7 @@
#undef RDDEBUG
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdc9224.c,v 1.54 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdc9224.c,v 1.55 2014/12/31 19:52:05 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -688,19 +688,14 @@ rdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
{
struct rdsoftc * const rd = device_lookup_private(&rd_cd, DISKUNIT(dev));
struct disklabel * const lp = rd->sc_disk.dk_label;
- int error = 0;
- switch (cmd) {
- case DIOCGDINFO:
- *(struct disklabel *)addr = *lp;
- break;
-
- case DIOCGPART:
- ((struct partinfo *)addr)->disklab = lp;
- ((struct partinfo *)addr)->part =
- &lp->d_partitions[DISKPART(dev)];
- break;
+ error = disk_ioctl(&rd->sc_disk, dev, cmd, addr, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
+ else
+ error = 0;
+ switch (cmd) {
case DIOCWDINFO:
case DIOCSDINFO:
if ((flag & FWRITE) == 0)
diff --git a/sys/arch/x68k/dev/bmd.c b/sys/arch/x68k/dev/bmd.c
index 13ad440a26b..449d56639cc 100644
--- a/sys/arch/x68k/dev/bmd.c
+++ b/sys/arch/x68k/dev/bmd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bmd.c,v 1.21 2014/07/25 08:10:35 dholland Exp $ */
+/* $NetBSD: bmd.c,v 1.22 2014/12/31 19:52:05 christos Exp $ */
/*
* Copyright (c) 2002 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bmd.c,v 1.21 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bmd.c,v 1.22 2014/12/31 19:52:05 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -350,14 +350,15 @@ bmdioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
DPRINTF(("%s%d %ld\n", __func__, BMD_UNIT(dev), cmd));
sc = device_lookup_private(&bmd_cd, BMD_UNIT(dev));
+
if (sc == NULL)
return ENXIO;
- switch (cmd) {
- case DIOCGDINFO:
- *(struct disklabel *)data = *(sc->sc_dkdev.dk_label);
- break;
+ error = disk_ioctl(&sc->sc_dkdev, dev, cmd, data, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
+ switch (cmd) {
case DIOCWDINFO:
if ((flag & FWRITE) == 0)
return EBADF;
diff --git a/sys/arch/x68k/dev/fd.c b/sys/arch/x68k/dev/fd.c
index 5228fddaf4e..69f856e73bf 100644
--- a/sys/arch/x68k/dev/fd.c
+++ b/sys/arch/x68k/dev/fd.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.111 2014/08/10 16:44:34 tls Exp $ */
+/* $NetBSD: fd.c,v 1.112 2014/12/31 19:52:05 christos Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.111 2014/08/10 16:44:34 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.112 2014/12/31 19:52:05 christos Exp $");
#include "opt_ddb.h"
#include "opt_m68k_arch.h"
@@ -1608,41 +1608,18 @@ fdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
struct fdformat_parms *form_parms;
struct fdformat_cmd *form_cmd;
struct ne7_fd_formb *fd_formb;
- int part = DISKPART(dev);
struct disklabel buffer;
int error;
unsigned int scratch;
int il[FD_MAX_NSEC + 1];
int i, j;
+ error = disk_ioctl(&fd->sc_dk, dev, cmd, addr, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
+
DPRINTF(("fdioctl:"));
switch (cmd) {
- case DIOCGDINFO:
- DPRINTF(("DIOCGDINFO\n"));
-#if 1
- *(struct disklabel *)addr = *fd->sc_dk.dk_label;
- return 0;
-#else
- memset(&buffer, 0, sizeof(buffer));
-
- buffer.d_secpercyl = fd->sc_type->seccyl;
- buffer.d_type = DTYPE_FLOPPY;
- buffer.d_secsize = 128 << fd->sc_type->secsize;
-
- if (readdisklabel(dev, fdstrategy, &buffer, NULL) != NULL)
- return EINVAL;
-
- *(struct disklabel *)addr = buffer;
- return 0;
-#endif
-
- case DIOCGPART:
- DPRINTF(("DIOCGPART\n"));
- ((struct partinfo *)addr)->disklab = fd->sc_dk.dk_label;
- ((struct partinfo *)addr)->part =
- &fd->sc_dk.dk_label->d_partitions[part];
- return 0;
-
case DIOCWLABEL:
DPRINTF(("DIOCWLABEL\n"));
if ((flag & FWRITE) == 0)