From e8dded5513f1860c366debd62a97531ea1b343db Mon Sep 17 00:00:00 2001 From: thorpej Date: Sat, 11 Sep 1999 21:39:53 +0000 Subject: [PATCH] Implement a function to kill off all commands pending for a given scsipi_link. --- sys/dev/scsipi/scsipi_base.c | 20 +++++++++++++++++++- sys/dev/scsipi/scsipiconf.h | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/sys/dev/scsipi/scsipi_base.c b/sys/dev/scsipi/scsipi_base.c index db4a08097920..5e48cd1a3d90 100644 --- a/sys/dev/scsipi/scsipi_base.c +++ b/sys/dev/scsipi/scsipi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsipi_base.c,v 1.22 1999/06/16 07:35:31 pk Exp $ */ +/* $NetBSD: scsipi_base.c,v 1.23 1999/09/11 21:39:53 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -187,6 +187,24 @@ scsipi_wait_drain(sc_link) splx(s); } +/* + * Kill off all pending xfers for a scsipi_link. + * + * Must be called at splbio(). + */ +void +scsipi_kill_pending(sc_link) + struct scsipi_link *sc_link; +{ + struct scsipi_xfer *xs; + + while ((xs = TAILQ_FIRST(&sc_link->pending_xfers)) != NULL) { + xs->flags |= ITSDONE; + xs->error = ENODEV; + scsipi_done(xs); + } +} + /* * Look at the returned sense and act on the error, determining * the unix error number to pass back. (0 = report no error) diff --git a/sys/dev/scsipi/scsipiconf.h b/sys/dev/scsipi/scsipiconf.h index 1f90fce05d81..042080c51671 100644 --- a/sys/dev/scsipi/scsipiconf.h +++ b/sys/dev/scsipi/scsipiconf.h @@ -1,4 +1,4 @@ -/* $NetBSD: scsipiconf.h,v 1.30 1999/04/08 11:29:01 bouyer Exp $ */ +/* $NetBSD: scsipiconf.h,v 1.31 1999/09/11 21:39:53 thorpej Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -393,6 +393,7 @@ void scsipi_done __P((struct scsipi_xfer *)); void scsipi_user_done __P((struct scsipi_xfer *)); int scsipi_interpret_sense __P((struct scsipi_xfer *)); void scsipi_wait_drain __P((struct scsipi_link *)); +void scsipi_kill_pending __P((struct scsipi_link *)); #ifdef SCSIVERBOSE void scsipi_print_sense __P((struct scsipi_xfer *, int)); void scsipi_print_sense_data __P((struct scsipi_sense_data *, int));