summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2013-03-30 02:02:15 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2013-03-30 02:02:15 +0000
commitc204ba65e82fc819b81911ca83a5652ef73c7e65 (patch)
treebe075fc59168ec889c852e1ce8320c282493c51b
parent021e78a7e200225eb720f6c1265ad51f5580bd2d (diff)
Provide a default discipline interrupt handling function and migrate all of
the disciplines that now have the same interrupt code. ok krw@
-rw-r--r--sys/dev/softraid.c24
-rw-r--r--sys/dev/softraid_concat.c24
-rw-r--r--sys/dev/softraid_crypto.c23
-rw-r--r--sys/dev/softraid_raid0.c24
-rw-r--r--sys/dev/softraidvar.h3
5 files changed, 27 insertions, 71 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index b7216d91779..1b30c86cdb7 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.293 2013/03/29 12:00:59 jsing Exp $ */
+/* $OpenBSD: softraid.c,v 1.294 2013/03/30 02:02:13 jsing Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -3874,7 +3874,7 @@ sr_discipline_init(struct sr_discipline *sd, int level)
sd->sd_scsi_start_stop = sr_raid_start_stop;
sd->sd_scsi_sync = sr_raid_sync;
sd->sd_scsi_rw = NULL;
- sd->sd_scsi_intr = NULL;
+ sd->sd_scsi_intr = sr_raid_intr;
sd->sd_scsi_done = NULL;
sd->sd_set_chunk_state = sr_set_chunk_state;
sd->sd_set_vol_state = sr_set_vol_state;
@@ -4083,6 +4083,26 @@ sr_raid_sync(struct sr_workunit *wu)
}
void
+sr_raid_intr(struct buf *bp)
+{
+ struct sr_ccb *ccb = (struct sr_ccb *)bp;
+ struct sr_workunit *wu = ccb->ccb_wu;
+#ifdef SR_DEBUG
+ struct sr_discipline *sd = wu->swu_dis;
+ struct scsi_xfer *xs = wu->swu_xs;
+#endif
+ int s;
+
+ DNPRINTF(SR_D_INTR, "%s: %s %s intr bp %p xs %p\n",
+ DEVNAME(sd->sd_sc), sd->sd_meta->ssd_devname, sd->sd_name, bp, xs);
+
+ s = splbio();
+ sr_ccb_done(ccb);
+ sr_wu_done(wu);
+ splx(s);
+}
+
+void
sr_startwu_callback(void *arg1, void *arg2)
{
struct sr_discipline *sd = arg1;
diff --git a/sys/dev/softraid_concat.c b/sys/dev/softraid_concat.c
index 0242954503a..e5f6ee270e8 100644
--- a/sys/dev/softraid_concat.c
+++ b/sys/dev/softraid_concat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_concat.c,v 1.11 2013/03/02 12:50:01 jsing Exp $ */
+/* $OpenBSD: softraid_concat.c,v 1.12 2013/03/30 02:02:14 jsing Exp $ */
/*
* Copyright (c) 2008 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2011 Joel Sing <jsing@openbsd.org>
@@ -39,7 +39,6 @@ int sr_concat_assemble(struct sr_discipline *, struct bioc_createraid *,
int sr_concat_alloc_resources(struct sr_discipline *);
int sr_concat_free_resources(struct sr_discipline *);
int sr_concat_rw(struct sr_workunit *);
-void sr_concat_intr(struct buf *);
/* Discipline initialisation. */
void
@@ -58,7 +57,6 @@ sr_concat_discipline_init(struct sr_discipline *sd)
sd->sd_create = sr_concat_create;
sd->sd_free_resources = sr_concat_free_resources;
sd->sd_scsi_rw = sr_concat_rw;
- sd->sd_scsi_intr = sr_concat_intr;
}
int
@@ -207,23 +205,3 @@ bad:
/* wu is unwound by sr_wu_put */
return (1);
}
-
-void
-sr_concat_intr(struct buf *bp)
-{
- struct sr_ccb *ccb = (struct sr_ccb *)bp;
- struct sr_workunit *wu = ccb->ccb_wu;
-#ifdef SR_DEBUG
- struct sr_discipline *sd = wu->swu_dis;
- struct scsi_xfer *xs = wu->swu_xs;
-#endif
- int s;
-
- DNPRINTF(SR_D_INTR, "%s: %s %s intr bp %x xs %x\n",
- DEVNAME(sd->sd_sc), sd->sd_meta->ssd_devname, sd->sd_name, bp, xs);
-
- s = splbio();
- sr_ccb_done(ccb);
- sr_wu_done(wu);
- splx(s);
-}
diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c
index 2e8b27436db..c17e6881677 100644
--- a/sys/dev/softraid_crypto.c
+++ b/sys/dev/softraid_crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_crypto.c,v 1.88 2013/03/29 11:46:45 jsing Exp $ */
+/* $OpenBSD: softraid_crypto.c,v 1.89 2013/03/30 02:02:14 jsing Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Hans-Joerg Hoexer <hshoexer@openbsd.org>
@@ -95,7 +95,6 @@ int sr_crypto_meta_opt_handler(struct sr_discipline *,
int sr_crypto_write(struct cryptop *);
int sr_crypto_rw(struct sr_workunit *);
int sr_crypto_rw2(struct sr_workunit *, struct sr_crypto_wu *);
-void sr_crypto_intr(struct buf *);
void sr_crypto_done(struct sr_workunit *);
int sr_crypto_read(struct cryptop *);
void sr_crypto_finish_io(struct sr_workunit *);
@@ -130,7 +129,6 @@ sr_crypto_discipline_init(struct sr_discipline *sd)
sd->sd_ioctl_handler = sr_crypto_ioctl;
sd->sd_meta_opt_handler = sr_crypto_meta_opt_handler;
sd->sd_scsi_rw = sr_crypto_rw;
- sd->sd_scsi_intr = sr_crypto_intr;
sd->sd_scsi_done = sr_crypto_done;
}
@@ -1260,25 +1258,6 @@ bad:
}
void
-sr_crypto_intr(struct buf *bp)
-{
- struct sr_ccb *ccb = (struct sr_ccb *)bp;
- struct sr_workunit *wu = ccb->ccb_wu;
-#ifdef SR_DEBUG
- struct sr_discipline *sd = wu->swu_dis;
-#endif
- int s;
-
- DNPRINTF(SR_D_INTR, "%s: sr_crypto_intr bp %x xs %x\n",
- DEVNAME(sd->sd_sc), bp, wu->swu_xs);
-
- s = splbio();
- sr_ccb_done(ccb);
- sr_wu_done(wu);
- splx(s);
-}
-
-void
sr_crypto_done(struct sr_workunit *wu)
{
struct scsi_xfer *xs = wu->swu_xs;
diff --git a/sys/dev/softraid_raid0.c b/sys/dev/softraid_raid0.c
index 4b83d6c63e5..4e87e3cfa00 100644
--- a/sys/dev/softraid_raid0.c
+++ b/sys/dev/softraid_raid0.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_raid0.c,v 1.35 2013/03/02 12:50:01 jsing Exp $ */
+/* $OpenBSD: softraid_raid0.c,v 1.36 2013/03/30 02:02:14 jsing Exp $ */
/*
* Copyright (c) 2008 Marco Peereboom <marco@peereboom.us>
*
@@ -51,7 +51,6 @@ int sr_raid0_assemble(struct sr_discipline *, struct bioc_createraid *,
int sr_raid0_alloc_resources(struct sr_discipline *);
int sr_raid0_free_resources(struct sr_discipline *);
int sr_raid0_rw(struct sr_workunit *);
-void sr_raid0_intr(struct buf *);
/* Discipline initialisation. */
void
@@ -70,7 +69,6 @@ sr_raid0_discipline_init(struct sr_discipline *sd)
sd->sd_create = sr_raid0_create;
sd->sd_free_resources = sr_raid0_free_resources;
sd->sd_scsi_rw = sr_raid0_rw;
- sd->sd_scsi_intr = sr_raid0_intr;
}
int
@@ -235,23 +233,3 @@ bad:
/* wu is unwound by sr_wu_put */
return (1);
}
-
-void
-sr_raid0_intr(struct buf *bp)
-{
- struct sr_ccb *ccb = (struct sr_ccb *)bp;
- struct sr_workunit *wu = ccb->ccb_wu;
-#ifdef SR_DEBUG
- struct scsi_xfer *xs = wu->swu_xs;
- struct sr_discipline *sd = wu->swu_dis;
-#endif
- int s;
-
- DNPRINTF(SR_D_INTR, "%s: %s %s intr bp %x xs %x\n",
- DEVNAME(sd->sd_sc), sd->sd_meta->ssd_devname, sd->sd_name, bp, xs);
-
- s = splbio();
- sr_ccb_done(ccb);
- sr_wu_done(wu);
- splx(s);
-}
diff --git a/sys/dev/softraidvar.h b/sys/dev/softraidvar.h
index 4d654d04fc6..dbbcd78ec2b 100644
--- a/sys/dev/softraidvar.h
+++ b/sys/dev/softraidvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraidvar.h,v 1.130 2013/03/29 12:00:59 jsing Exp $ */
+/* $OpenBSD: softraidvar.h,v 1.131 2013/03/30 02:02:14 jsing Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -697,6 +697,7 @@ int sr_raid_tur(struct sr_workunit *);
int sr_raid_request_sense( struct sr_workunit *);
int sr_raid_start_stop(struct sr_workunit *);
int sr_raid_sync(struct sr_workunit *);
+void sr_raid_intr(struct buf *);
void sr_raid_startwu(struct sr_workunit *);
void sr_raid_recreate_wu(struct sr_workunit *);