From 1066219897c1147c4f69ac6f5bc95b4a5ce73cd8 Mon Sep 17 00:00:00 2001 From: mycroft Date: Thu, 1 Dec 1994 12:04:43 +0000 Subject: [PATCH] Uncomment call to scsi_user_done(), and remove a duplicate biodone() (and another si_free()). --- sys/dev/scsipi/scsi_base.c | 6 ++-- sys/dev/scsipi/scsipi_ioctl.c | 53 +++++++++++++++-------------------- sys/scsi/scsi_base.c | 6 ++-- sys/scsi/scsi_ioctl.c | 53 +++++++++++++++-------------------- 4 files changed, 48 insertions(+), 70 deletions(-) diff --git a/sys/dev/scsipi/scsi_base.c b/sys/dev/scsipi/scsi_base.c index d03fd7290a11..4eb9c7b28bc8 100644 --- a/sys/dev/scsipi/scsi_base.c +++ b/sys/dev/scsipi/scsi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsi_base.c,v 1.18 1994/11/22 00:05:36 deraadt Exp $ */ +/* $NetBSD: scsi_base.c,v 1.19 1994/12/01 12:04:43 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -282,12 +282,10 @@ scsi_done(xs) * xs when the user returns. (and restarting the device's queue). */ if (xs->flags & SCSI_USER) { - biodone(xs->bp); -#ifdef NOTNOW SC_DEBUG(sc_link, SDEV_DB3, ("calling user done()\n")); scsi_user_done(xs); /* to take a copy of the sense etc. */ SC_DEBUG(sc_link, SDEV_DB3, ("returned from user done()\n ")); -#endif + free_xs(xs, sc_link, SCSI_NOSLEEP); /* restarts queue too */ SC_DEBUG(sc_link, SDEV_DB3, ("returning to adapter\n")); return; diff --git a/sys/dev/scsipi/scsipi_ioctl.c b/sys/dev/scsipi/scsipi_ioctl.c index 825772c91429..39218bc0120f 100644 --- a/sys/dev/scsipi/scsipi_ioctl.c +++ b/sys/dev/scsipi/scsipi_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsipi_ioctl.c,v 1.11 1994/12/01 11:53:56 mycroft Exp $ */ +/* $NetBSD: scsipi_ioctl.c,v 1.12 1994/12/01 12:04:45 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -48,8 +48,6 @@ #include #include -void scsierr __P((struct buf *, int)); - struct scsi_ioctl { LIST_ENTRY(scsi_ioctl) si_list; struct buf si_bp; @@ -167,8 +165,6 @@ scsi_user_done(xs) break; } biodone(bp); /* we're waiting on it in scsi_strategy() */ - - si_free(si); } @@ -201,16 +197,16 @@ scsistrategy(bp) si = si_find(bp); if (!si) { printf("user_strat: No ioctl\n"); - scsierr(bp, EINVAL); - return; + error = EINVAL; + goto bad; } screq = &si->si_screq; sc_link = si->si_sc_link; if (!sc_link) { printf("user_strat: No link pointer\n"); - scsierr(bp, EINVAL); - return; + error = EINVAL; + goto bad; } SC_DEBUG(sc_link, SDEV_DB2, ("user_strategy\n")); @@ -220,20 +216,20 @@ scsistrategy(bp) if (bp->b_bcount != screq->datalen) { sc_print_addr(sc_link); printf("physio split the request.. cannot proceed\n"); - scsierr(bp, EIO); - return; + error = EIO; + goto bad; } if (screq->timeout == 0) { - scsierr(bp, EINVAL); - return; + error = EINVAL; + goto bad; } if (screq->cmdlen > sizeof(struct scsi_generic)) { sc_print_addr(sc_link); printf("cmdlen too big\n"); - scsierr(bp, EFAULT); - return; + error = EFAULT; + goto bad; } if (screq->flags & SCCMD_READ) @@ -251,16 +247,22 @@ scsistrategy(bp) screq->timeout, bp, flags | SCSI_USER); /* because there is a bp, scsi_scsi_cmd will return immediatly */ - if (error) { - scsierr(bp, error); - return; - } + if (error) + goto bad; + SC_DEBUG(sc_link, SDEV_DB3, ("about to sleep\n")); s = splbio(); - while (!(bp->b_flags & B_DONE)) + while ((bp->b_flags & B_DONE) == 0) tsleep(bp, PRIBIO, "scistr", 0); splx(s); SC_DEBUG(sc_link, SDEV_DB3, ("back from sleep\n")); + + return; + +bad: + bp->b_flags |= B_ERROR; + bp->b_error = error; + biodone(bp); } /* @@ -363,14 +365,3 @@ scsi_do_ioctl(sc_link, dev, cmd, addr, f) panic("scsi_do_ioctl: impossible"); #endif } - -void -scsierr(bp, error) - struct buf *bp; - int error; -{ - - bp->b_flags |= B_ERROR; - bp->b_error = error; - biodone(bp); -} diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index d03fd7290a11..4eb9c7b28bc8 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsi_base.c,v 1.18 1994/11/22 00:05:36 deraadt Exp $ */ +/* $NetBSD: scsi_base.c,v 1.19 1994/12/01 12:04:43 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -282,12 +282,10 @@ scsi_done(xs) * xs when the user returns. (and restarting the device's queue). */ if (xs->flags & SCSI_USER) { - biodone(xs->bp); -#ifdef NOTNOW SC_DEBUG(sc_link, SDEV_DB3, ("calling user done()\n")); scsi_user_done(xs); /* to take a copy of the sense etc. */ SC_DEBUG(sc_link, SDEV_DB3, ("returned from user done()\n ")); -#endif + free_xs(xs, sc_link, SCSI_NOSLEEP); /* restarts queue too */ SC_DEBUG(sc_link, SDEV_DB3, ("returning to adapter\n")); return; diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c index 3b3baa7a65dc..fb346fedf38c 100644 --- a/sys/scsi/scsi_ioctl.c +++ b/sys/scsi/scsi_ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsi_ioctl.c,v 1.11 1994/12/01 11:53:56 mycroft Exp $ */ +/* $NetBSD: scsi_ioctl.c,v 1.12 1994/12/01 12:04:45 mycroft Exp $ */ /* * Copyright (c) 1994 Charles Hannum. All rights reserved. @@ -48,8 +48,6 @@ #include #include -void scsierr __P((struct buf *, int)); - struct scsi_ioctl { LIST_ENTRY(scsi_ioctl) si_list; struct buf si_bp; @@ -167,8 +165,6 @@ scsi_user_done(xs) break; } biodone(bp); /* we're waiting on it in scsi_strategy() */ - - si_free(si); } @@ -201,16 +197,16 @@ scsistrategy(bp) si = si_find(bp); if (!si) { printf("user_strat: No ioctl\n"); - scsierr(bp, EINVAL); - return; + error = EINVAL; + goto bad; } screq = &si->si_screq; sc_link = si->si_sc_link; if (!sc_link) { printf("user_strat: No link pointer\n"); - scsierr(bp, EINVAL); - return; + error = EINVAL; + goto bad; } SC_DEBUG(sc_link, SDEV_DB2, ("user_strategy\n")); @@ -220,20 +216,20 @@ scsistrategy(bp) if (bp->b_bcount != screq->datalen) { sc_print_addr(sc_link); printf("physio split the request.. cannot proceed\n"); - scsierr(bp, EIO); - return; + error = EIO; + goto bad; } if (screq->timeout == 0) { - scsierr(bp, EINVAL); - return; + error = EINVAL; + goto bad; } if (screq->cmdlen > sizeof(struct scsi_generic)) { sc_print_addr(sc_link); printf("cmdlen too big\n"); - scsierr(bp, EFAULT); - return; + error = EFAULT; + goto bad; } if (screq->flags & SCCMD_READ) @@ -251,16 +247,22 @@ scsistrategy(bp) screq->timeout, bp, flags | SCSI_USER); /* because there is a bp, scsi_scsi_cmd will return immediatly */ - if (error) { - scsierr(bp, error); - return; - } + if (error) + goto bad; + SC_DEBUG(sc_link, SDEV_DB3, ("about to sleep\n")); s = splbio(); - while (!(bp->b_flags & B_DONE)) + while ((bp->b_flags & B_DONE) == 0) tsleep(bp, PRIBIO, "scistr", 0); splx(s); SC_DEBUG(sc_link, SDEV_DB3, ("back from sleep\n")); + + return; + +bad: + bp->b_flags |= B_ERROR; + bp->b_error = error; + biodone(bp); } /* @@ -363,14 +365,3 @@ scsi_do_ioctl(sc_link, dev, cmd, addr, f) panic("scsi_do_ioctl: impossible"); #endif } - -void -scsierr(bp, error) - struct buf *bp; - int error; -{ - - bp->b_flags |= B_ERROR; - bp->b_error = error; - biodone(bp); -}