summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/hp300/dev/hd.c4
-rw-r--r--sys/arch/sparc/dev/fd.c4
-rw-r--r--sys/arch/sparc/dev/presto.c4
-rw-r--r--sys/arch/sparc/dev/xd.c4
-rw-r--r--sys/arch/sparc/dev/xy.c4
-rw-r--r--sys/arch/sparc64/dev/fd.c4
-rw-r--r--sys/arch/vax/mba/hp.c4
-rw-r--r--sys/arch/vax/mscp/mscp_disk.c4
-rw-r--r--sys/arch/vax/vsa/hdc9224.c4
-rw-r--r--sys/dev/ata/wd.c4
-rw-r--r--sys/dev/ccd.c4
-rw-r--r--sys/dev/flash.c4
-rw-r--r--sys/dev/isa/fd.c4
-rw-r--r--sys/dev/isa/mcd.c4
-rw-r--r--sys/dev/raidframe/rf_openbsdkintf.c4
-rw-r--r--sys/dev/ramdisk.c4
-rw-r--r--sys/dev/vnd.c4
-rw-r--r--sys/kern/subr_disk.c21
-rw-r--r--sys/scsi/cd.c4
-rw-r--r--sys/scsi/sd.c4
-rw-r--r--sys/sys/disk.h6
21 files changed, 54 insertions, 49 deletions
diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c
index 5a87a5fa14e..e23eeb7c53f 100644
--- a/sys/arch/hp300/dev/hd.c
+++ b/sys/arch/hp300/dev/hd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hd.c,v 1.61 2010/05/23 10:49:19 dlg Exp $ */
+/* $OpenBSD: hd.c,v 1.62 2010/09/08 14:47:10 jsing Exp $ */
/* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */
/*
@@ -295,7 +295,7 @@ hdattach(parent, self, aux)
* Initialize and attach the disk structure.
*/
sc->sc_dkdev.dk_name = sc->sc_dev.dv_xname;
- disk_attach(&sc->sc_dkdev);
+ disk_attach(&sc->sc_dev, &sc->sc_dkdev);
sc->sc_slave = ha->ha_slave;
sc->sc_punit = ha->ha_punit;
diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c
index 5b9384a12ec..c4f3feac8d4 100644
--- a/sys/arch/sparc/dev/fd.c
+++ b/sys/arch/sparc/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.74 2010/08/28 20:23:22 matthew Exp $ */
+/* $OpenBSD: fd.c,v 1.75 2010/09/08 14:47:10 jsing Exp $ */
/* $NetBSD: fd.c,v 1.51 1997/05/24 20:16:19 pk Exp $ */
/*-
@@ -642,7 +642,7 @@ fdattach(parent, self, aux)
* Initialize and attach the disk structure.
*/
fd->sc_dk.dk_name = fd->sc_dv.dv_xname;
- disk_attach(&fd->sc_dk);
+ disk_attach(&fd->sc_dev, &fd->sc_dk);
/*
* We're told if we're the boot device in fdcattach().
diff --git a/sys/arch/sparc/dev/presto.c b/sys/arch/sparc/dev/presto.c
index 671b4e40de6..401996e8a2f 100644
--- a/sys/arch/sparc/dev/presto.c
+++ b/sys/arch/sparc/dev/presto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: presto.c,v 1.17 2010/08/28 20:23:22 matthew Exp $ */
+/* $OpenBSD: presto.c,v 1.18 2010/09/08 14:47:10 jsing Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -161,7 +161,7 @@ presto_attach(struct device *parent, struct device *self, void *args)
#endif
sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
- disk_attach(&sc->sc_dk);
+ disk_attach(&sc->sc_dev, &sc->sc_dk);
}
/*
diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c
index ef989f96195..bb16447c11f 100644
--- a/sys/arch/sparc/dev/xd.c
+++ b/sys/arch/sparc/dev/xd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xd.c,v 1.49 2010/08/28 20:23:22 matthew Exp $ */
+/* $OpenBSD: xd.c,v 1.50 2010/09/08 14:47:10 jsing Exp $ */
/* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */
/*
@@ -656,7 +656,7 @@ xdattach(parent, self, aux)
xd->hw_spt = spt;
/* Attach the disk: must be before getdisklabel to malloc label */
- disk_attach(&xd->sc_dk);
+ disk_attach(&xd->sc_dev, &xd->sc_dk);
if (xdgetdisklabel(xd, xa->buf) != XD_ERR_AOK)
goto done;
diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c
index 457518bb6df..239bc2afd69 100644
--- a/sys/arch/sparc/dev/xy.c
+++ b/sys/arch/sparc/dev/xy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xy.c,v 1.47 2010/09/06 14:44:19 jasper Exp $ */
+/* $OpenBSD: xy.c,v 1.48 2010/09/08 14:47:10 jsing Exp $ */
/* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */
/*
@@ -586,7 +586,7 @@ xyattach(parent, self, aux)
xy->hw_spt = spt = 0; /* XXX needed ? */
/* Attach the disk: must be before getdisklabel to malloc label */
- disk_attach(&xy->sc_dk);
+ disk_attach(&xy->sc_dev, &xy->sc_dk);
if (xygetdisklabel(xy, xa->buf) != 0)
goto done;
diff --git a/sys/arch/sparc64/dev/fd.c b/sys/arch/sparc64/dev/fd.c
index f7fc4321e02..597c6339cb1 100644
--- a/sys/arch/sparc64/dev/fd.c
+++ b/sys/arch/sparc64/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.32 2010/08/28 20:23:22 matthew Exp $ */
+/* $OpenBSD: fd.c,v 1.33 2010/09/08 14:47:10 jsing Exp $ */
/* $NetBSD: fd.c,v 1.112 2003/08/07 16:29:35 agc Exp $ */
/*-
@@ -668,7 +668,7 @@ fdattach(parent, self, aux)
* Initialize and attach the disk structure.
*/
fd->sc_dk.dk_name = fd->sc_dv.dv_xname;
- disk_attach(&fd->sc_dk);
+ disk_attach(&fd->sc_dv, &fd->sc_dk);
/* Make sure the drive motor gets turned off at shutdown time. */
fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd);
diff --git a/sys/arch/vax/mba/hp.c b/sys/arch/vax/mba/hp.c
index 088213e60cc..fdd4bd42cf2 100644
--- a/sys/arch/vax/mba/hp.c
+++ b/sys/arch/vax/mba/hp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hp.c,v 1.20 2009/09/05 00:48:39 krw Exp $ */
+/* $OpenBSD: hp.c,v 1.21 2010/09/08 14:47:10 jsing Exp $ */
/* $NetBSD: hp.c,v 1.22 2000/02/12 16:09:33 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
@@ -146,7 +146,7 @@ hpattach(parent, self, aux)
* Init and attach the disk structure.
*/
sc->sc_disk.dk_name = sc->sc_dev.dv_xname;
- disk_attach(&sc->sc_disk);
+ disk_attach(&sc->sc_dev, &sc->sc_disk);
/*
* Fake a disklabel to be able to read in the real label.
diff --git a/sys/arch/vax/mscp/mscp_disk.c b/sys/arch/vax/mscp/mscp_disk.c
index 52d2249ff6a..27aeaa679e2 100644
--- a/sys/arch/vax/mscp/mscp_disk.c
+++ b/sys/arch/vax/mscp/mscp_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mscp_disk.c,v 1.29 2010/05/22 17:10:23 deraadt Exp $ */
+/* $OpenBSD: mscp_disk.c,v 1.30 2010/09/08 14:47:10 jsing Exp $ */
/* $NetBSD: mscp_disk.c,v 1.30 2001/11/13 07:38:28 lukem Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
@@ -519,7 +519,7 @@ rxattach(parent, self, aux)
mi->mi_dp[mp->mscp_unit] = self;
rx->ra_disk.dk_name = rx->ra_dev.dv_xname;
- disk_attach((struct disk *)&rx->ra_disk);
+ disk_attach(&rx->ra_dev, &rx->ra_disk);
/* Fill in what we know. The actual size is gotten later */
dl = rx->ra_disk.dk_label;
diff --git a/sys/arch/vax/vsa/hdc9224.c b/sys/arch/vax/vsa/hdc9224.c
index 9acd6581058..a47e356b635 100644
--- a/sys/arch/vax/vsa/hdc9224.c
+++ b/sys/arch/vax/vsa/hdc9224.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hdc9224.c,v 1.29 2010/06/26 23:24:44 guenther Exp $ */
+/* $OpenBSD: hdc9224.c,v 1.30 2010/09/08 14:47:10 jsing Exp $ */
/* $NetBSD: hdc9224.c,v 1.16 2001/07/26 15:05:09 wiz Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
@@ -352,7 +352,7 @@ hdattach(struct device *parent, struct device *self, void *aux)
* Initialize and attach the disk structure.
*/
hd->sc_disk.dk_name = hd->sc_dev.dv_xname;
- disk_attach(&hd->sc_disk);
+ disk_attach(&hd->sc_dev, &hd->sc_disk);
/*
* if it's not a floppy then evaluate the on-disk geometry.
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c
index 89375d47fd8..d4f140fde9c 100644
--- a/sys/dev/ata/wd.c
+++ b/sys/dev/ata/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.91 2010/09/01 01:38:12 dlg Exp $ */
+/* $OpenBSD: wd.c,v 1.92 2010/09/08 14:47:12 jsing Exp $ */
/* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */
/*
@@ -369,7 +369,7 @@ wdattach(struct device *parent, struct device *self, void *aux)
timeout_set(&wd->sc_restart_timeout, wdrestart, wd);
/* Attach disk. */
- disk_attach(&wd->sc_dk);
+ disk_attach(&wd->sc_dev, &wd->sc_dk);
wd->sc_wdc_bio.lp = wd->sc_dk.dk_label;
}
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index cc628f78239..b9678b78aa2 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ccd.c,v 1.90 2010/05/18 04:41:14 dlg Exp $ */
+/* $OpenBSD: ccd.c,v 1.91 2010/09/08 14:47:12 jsing Exp $ */
/* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */
/*-
@@ -1118,7 +1118,7 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
/* Attach the disk. */
cs->sc_dkdev.dk_name = cs->sc_xname;
- disk_attach(&cs->sc_dkdev);
+ disk_attach(NULL, &cs->sc_dkdev);
/* Try and read the disklabel. */
ccdgetdisklabel(dev, cs, cs->sc_dkdev.dk_label, 0);
diff --git a/sys/dev/flash.c b/sys/dev/flash.c
index 7ca3df7808f..e81d28d4733 100644
--- a/sys/dev/flash.c
+++ b/sys/dev/flash.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: flash.c,v 1.16 2010/08/28 20:23:22 matthew Exp $ */
+/* $OpenBSD: flash.c,v 1.17 2010/09/08 14:47:12 jsing Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org>
@@ -157,7 +157,7 @@ flashattach(struct flash_softc *sc, struct flash_ctl_tag *tag,
* Initialize and attach the disk structure.
*/
sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
- disk_attach(&sc->sc_dk);
+ disk_attach(&sc->sc_dev, &sc->sc_dk);
/* XXX establish shutdown hook to finish any commands. */
}
diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c
index 0244d952f27..8c8e34fa212 100644
--- a/sys/dev/isa/fd.c
+++ b/sys/dev/isa/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.86 2010/08/28 20:23:22 matthew Exp $ */
+/* $OpenBSD: fd.c,v 1.87 2010/09/08 14:47:12 jsing Exp $ */
/* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */
/*-
@@ -304,7 +304,7 @@ fdattach(parent, self, aux)
* Initialize and attach the disk structure.
*/
fd->sc_dk.dk_name = fd->sc_dev.dv_xname;
- disk_attach(&fd->sc_dk);
+ disk_attach(&fd->sc_dev, &fd->sc_dk);
/* Needed to power off if the motor is on when we halt. */
fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd);
diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c
index 677693a0f96..cb767ddddab 100644
--- a/sys/dev/isa/mcd.c
+++ b/sys/dev/isa/mcd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mcd.c,v 1.54 2010/08/28 20:23:22 matthew Exp $ */
+/* $OpenBSD: mcd.c,v 1.55 2010/09/08 14:47:12 jsing Exp $ */
/* $NetBSD: mcd.c,v 1.60 1998/01/14 12:14:41 drochner Exp $ */
/*
@@ -270,7 +270,7 @@ mcdattach(parent, self, aux)
* Initialize and attach the disk structure.
*/
sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
- disk_attach(&sc->sc_dk);
+ disk_attach(&sc->sc_dev, &sc->sc_dk);
printf(": model %s\n", sc->type != 0 ? sc->type : "unknown");
diff --git a/sys/dev/raidframe/rf_openbsdkintf.c b/sys/dev/raidframe/rf_openbsdkintf.c
index 69bba6d32a5..0b5eded062a 100644
--- a/sys/dev/raidframe/rf_openbsdkintf.c
+++ b/sys/dev/raidframe/rf_openbsdkintf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rf_openbsdkintf.c,v 1.57 2010/06/26 23:24:45 guenther Exp $ */
+/* $OpenBSD: rf_openbsdkintf.c,v 1.58 2010/09/08 14:47:12 jsing Exp $ */
/* $NetBSD: rf_netbsdkintf.c,v 1.109 2001/07/27 03:30:07 oster Exp $ */
/*-
@@ -1619,7 +1619,7 @@ raidinit(RF_Raid_t *raidPtr)
* other things, so it's critical to call this *BEFORE* we try
* putzing with disklabels.
*/
- disk_attach(&rs->sc_dkdev);
+ disk_attach(NULL, &rs->sc_dkdev);
/*
* XXX There may be a weird interaction here between this, and
diff --git a/sys/dev/ramdisk.c b/sys/dev/ramdisk.c
index 817269bf22c..714131e6ddd 100644
--- a/sys/dev/ramdisk.c
+++ b/sys/dev/ramdisk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ramdisk.c,v 1.48 2010/09/07 18:45:56 deraadt Exp $ */
+/* $OpenBSD: ramdisk.c,v 1.49 2010/09/08 14:47:12 jsing Exp $ */
/* $NetBSD: ramdisk.c,v 1.8 1996/04/12 08:30:09 leo Exp $ */
/*
@@ -204,7 +204,7 @@ rd_attach(struct device *parent, struct device *self, void *aux)
* Initialize and attach the disk structure.
*/
sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
- disk_attach(&sc->sc_dk);
+ disk_attach(&sc->sc_dev, &sc->sc_dk);
}
/*
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index 9b05245564b..86385fac3d5 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.101 2010/08/28 20:23:22 matthew Exp $ */
+/* $OpenBSD: vnd.c,v 1.102 2010/09/08 14:47:12 jsing Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -866,7 +866,7 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
/* Attach the disk. */
vnd->sc_dk.dk_name = vnd->sc_dev.dv_xname;
- disk_attach(&vnd->sc_dk);
+ disk_attach(&vnd->sc_dev, &vnd->sc_dk);
vndunlock(vnd);
diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c
index 192b892a68b..abaacf364d1 100644
--- a/sys/kern/subr_disk.c
+++ b/sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_disk.c,v 1.107 2010/09/01 20:16:51 miod Exp $ */
+/* $OpenBSD: subr_disk.c,v 1.108 2010/09/08 14:47:12 jsing Exp $ */
/* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */
/*
@@ -790,10 +790,9 @@ disk_construct(struct disk *diskp, char *lockname)
* Attach a disk.
*/
void
-disk_attach(struct disk *diskp)
+disk_attach(struct device *dv, struct disk *diskp)
{
- struct device *dv;
- dev_t *dev;
+ int majdev;
if (!ISSET(diskp->dk_flags, DKF_CONSTRUCTED))
disk_construct(diskp, diskp->dk_name);
@@ -821,12 +820,16 @@ disk_attach(struct disk *diskp)
disk_change = 1;
/*
- * Lookup and store device number for later use.
+ * Store device structure and number for later use.
*/
- dev = &diskp->dk_devno;
- dv = parsedisk(diskp->dk_name, strlen(diskp->dk_name), RAW_PART, dev);
- if (dv == NULL)
- diskp->dk_devno = NODEV;
+ diskp->dk_device = dv;
+ diskp->dk_devno = NODEV;
+ if (dv != NULL) {
+ majdev = findblkmajor(dv);
+ if (majdev >= 0)
+ diskp->dk_devno =
+ MAKEDISKDEV(majdev, dv->dv_unit, RAW_PART);
+ }
if (softraid_disk_attach)
softraid_disk_attach(diskp, 1);
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 26311902041..21e63c969d1 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.187 2010/09/07 16:21:47 deraadt Exp $ */
+/* $OpenBSD: cd.c,v 1.188 2010/09/08 14:47:12 jsing Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -229,7 +229,7 @@ cdattach(struct device *parent, struct device *self, void *aux)
&sc->sc_xsh);
/* Attach disk. */
- disk_attach(&sc->sc_dk);
+ disk_attach(&sc->sc_dev, &sc->sc_dk);
}
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 98cd5bab884..298aa71bc1a 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.209 2010/09/01 04:51:24 miod Exp $ */
+/* $OpenBSD: sd.c,v 1.210 2010/09/08 14:47:12 jsing Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -261,7 +261,7 @@ sdattach(struct device *parent, struct device *self, void *aux)
sc->sc_dev.dv_xname);
/* Attach disk. */
- disk_attach(&sc->sc_dk);
+ disk_attach(&sc->sc_dev, &sc->sc_dk);
}
int
diff --git a/sys/sys/disk.h b/sys/sys/disk.h
index 97f37767764..25af44558b2 100644
--- a/sys/sys/disk.h
+++ b/sys/sys/disk.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: disk.h,v 1.23 2010/08/30 16:53:28 jsing Exp $ */
+/* $OpenBSD: disk.h,v 1.24 2010/09/08 14:47:12 jsing Exp $ */
/* $NetBSD: disk.h,v 1.11 1996/04/28 20:22:50 thorpej Exp $ */
/*
@@ -48,6 +48,7 @@
* Disk device structures.
*/
+#include <sys/device.h>
#include <sys/time.h>
#include <sys/queue.h>
#include <sys/rwlock.h>
@@ -76,6 +77,7 @@ struct disk {
struct rwlock dk_lock; /* disk lock */
struct mutex dk_mtx; /* busy/unbusy mtx */
char *dk_name; /* disk name */
+ struct device *dk_device; /* disk device structure. */
dev_t dk_devno; /* disk device number. */
int dk_flags; /* disk flags */
#define DKF_CONSTRUCTED 0x0001
@@ -149,7 +151,7 @@ extern int disk_change; /* disk attached/detached */
void disk_init(void);
int disk_construct(struct disk *, char *);
-void disk_attach(struct disk *);
+void disk_attach(struct device *, struct disk *);
void disk_detach(struct disk *);
void disk_busy(struct disk *);
void disk_unbusy(struct disk *, long, int);