Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys make more drivers use disk_ioctl, and add a dev paramete...
details: https://anonhg.NetBSD.org/src/rev/33fd11f05439
branches: trunk
changeset: 335256:33fd11f05439
user: christos <christos%NetBSD.org@localhost>
date: Wed Dec 31 19:52:04 2014 +0000
description:
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:
sys/arch/amiga/dev/fd.c | 16 ++++------
sys/arch/atari/dev/fd.c | 16 ++++------
sys/arch/atari/dev/hdfd.c | 19 ++++++------
sys/arch/emips/ebus/ace_ebus.c | 15 ++--------
sys/arch/emips/ebus/flash_ebus.c | 15 ++--------
sys/arch/hp300/dev/rd.c | 18 ++++--------
sys/arch/mac68k/obio/iwm_fd.c | 24 ++++------------
sys/arch/sun3/dev/xd.c | 22 +++++---------
sys/arch/sun3/dev/xy.c | 22 +++++---------
sys/arch/vax/mba/hp.c | 18 ++++--------
sys/arch/vax/vsa/hdc9224.c | 21 +++++--------
sys/arch/x68k/dev/bmd.c | 13 ++++----
sys/arch/x68k/dev/fd.c | 35 ++++-------------------
sys/dev/ata/wd.c | 30 ++-----------------
sys/dev/ccd.c | 25 ++--------------
sys/dev/cgd.c | 6 ++--
sys/dev/dksubr.c | 25 ++--------------
sys/dev/dkwedge/dk.c | 10 ++++--
sys/dev/gpib/rd.c | 18 ++++--------
sys/dev/isa/fd.c | 56 +++++++++++++++----------------------
sys/dev/isa/mcd.c | 26 ++++-------------
sys/dev/ld.c | 28 ++----------------
sys/dev/mca/ed_mca.c | 16 ++--------
sys/dev/md.c | 20 ++----------
sys/dev/mscp/mscp_disk.c | 39 ++-----------------------
sys/dev/ofw/ofdisk.c | 24 ++--------------
sys/dev/qbus/rf.c | 19 ++++--------
sys/dev/qbus/rl.c | 27 ++---------------
sys/dev/raidframe/rf_netbsdkintf.c | 24 ++--------------
sys/dev/scsipi/cd.c | 29 ++-----------------
sys/dev/scsipi/sd.c | 30 ++------------------
sys/dev/vme/xd.c | 26 ++++-------------
sys/dev/vme/xy.c | 26 ++++-------------
sys/dev/vnd.c | 32 ++++----------------
sys/kern/subr_disk.c | 36 ++++++++++++++++++++++--
sys/sys/param.h | 4 +-
36 files changed, 229 insertions(+), 601 deletions(-)
diffs (truncated from 1832 to 300 lines):
diff -r d92dcce793e3 -r 33fd11f05439 sys/arch/amiga/dev/fd.c
--- a/sys/arch/amiga/dev/fd.c Wed Dec 31 19:50:14 2014 +0000
+++ b/sys/arch/amiga/dev/fd.c Wed Dec 31 19:52:04 2014 +0000
@@ -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 @@
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 @@
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 -r d92dcce793e3 -r 33fd11f05439 sys/arch/atari/dev/fd.c
--- a/sys/arch/atari/dev/fd.c Wed Dec 31 19:50:14 2014 +0000
+++ b/sys/arch/atari/dev/fd.c Wed Dec 31 19:52:04 2014 +0000
@@ -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 @@
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 -r d92dcce793e3 -r 33fd11f05439 sys/arch/atari/dev/hdfd.c
--- a/sys/arch/atari/dev/hdfd.c Wed Dec 31 19:50:14 2014 +0000
+++ b/sys/arch/atari/dev/hdfd.c Wed Dec 31 19:52:04 2014 +0000
@@ -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 @@
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 -r d92dcce793e3 -r 33fd11f05439 sys/arch/emips/ebus/ace_ebus.c
--- a/sys/arch/emips/ebus/ace_ebus.c Wed Dec 31 19:50:14 2014 +0000
+++ b/sys/arch/emips/ebus/ace_ebus.c Wed Dec 31 19:52:04 2014 +0000
@@ -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 @@
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 @@
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 -r d92dcce793e3 -r 33fd11f05439 sys/arch/emips/ebus/flash_ebus.c
--- a/sys/arch/emips/ebus/flash_ebus.c Wed Dec 31 19:50:14 2014 +0000
+++ b/sys/arch/emips/ebus/flash_ebus.c Wed Dec 31 19:52:04 2014 +0000
@@ -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 @@
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 @@
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 -r d92dcce793e3 -r 33fd11f05439 sys/arch/hp300/dev/rd.c
--- a/sys/arch/hp300/dev/rd.c Wed Dec 31 19:50:14 2014 +0000
+++ b/sys/arch/hp300/dev/rd.c Wed Dec 31 19:52:04 2014 +0000
@@ -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 @@
struct disklabel *lp = sc->sc_dkdev.dk_label;
int error, flags;
- switch (cmd) {
- case DIOCGDINFO:
- *(struct disklabel *)data = *lp;
- return 0;
+ error = disk_ioctl(&sc->sc_dkdev, rdpart(dev), cmd, data, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
- case DIOCGPART:
- ((struct partinfo *)data)->disklab = lp;
- ((struct partinfo *)data)->part =
- &lp->d_partitions[rdpart(dev)];
- return 0;
-
+ switch (cmd) {
case DIOCWLABEL:
if ((flag & FWRITE) == 0)
return EBADF;
diff -r d92dcce793e3 -r 33fd11f05439 sys/arch/mac68k/obio/iwm_fd.c
--- a/sys/arch/mac68k/obio/iwm_fd.c Wed Dec 31 19:50:14 2014 +0000
+++ b/sys/arch/mac68k/obio/iwm_fd.c Wed Dec 31 19:52:04 2014 +0000
@@ -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 @@
fd = iwm->fd[fdUnit];
result = 0;
+ error = disk_ioctl(&fd->diskIndfo, fdType, cmd, data, flag, l);
+ if (error != EPASSTHROUGH)
+ return error;
+
switch (cmd) {
- case DIOCGDINFO:
- if (TRACE_IOCTL)
- printf(" DIOCGDINFO: Get in-core disklabel.\n");
- *(struct disklabel *) data = *(fd->diskInfo.dk_label);
- result = 0;
- break;
-
case DIOCSDINFO:
if (TRACE_IOCTL)
printf(" DIOCSDINFO: Set in-core disklabel.\n");
@@ -754,15 +751,6 @@
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];
Home |
Main Index |
Thread Index |
Old Index