summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2008-06-14 18:40:51 +0000
committerHans-Joerg Hoexer <hshoexer@cvs.openbsd.org>2008-06-14 18:40:51 +0000
commitc24cac3d7d863fe994810581cd1e0cbc88ed65c1 (patch)
tree267572d44f5d851b24c03c5ab37ea3f687764b6e /sys/dev
parente96f082fe7aa596575191d8ca8fdf0d8a5d7ad78 (diff)
Provide a status field for operations on the bc_opaque data. Now we're
able to distinguish cleanly an failing ioctl (ie. return value -1) from trying to retrieve a KDF hint from a not yet initialized volume. ok marco djm
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/biovar.h5
-rw-r--r--sys/dev/softraid.c10
-rw-r--r--sys/dev/softraid_crypto.c3
3 files changed, 15 insertions, 3 deletions
diff --git a/sys/dev/biovar.h b/sys/dev/biovar.h
index 53158e83fb3..230a4e9a824 100644
--- a/sys/dev/biovar.h
+++ b/sys/dev/biovar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biovar.h,v 1.30 2008/06/12 00:19:15 marco Exp $ */
+/* $OpenBSD: biovar.h,v 1.31 2008/06/14 18:40:50 hshoexer Exp $ */
/*
* Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
@@ -185,6 +185,9 @@ struct bioc_createraid {
#define BIOC_SOINVALID 0x00 /* no opaque pointer */
#define BIOC_SOIN 0x01 /* kernel perspective direction */
#define BIOC_SOOUT 0x02 /* kernel perspective direction */
+ u_int32_t bc_opaque_status;
+#define BIOC_SOINOUT_FAILED 0x00 /* operation failed */
+#define BIOC_SOINOUT_OK 0x01 /* operation succeeded */
void *bc_opaque;
};
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 6243a8be7bb..eec9eaaffdb 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.114 2008/06/14 00:16:38 hshoexer Exp $ */
+/* $OpenBSD: softraid.c,v 1.115 2008/06/14 18:40:50 hshoexer Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Chris Kuethe <ckuethe@openbsd.org>
@@ -827,6 +827,13 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, int user)
if (no_chunk != 1)
goto unwind;
+ /* no hint available yet */
+ if (bc->bc_opaque_flags & BIOC_SOOUT) {
+ bc->bc_opaque_status = BIOC_SOINOUT_FAILED;
+ rv = 0;
+ goto unwind;
+ }
+
if (!(bc->bc_flags & BIOC_SCNOAUTOASSEMBLE))
goto unwind;
@@ -891,6 +898,7 @@ sr_ioctl_createraid(struct sr_softc *sc, struct bioc_createraid *bc, int user)
goto unwind;
/* we're done */
+ bc->bc_opaque_status = BIOC_SOINOUT_OK;
rv = 0;
goto unwind;
}
diff --git a/sys/dev/softraid_crypto.c b/sys/dev/softraid_crypto.c
index 3a8ba41e3e4..94d166e046e 100644
--- a/sys/dev/softraid_crypto.c
+++ b/sys/dev/softraid_crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid_crypto.c,v 1.26 2008/06/14 03:01:00 djm Exp $ */
+/* $OpenBSD: softraid_crypto.c,v 1.27 2008/06/14 18:40:50 hshoexer Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
* Copyright (c) 2008 Hans-Joerg Hoexer <hshoexer@openbsd.org>
@@ -234,6 +234,7 @@ sr_crypto_get_kdf(struct bioc_createraid *bc, struct sr_discipline *sd)
sizeof(kdfinfo->maskkey));
}
+ bc->bc_opaque_status = BIOC_SOINOUT_OK;
rv = 0;
out:
bzero(kdfinfo, bc->bc_opaque_size);