From b72229d6eed700a5bf3b7e886251e419dec7286b Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Wed, 11 Apr 2007 10:54:58 +0000 Subject: Use a separate function to remove the buffers in sddetach. No functional change. ok krw --- sys/scsi/sd.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index bad594ff169..0d7a6a2317d 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sd.c,v 1.122 2007/04/10 16:41:45 bluhm Exp $ */ +/* $OpenBSD: sd.c,v 1.123 2007/04/11 10:54:57 bluhm Exp $ */ /* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */ /*- @@ -105,6 +105,7 @@ int sd_reassign_blocks(struct sd_softc *, u_long); int sd_interpret_sense(struct scsi_xfer *); int sd_get_parms(struct sd_softc *, struct disk_parms *, int); void sd_flush(struct sd_softc *, int); +void sd_kill_buffers(struct sd_softc *); void viscpy(u_char *, u_char *, int); @@ -285,19 +286,9 @@ int sddetach(struct device *self, int flags) { struct sd_softc *sd = (struct sd_softc *)self; - struct buf *dp, *bp; - int s, bmaj, cmaj, mn; + int bmaj, cmaj, mn; - /* Remove unprocessed buffers from queue */ - s = splbio(); - for (dp = &sd->buf_queue; (bp = dp->b_actf) != NULL; ) { - dp->b_actf = bp->b_actf; - - bp->b_error = ENXIO; - bp->b_flags |= B_ERROR; - biodone(bp); - } - splx(s); + sd_kill_buffers(sd); /* locate the minor number */ mn = SDMINOR(self->dv_unit, 0); @@ -1474,3 +1465,23 @@ sd_flush(struct sd_softc *sd, int flags) sd->flags |= SDF_FLUSHING; } } + +/* + * Remove unprocessed buffers from queue. + */ +void +sd_kill_buffers(struct sd_softc *sd) +{ + struct buf *dp, *bp; + int s; + + s = splbio(); + for (dp = &sd->buf_queue; (bp = dp->b_actf) != NULL; ) { + dp->b_actf = bp->b_actf; + + bp->b_error = ENXIO; + bp->b_flags |= B_ERROR; + biodone(bp); + } + splx(s); +} -- cgit v1.2.3