Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/raidframe Initial kick at some functions to provide ...
details: https://anonhg.NetBSD.org/src/rev/e7e98b270edc
branches: trunk
changeset: 535008:e7e98b270edc
user: oster <oster%NetBSD.org@localhost>
date: Thu Aug 08 02:54:29 2002 +0000
description:
Initial kick at some functions to provide lockmgr lock support
instead of only simplelock support.
diffstat:
sys/dev/raidframe/rf_threadstuff.c | 44 ++++++++++++++++++++++++++++++++++++-
sys/dev/raidframe/rf_threadstuff.h | 24 +++++++++++++++++++-
2 files changed, 64 insertions(+), 4 deletions(-)
diffs (129 lines):
diff -r 79b10d3ff563 -r e7e98b270edc sys/dev/raidframe/rf_threadstuff.c
--- a/sys/dev/raidframe/rf_threadstuff.c Thu Aug 08 02:53:01 2002 +0000
+++ b/sys/dev/raidframe/rf_threadstuff.c Thu Aug 08 02:54:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_threadstuff.c,v 1.7 2001/11/13 07:11:17 lukem Exp $ */
+/* $NetBSD: rf_threadstuff.c,v 1.8 2002/08/08 02:54:29 oster Exp $ */
/*
* rf_threadstuff.c
*/
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_threadstuff.c,v 1.7 2001/11/13 07:11:17 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_threadstuff.c,v 1.8 2002/08/08 02:54:29 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -92,6 +92,30 @@
return (rc);
}
+
+int
+_rf_create_managed_lkmgr_mutex(listp, m, file, line)
+ RF_ShutdownList_t **listp;
+RF_DECLARE_LKMGR_MUTEX(*m)
+ char *file;
+ int line;
+{
+ int rc, rc1;
+
+ rc = rf_lkmgr_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_lkmgr_mutex_destroy(m);
+ if (rc1) {
+ RF_ERRORMSG1("RAIDFRAME: Error %d destroying mutex\n", rc1);
+ }
+ }
+ return (rc);
+}
+
int
_rf_create_managed_cond(listp, c, file, line)
RF_ShutdownList_t **listp;
@@ -188,6 +212,22 @@
return (0);
}
+int
+rf_lkmgr_mutex_init(m)
+decl_lock_data(, *m)
+{
+ lockinit(m,PRIBIO,"RAIDframe lock",0,0);
+ return(0);
+}
+
+int
+rf_lkmgr_mutex_destroy(m)
+decl_lock_data(, *m)
+{
+ return(0);
+}
+
+
int
rf_cond_init(c)
RF_DECLARE_COND(*c)
diff -r 79b10d3ff563 -r e7e98b270edc sys/dev/raidframe/rf_threadstuff.h
--- a/sys/dev/raidframe/rf_threadstuff.h Thu Aug 08 02:53:01 2002 +0000
+++ b/sys/dev/raidframe/rf_threadstuff.h Thu Aug 08 02:54:29 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_threadstuff.h,v 1.11 2001/10/04 15:58:56 oster Exp $ */
+/* $NetBSD: rf_threadstuff.h,v 1.12 2002/08/08 02:54:30 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -64,6 +64,7 @@
RF_ThreadGroup_t * g, char *file, int line);
#include <sys/lock.h>
+
#define decl_simple_lock_data(a,b) a struct simplelock b;
#define simple_lock_addr(a) ((struct simplelock *)&(a))
@@ -81,6 +82,18 @@
#define RF_LOCK_MUTEX(_m_) simple_lock(&(_m_))
#define RF_UNLOCK_MUTEX(_m_) simple_unlock(&(_m_))
+
+/* non-spinlock */
+#define decl_lock_data(a,b) a struct lock b;
+
+#define RF_DECLARE_LKMGR_MUTEX(_m_) decl_lock_data(,(_m_))
+#define RF_DECLARE_LKMGR_STATIC_MUTEX(_m_) decl_lock_data(static,(_m_))
+#define RF_DECLARE_LKMGR_EXTERN_MUTEX(_m_) decl_lock_data(extern,(_m_))
+
+#define RF_LOCK_LKMGR_MUTEX(_m_) lockmgr(&(_m_),LK_EXCLUSIVE,NULL)
+#define RF_UNLOCK_LKMGR_MUTEX(_m_) lockmgr(&(_m_),LK_RELEASE,NULL)
+
+
/*
* In NetBSD, kernel threads are simply processes which share several
* substructures and never run in userspace.
@@ -164,12 +177,19 @@
}
#endif
-
int rf_mutex_init(struct simplelock *);
int rf_mutex_destroy(struct simplelock *);
int
_rf_create_managed_mutex(RF_ShutdownList_t **, struct simplelock *,
char *, int);
+
+int rf_lkmgr_mutex_init(struct lock *);
+int rf_lkmgr_mutex_destroy(struct lock *);
+int
+_rf_create_managed_lkmgr_mutex(RF_ShutdownList_t **, struct lock *,
+ char *, int);
+
+
int
_rf_create_managed_cond(RF_ShutdownList_t ** listp, int *,
char *file, int line);
Home |
Main Index |
Thread Index |
Old Index