summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2010-09-01 01:38:13 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2010-09-01 01:38:13 +0000
commitaa0e77253a76c57fda0220581374a0ced2f4b16e (patch)
tree87ed4a22e8fd3fbd25acb0fa7d17ddd5ef1bb967 /sys/dev
parentd51d4c9766720cb9333704e3b7f2ecb8a8a03aa1 (diff)
make struct bufq a member of the softc for devices that use it,
rather than it being a pointer to something that needs to be allocated at attach. since all these devices need a bufq to operate, it makes sense to have it allocated as part of the softc and get bufq_init to just initialise all its fields. it also gets rid of the possibility that you wont be able to allocate the bufq struct during attach, which is something you dont want to happen. secondly, it consistently implements a split between wrapper functions and the per discipline implementation of the bufq handlers. it consistently does the locking in the wrappers rather than doing half in the wrappers and the other half in the implementations. it also consistently handles the outstanding bufq bq pointer in the wrappers. this hides most of the implementation inside kern_bufq.c. the only stuff left in buf.h is for the bits each implementation needs to put inside struct buf. tested by thib@ krw@ and me ok thib@ matthew@ no objection from krw@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ata/wd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c
index 40b406ae01f..89375d47fd8 100644
--- a/sys/dev/ata/wd.c
+++ b/sys/dev/ata/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.90 2010/08/31 17:00:32 deraadt Exp $ */
+/* $OpenBSD: wd.c,v 1.91 2010/09/01 01:38:12 dlg Exp $ */
/* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */
/*
@@ -116,7 +116,7 @@ struct wd_softc {
/* General disk infos */
struct device sc_dev;
struct disk sc_dk;
- struct bufq *sc_bufq;
+ struct bufq sc_bufq;
/* IDE disk soft states */
struct ata_bio sc_wdc_bio; /* current transfer */
@@ -361,7 +361,7 @@ wdattach(struct device *parent, struct device *self, void *aux)
* Initialize disk structures.
*/
wd->sc_dk.dk_name = wd->sc_dev.dv_xname;
- wd->sc_bufq = bufq_init(BUFQ_DEFAULT);
+ bufq_init(&wd->sc_bufq, BUFQ_DEFAULT);
wd->sc_sdhook = shutdownhook_establish(wd_shutdown, wd);
if (wd->sc_sdhook == NULL)
printf("%s: WARNING: unable to establish shutdown hook\n",
@@ -416,7 +416,7 @@ wddetach(struct device *self, int flags)
/* Remove unprocessed buffers from queue */
s = splbio();
- while ((bp = BUFQ_DEQUEUE(sc->sc_bufq)) != NULL) {
+ while ((bp = bufq_dequeue(&sc->sc_bufq)) != NULL) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
biodone(bp);
@@ -438,7 +438,7 @@ wddetach(struct device *self, int flags)
shutdownhook_disestablish(sc->sc_sdhook);
/* Detach disk. */
- bufq_destroy(sc->sc_bufq);
+ bufq_destroy(&sc->sc_bufq);
disk_detach(&sc->sc_dk);
return (0);
@@ -489,7 +489,7 @@ wdstrategy(struct buf *bp)
(wd->sc_flags & (WDF_WLABEL|WDF_LABELLING)) != 0) <= 0)
goto done;
/* Queue transfer on drive, activate drive and controller if idle. */
- BUFQ_QUEUE(wd->sc_bufq, bp);
+ bufq_queue(&wd->sc_bufq, bp);
s = splbio();
wdstart(wd);
splx(s);
@@ -521,7 +521,7 @@ wdstart(void *arg)
while (wd->openings > 0) {
/* Is there a buf for us ? */
- if ((bp = BUFQ_DEQUEUE(wd->sc_bufq)) == NULL)
+ if ((bp = bufq_dequeue(&wd->sc_bufq)) == NULL)
return;
/*
* Make the command. First lock the device