summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2012-01-20 14:43:06 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2012-01-20 14:43:06 +0000
commitf3d4597b62c25b3017dd1f69829f36538367451c (patch)
tree74662ebd497b2b1b3d8109b05b299b9588197fd7 /sys/dev
parentb902c5dce851c07f17896db2aeb50abddb23c37b (diff)
Add bio(4) status interface structs and utility functions to softraid(4).
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/softraid.c32
-rw-r--r--sys/dev/softraidvar.h8
2 files changed, 37 insertions, 3 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index dbe3ef16ff3..2800285d407 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.267 2012/01/17 13:53:02 jsing Exp $ */
+/* $OpenBSD: softraid.c,v 1.268 2012/01/20 14:43:05 jsing Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -1837,6 +1837,36 @@ sr_detach(struct device *self, int flags)
}
void
+sr_info(struct sr_softc *sc, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ bio_status(&sc->sc_status, 0, BIO_MSG_INFO, fmt, &ap);
+ va_end(ap);
+}
+
+void
+sr_warn(struct sr_softc *sc, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ bio_status(&sc->sc_status, 1, BIO_MSG_WARN, fmt, &ap);
+ va_end(ap);
+}
+
+void
+sr_error(struct sr_softc *sc, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ bio_status(&sc->sc_status, 1, BIO_MSG_ERROR, fmt, &ap);
+ va_end(ap);
+}
+
+void
sr_minphys(struct buf *bp, struct scsi_link *sl)
{
DNPRINTF(SR_D_MISC, "sr_minphys: %d\n", bp->b_bcount);
diff --git a/sys/dev/softraidvar.h b/sys/dev/softraidvar.h
index b615ce2afb3..400b0c5766a 100644
--- a/sys/dev/softraidvar.h
+++ b/sys/dev/softraidvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraidvar.h,v 1.114 2012/01/11 14:10:51 jsing Exp $ */
+/* $OpenBSD: softraidvar.h,v 1.115 2012/01/20 14:43:05 jsing Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -608,8 +608,9 @@ struct sr_softc {
struct rwlock sc_lock;
+ struct bio_status sc_status; /* Status and messages. */
+
struct sr_chunk_head sc_hotspare_list; /* List of hotspares. */
- struct sr_chunk **sc_hotspares; /* Array to hotspare chunks. */
struct rwlock sc_hs_lock; /* Lock for hotspares list. */
int sc_hotspare_no; /* Number of hotspares. */
@@ -644,6 +645,9 @@ void *sr_wu_get(void *);
void sr_wu_put(void *, void *);
/* misc functions */
+void sr_info(struct sr_softc *, const char *, ...);
+void sr_warn(struct sr_softc *, const char *, ...);
+void sr_error(struct sr_softc *, const char *, ...);
int32_t sr_validate_stripsize(u_int32_t);
int sr_meta_read(struct sr_discipline *);
int sr_meta_native_read(struct sr_discipline *, dev_t,