svn commit: r185778 - in head/sys: kern sys

Kip Macy kmacy at FreeBSD.org
Mon Dec 8 13:46:56 PST 2008


Author: kmacy
Date: Mon Dec  8 21:46:55 2008
New Revision: 185778
URL: http://svn.freebsd.org/changeset/base/185778

Log:
  add RW_SYSINIT_FLAGS macro and rw_sysinit_flags initialization function

Modified:
  head/sys/kern/kern_rwlock.c
  head/sys/sys/rwlock.h

Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c	Mon Dec  8 21:04:24 2008	(r185777)
+++ head/sys/kern/kern_rwlock.c	Mon Dec  8 21:46:55 2008	(r185778)
@@ -191,6 +191,14 @@ rw_sysinit(void *arg)
 	rw_init(args->ra_rw, args->ra_desc);
 }
 
+void
+rw_sysinit_flags(void *arg)
+{
+	struct rw_args_flags *args = arg;
+
+	rw_init_flags(args->ra_rw, args->ra_desc, args->ra_flags);
+}
+
 int
 rw_wowned(struct rwlock *rw)
 {

Modified: head/sys/sys/rwlock.h
==============================================================================
--- head/sys/sys/rwlock.h	Mon Dec  8 21:04:24 2008	(r185777)
+++ head/sys/sys/rwlock.h	Mon Dec  8 21:46:55 2008	(r185778)
@@ -132,6 +132,7 @@
 void	rw_init_flags(struct rwlock *rw, const char *name, int opts);
 void	rw_destroy(struct rwlock *rw);
 void	rw_sysinit(void *arg);
+void	rw_sysinit_flags(void *arg);
 int	rw_wowned(struct rwlock *rw);
 void	_rw_wlock(struct rwlock *rw, const char *file, int line);
 int	_rw_try_wlock(struct rwlock *rw, const char *file, int line);
@@ -187,6 +188,12 @@ struct rw_args {
 	const char 	*ra_desc;
 };
 
+struct rw_args_flags {
+	struct rwlock	*ra_rw;
+	const char 	*ra_desc;
+	int		ra_flags;
+};
+
 #define	RW_SYSINIT(name, rw, desc)					\
 	static struct rw_args name##_args = {				\
 		(rw),							\
@@ -197,6 +204,18 @@ struct rw_args {
 	SYSUNINIT(name##_rw_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
 	    rw_destroy, (rw))
 
+
+#define	RW_SYSINIT_FLAGS(name, rw, desc, flags)				\
+	static struct rw_args_flags name##_args = {			\
+		(rw),							\
+		(desc),							\
+		(flags),						\
+	};								\
+	SYSINIT(name##_rw_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
+	    rw_sysinit_flags, &name##_args);				\
+	SYSUNINIT(name##_rw_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
+	    rw_destroy, (rw))
+
 /*
  * Options passed to rw_init_flags().
  */


More information about the svn-src-all mailing list