summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authoroster <oster@NetBSD.org>2003-12-29 04:56:26 +0000
committeroster <oster@NetBSD.org>2003-12-29 04:56:26 +0000
commitb2b64281151373154a920a3b4e202e3371130159 (patch)
tree070d3116447e07d217928516c40f6f23c0ace083 /sys/dev/raidframe
parenta481fc8f48d0835da6840ec884ba5150f8047e4f (diff)
Simplify defn's of rf_mutex_init() and rf_mutex_destroy(). Since
neither of these ever fail, no need to have a return value. That makes all the "error detection" on these functions completely unneeded. But since we're here, if we don't have a return value, then why not make these macros? My.. look how things keep shrinking, with no loss in functionality!
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_acctrace.c9
-rw-r--r--sys/dev/raidframe/rf_netbsdkintf.c9
-rw-r--r--sys/dev/raidframe/rf_psstatus.c23
-rw-r--r--sys/dev/raidframe/rf_reconmap.c13
-rw-r--r--sys/dev/raidframe/rf_stripelocks.c13
-rw-r--r--sys/dev/raidframe/rf_threadstuff.c37
-rw-r--r--sys/dev/raidframe/rf_threadstuff.h7
7 files changed, 31 insertions, 80 deletions
diff --git a/sys/dev/raidframe/rf_acctrace.c b/sys/dev/raidframe/rf_acctrace.c
index c2ba5a9b7e0..bb9f5fd7d7c 100644
--- a/sys/dev/raidframe/rf_acctrace.c
+++ b/sys/dev/raidframe/rf_acctrace.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_acctrace.c,v 1.10 2002/09/14 18:17:52 oster Exp $ */
+/* $NetBSD: rf_acctrace.c,v 1.11 2003/12/29 04:56:26 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_acctrace.c,v 1.10 2002/09/14 18:17:52 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_acctrace.c,v 1.11 2003/12/29 04:56:26 oster Exp $");
#include <sys/stat.h>
#include <sys/types.h>
@@ -81,10 +81,7 @@ rf_ConfigureAccessTrace(listp)
accessTraceBufCount = 0;
}
numTracesSoFar = 0;
- rc = rf_mutex_init(&rf_tracing_mutex);
- if (rc) {
- rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc);
- }
+ rf_mutex_init(&rf_tracing_mutex);
rc = rf_ShutdownCreate(listp, rf_ShutdownAccessTrace, NULL);
if (rc) {
rf_print_unable_to_add_shutdown(__FILE__, __LINE__, rc);
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c
index bcb4738e5c1..4a066d8a8eb 100644
--- a/sys/dev/raidframe/rf_netbsdkintf.c
+++ b/sys/dev/raidframe/rf_netbsdkintf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_netbsdkintf.c,v 1.167 2003/12/29 03:33:48 oster Exp $ */
+/* $NetBSD: rf_netbsdkintf.c,v 1.168 2003/12/29 04:56:26 oster Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -146,7 +146,7 @@
***********************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.167 2003/12/29 03:33:48 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.168 2003/12/29 04:56:26 oster Exp $");
#include <sys/param.h>
#include <sys/errno.h>
@@ -367,10 +367,7 @@ raidattach(num)
pool_init(&raidframe_cbufpool, sizeof(struct raidbuf), 0,
0, 0, "raidpl", NULL);
- rc = rf_mutex_init(&rf_sparet_wait_mutex);
- if (rc) {
- RF_PANIC();
- }
+ rf_mutex_init(&rf_sparet_wait_mutex);
rf_sparet_wait_queue = rf_sparet_resp_queue = NULL;
diff --git a/sys/dev/raidframe/rf_psstatus.c b/sys/dev/raidframe/rf_psstatus.c
index 4edabc14901..9039f220bf6 100644
--- a/sys/dev/raidframe/rf_psstatus.c
+++ b/sys/dev/raidframe/rf_psstatus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_psstatus.c,v 1.16 2003/12/29 03:33:48 oster Exp $ */
+/* $NetBSD: rf_psstatus.c,v 1.17 2003/12/29 04:56:26 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -37,7 +37,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_psstatus.c,v 1.16 2003/12/29 03:33:48 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_psstatus.c,v 1.17 2003/12/29 04:56:26 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -113,22 +113,13 @@ rf_MakeParityStripeStatusTable(raidPtr)
RF_Raid_t *raidPtr;
{
RF_PSStatusHeader_t *pssTable;
- int i, j, rc;
-
+ int i;
+
RF_Malloc(pssTable,
- raidPtr->pssTableSize * sizeof(RF_PSStatusHeader_t),
- (RF_PSStatusHeader_t *));
+ raidPtr->pssTableSize * sizeof(RF_PSStatusHeader_t),
+ (RF_PSStatusHeader_t *));
for (i = 0; i < raidPtr->pssTableSize; i++) {
- rc = rf_mutex_init(&pssTable[i].mutex);
- if (rc) {
- rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc);
- /* fail and deallocate */
- for (j = 0; j < i; j++) {
- rf_mutex_destroy(&pssTable[i].mutex);
- }
- RF_Free(pssTable, raidPtr->pssTableSize * sizeof(RF_PSStatusHeader_t));
- return (NULL);
- }
+ rf_mutex_init(&pssTable[i].mutex);
}
return (pssTable);
}
diff --git a/sys/dev/raidframe/rf_reconmap.c b/sys/dev/raidframe/rf_reconmap.c
index 9f2e7a9cdea..9cdbb36b171 100644
--- a/sys/dev/raidframe/rf_reconmap.c
+++ b/sys/dev/raidframe/rf_reconmap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_reconmap.c,v 1.19 2003/12/29 03:33:48 oster Exp $ */
+/* $NetBSD: rf_reconmap.c,v 1.20 2003/12/29 04:56:26 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -34,7 +34,7 @@
*************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.19 2003/12/29 03:33:48 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.20 2003/12/29 04:56:26 oster Exp $");
#include "rf_raid.h"
#include <sys/time.h>
@@ -92,7 +92,6 @@ rf_MakeReconMap(raidPtr, ru_sectors, disk_sectors, spareUnitsPerDisk)
RF_RaidLayout_t *layoutPtr = &raidPtr->Layout;
RF_ReconUnitCount_t num_rus = layoutPtr->stripeUnitsPerDisk / layoutPtr->SUsPerRU;
RF_ReconMap_t *p;
- int rc;
RF_Malloc(p, sizeof(RF_ReconMap_t), (RF_ReconMap_t *));
p->sectorsPerReconUnit = ru_sectors;
@@ -113,13 +112,7 @@ rf_MakeReconMap(raidPtr, ru_sectors, disk_sectors, spareUnitsPerDisk)
0, 0, "raidreconpl", NULL);
pool_prime(&p->elem_pool, RF_NUM_RECON_POOL_ELEM);
- rc = rf_mutex_init(&p->mutex);
- if (rc) {
- rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc);
- RF_Free(p->status, num_rus * sizeof(RF_ReconMapListElem_t *));
- RF_Free(p, sizeof(RF_ReconMap_t));
- return (NULL);
- }
+ rf_mutex_init(&p->mutex);
return (p);
}
diff --git a/sys/dev/raidframe/rf_stripelocks.c b/sys/dev/raidframe/rf_stripelocks.c
index 68f7a611e8e..e66f046a9f7 100644
--- a/sys/dev/raidframe/rf_stripelocks.c
+++ b/sys/dev/raidframe/rf_stripelocks.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_stripelocks.c,v 1.17 2003/12/29 03:33:48 oster Exp $ */
+/* $NetBSD: rf_stripelocks.c,v 1.18 2003/12/29 04:56:26 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.17 2003/12/29 03:33:48 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.18 2003/12/29 04:56:26 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -180,7 +180,7 @@ static RF_LockTableEntry_t *
rf_MakeLockTable()
{
RF_LockTableEntry_t *lockTable;
- int i, rc;
+ int i;
RF_Malloc(lockTable,
((int) rf_lockTableSize) * sizeof(RF_LockTableEntry_t),
@@ -188,12 +188,7 @@ rf_MakeLockTable()
if (lockTable == NULL)
return (NULL);
for (i = 0; i < rf_lockTableSize; i++) {
- rc = rf_mutex_init(&lockTable[i].mutex);
- if (rc) {
- rf_print_unable_to_init_mutex(__FILE__, __LINE__, rc);
- /* XXX clean up other mutexes */
- return (NULL);
- }
+ rf_mutex_init(&lockTable[i].mutex);
}
return (lockTable);
}
diff --git a/sys/dev/raidframe/rf_threadstuff.c b/sys/dev/raidframe/rf_threadstuff.c
index bd5a19fb4dd..c5178e1d2ff 100644
--- a/sys/dev/raidframe/rf_threadstuff.c
+++ b/sys/dev/raidframe/rf_threadstuff.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_threadstuff.c,v 1.12 2002/11/18 23:50:47 oster Exp $ */
+/* $NetBSD: rf_threadstuff.c,v 1.13 2003/12/29 04:56:26 oster Exp $ */
/*
* rf_threadstuff.c
*/
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_threadstuff.c,v 1.12 2002/11/18 23:50:47 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_threadstuff.c,v 1.13 2003/12/29 04:56:26 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -49,12 +49,8 @@ static void
mutex_destroyer(arg)
void *arg;
{
- int rc;
- rc = rf_mutex_destroy(arg);
- if (rc) {
- RF_ERRORMSG1("RAIDFRAME: Error %d auto-destroying mutex\n", rc);
- }
+ rf_mutex_destroy(arg);
}
static void
@@ -76,18 +72,14 @@ RF_DECLARE_MUTEX(*m)
char *file;
int line;
{
- int rc, rc1;
+ int rc;
+
+ rf_mutex_init(m);
- rc = rf_mutex_init(m);
- if (rc)
- return (rc);
rc = _rf_ShutdownCreate(listp, mutex_destroyer, (void *) m, file, line);
if (rc) {
RF_ERRORMSG1("RAIDFRAME: Error %d adding shutdown entry\n", rc);
- rc1 = rf_mutex_destroy(m);
- if (rc1) {
- RF_ERRORMSG1("RAIDFRAME: Error %d destroying mutex\n", rc1);
- }
+ rf_mutex_destroy(m);
}
return (rc);
}
@@ -197,21 +189,6 @@ _rf_init_threadgroup(g, file, line)
/*
* Kernel
*/
-int
-rf_mutex_init(m)
-decl_simple_lock_data(, *m)
-{
- simple_lock_init(m);
- return (0);
-}
-
-int
-rf_mutex_destroy(m)
-decl_simple_lock_data(, *m)
-{
- return (0);
-}
-
int
rf_lkmgr_mutex_init(m)
decl_lock_data(, *m)
diff --git a/sys/dev/raidframe/rf_threadstuff.h b/sys/dev/raidframe/rf_threadstuff.h
index 75b2bfe36b1..98ab1957dcc 100644
--- a/sys/dev/raidframe/rf_threadstuff.h
+++ b/sys/dev/raidframe/rf_threadstuff.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_threadstuff.h,v 1.13 2002/10/02 21:48:00 oster Exp $ */
+/* $NetBSD: rf_threadstuff.h,v 1.14 2003/12/29 04:56:26 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -181,8 +181,9 @@ struct RF_ThreadGroup_s {
}
#endif
-int rf_mutex_init(struct simplelock *);
-int rf_mutex_destroy(struct simplelock *);
+#define rf_mutex_init(m) simple_lock_init(m)
+#define rf_mutex_destroy(m)
+
int
_rf_create_managed_mutex(RF_ShutdownList_t **, struct simplelock *,
char *, int);