Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/raidframe Simplify defn's of rf_mutex_init() and rf_...
details: https://anonhg.NetBSD.org/src/rev/24fb3dfcdf2f
branches: trunk
changeset: 556860:24fb3dfcdf2f
user: oster <oster%NetBSD.org@localhost>
date: Mon Dec 29 04:56:26 2003 +0000
description:
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:
sys/dev/raidframe/rf_acctrace.c | 9 +++------
sys/dev/raidframe/rf_netbsdkintf.c | 9 +++------
sys/dev/raidframe/rf_psstatus.c | 23 +++++++----------------
sys/dev/raidframe/rf_reconmap.c | 13 +++----------
sys/dev/raidframe/rf_stripelocks.c | 13 ++++---------
sys/dev/raidframe/rf_threadstuff.c | 37 +++++++------------------------------
sys/dev/raidframe/rf_threadstuff.h | 7 ++++---
7 files changed, 31 insertions(+), 80 deletions(-)
diffs (286 lines):
diff -r 90050a22c354 -r 24fb3dfcdf2f sys/dev/raidframe/rf_acctrace.c
--- a/sys/dev/raidframe/rf_acctrace.c Mon Dec 29 04:46:18 2003 +0000
+++ b/sys/dev/raidframe/rf_acctrace.c Mon Dec 29 04:56:26 2003 +0000
@@ -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 @@
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 -r 90050a22c354 -r 24fb3dfcdf2f sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c Mon Dec 29 04:46:18 2003 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c Mon Dec 29 04:56:26 2003 +0000
@@ -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 @@
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 -r 90050a22c354 -r 24fb3dfcdf2f sys/dev/raidframe/rf_psstatus.c
--- a/sys/dev/raidframe/rf_psstatus.c Mon Dec 29 04:46:18 2003 +0000
+++ b/sys/dev/raidframe/rf_psstatus.c Mon Dec 29 04:56:26 2003 +0000
@@ -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_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 -r 90050a22c354 -r 24fb3dfcdf2f sys/dev/raidframe/rf_reconmap.c
--- a/sys/dev/raidframe/rf_reconmap.c Mon Dec 29 04:46:18 2003 +0000
+++ b/sys/dev/raidframe/rf_reconmap.c Mon Dec 29 04:56:26 2003 +0000
@@ -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_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 @@
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 -r 90050a22c354 -r 24fb3dfcdf2f sys/dev/raidframe/rf_stripelocks.c
--- a/sys/dev/raidframe/rf_stripelocks.c Mon Dec 29 04:46:18 2003 +0000
+++ b/sys/dev/raidframe/rf_stripelocks.c Mon Dec 29 04:56:26 2003 +0000
@@ -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 @@
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 @@
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 -r 90050a22c354 -r 24fb3dfcdf2f sys/dev/raidframe/rf_threadstuff.c
--- a/sys/dev/raidframe/rf_threadstuff.c Mon Dec 29 04:46:18 2003 +0000
+++ b/sys/dev/raidframe/rf_threadstuff.c Mon Dec 29 04:56:26 2003 +0000
@@ -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 @@
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 @@
char *file;
int line;
{
- int rc, rc1;
+ int rc;
- rc = rf_mutex_init(m);
- if (rc)
- return (rc);
+ rf_mutex_init(m);
+
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 @@
/*
* 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 -r 90050a22c354 -r 24fb3dfcdf2f sys/dev/raidframe/rf_threadstuff.h
--- a/sys/dev/raidframe/rf_threadstuff.h Mon Dec 29 04:46:18 2003 +0000
+++ b/sys/dev/raidframe/rf_threadstuff.h Mon Dec 29 04:56:26 2003 +0000
@@ -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 @@
}
#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);
Home |
Main Index |
Thread Index |
Old Index