Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Nov 2017 01:15:53 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r326305 - in stable/11: share/man/man9 sys/kern sys/sys
Message-ID:  <201711280115.vAS1Fr1e078101@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Nov 28 01:15:53 2017
New Revision: 326305
URL: https://svnweb.freebsd.org/changeset/base/326305

Log:
  MFC r326060:
  Clean up the SYSINIT_FLAGS definitions for rwlock(9) and rmlock(9).

Modified:
  stable/11/share/man/man9/Makefile
  stable/11/share/man/man9/rmlock.9
  stable/11/share/man/man9/rwlock.9
  stable/11/share/man/man9/sx.9
  stable/11/sys/kern/kern_rmlock.c
  stable/11/sys/kern/kern_rwlock.c
  stable/11/sys/sys/rmlock.h
  stable/11/sys/sys/rwlock.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man9/Makefile
==============================================================================
--- stable/11/share/man/man9/Makefile	Tue Nov 28 01:15:10 2017	(r326304)
+++ stable/11/share/man/man9/Makefile	Tue Nov 28 01:15:53 2017	(r326305)
@@ -1446,6 +1446,7 @@ MLINKS+=rmlock.9 rm_assert.9 \
 	rmlock.9 rm_runlock.9 \
 	rmlock.9 rm_sleep.9 \
 	rmlock.9 RM_SYSINIT.9 \
+	rmlock.9 RM_SYSINIT_FLAGS.9 \
 	rmlock.9 rm_try_rlock.9 \
 	rmlock.9 rm_wlock.9 \
 	rmlock.9 rm_wowned.9 \
@@ -1478,6 +1479,7 @@ MLINKS+=rwlock.9 rw_assert.9 \
 	rwlock.9 rw_unlock.9 \
 	rwlock.9 rw_sleep.9 \
 	rwlock.9 RW_SYSINIT.9 \
+	rwlock.9 RW_SYSINIT_FLAGS.9 \
 	rwlock.9 rw_try_rlock.9 \
 	rwlock.9 rw_try_upgrade.9 \
 	rwlock.9 rw_try_wlock.9 \
@@ -1685,6 +1687,7 @@ MLINKS+=sx.9 sx_assert.9 \
 	sx.9 sx_slock_sig.9 \
 	sx.9 sx_sunlock.9 \
 	sx.9 SX_SYSINIT.9 \
+	sx.9 SX_SYSINIT_FLAGS.9 \
 	sx.9 sx_try_slock.9 \
 	sx.9 sx_try_upgrade.9 \
 	sx.9 sx_try_xlock.9 \

Modified: stable/11/share/man/man9/rmlock.9
==============================================================================
--- stable/11/share/man/man9/rmlock.9	Tue Nov 28 01:15:10 2017	(r326304)
+++ stable/11/share/man/man9/rmlock.9	Tue Nov 28 01:15:53 2017	(r326305)
@@ -26,7 +26,7 @@
 .\" $FreeBSD$
 .\"
 .\" Based on rwlock.9 man page
-.Dd December 13, 2014
+.Dd November 11, 2017
 .Dt RMLOCK 9
 .Os
 .Sh NAME
@@ -42,7 +42,8 @@
 .Nm rm_wowned ,
 .Nm rm_sleep ,
 .Nm rm_assert ,
-.Nm RM_SYSINIT
+.Nm RM_SYSINIT ,
+.Nm RM_SYSINIT_FLAGS
 .Nd kernel reader/writer lock optimized for read-mostly access patterns
 .Sh SYNOPSIS
 .In sys/param.h
@@ -74,7 +75,8 @@
 .Ft void
 .Fn rm_assert "struct rmlock *rm" "int what"
 .In sys/kernel.h
-.Fn RM_SYSINIT "name" "struct rmlock *rm" "const char *desc" "int opts"
+.Fn RM_SYSINIT "name" "struct rmlock *rm" "const char *desc"
+.Fn RM_SYSINIT_FLAGS "name" "struct rmlock *rm" "const char *desc" "int flags"
 .Sh DESCRIPTION
 Read-mostly locks allow shared access to protected data by multiple threads,
 or exclusive access by a single thread.

Modified: stable/11/share/man/man9/rwlock.9
==============================================================================
--- stable/11/share/man/man9/rwlock.9	Tue Nov 28 01:15:10 2017	(r326304)
+++ stable/11/share/man/man9/rwlock.9	Tue Nov 28 01:15:53 2017	(r326305)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 28, 2016
+.Dd November 11, 2017
 .Dt RWLOCK 9
 .Os
 .Sh NAME
@@ -45,7 +45,8 @@
 .Nm rw_initialized ,
 .Nm rw_wowned ,
 .Nm rw_assert ,
-.Nm RW_SYSINIT
+.Nm RW_SYSINIT ,
+.Nm RW_SYSINIT_FLAGS
 .Nd kernel reader/writer lock
 .Sh SYNOPSIS
 .In sys/param.h
@@ -88,6 +89,7 @@
 .Fn rw_assert "const struct rwlock *rw" "int what"
 .In sys/kernel.h
 .Fn RW_SYSINIT "name" "struct rwlock *rw" "const char *desc"
+.Fn RW_SYSINIT_FLAGS "name" "struct rwlock *rw" "const char *desc" "int flags"
 .Sh DESCRIPTION
 Reader/writer locks allow shared access to protected data by multiple threads,
 or exclusive access by a single thread.

Modified: stable/11/share/man/man9/sx.9
==============================================================================
--- stable/11/share/man/man9/sx.9	Tue Nov 28 01:15:10 2017	(r326304)
+++ stable/11/share/man/man9/sx.9	Tue Nov 28 01:15:53 2017	(r326305)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 28, 2016
+.Dd November 11, 2017
 .Dt SX 9
 .Os
 .Sh NAME
@@ -49,7 +49,8 @@
 .Nm sx_xholder ,
 .Nm sx_xlocked ,
 .Nm sx_assert ,
-.Nm SX_SYSINIT
+.Nm SX_SYSINIT ,
+.Nm SX_SYSINIT_FLAGS
 .Nd kernel shared/exclusive lock
 .Sh SYNOPSIS
 .In sys/param.h
@@ -95,7 +96,8 @@
 .Ft void
 .Fn sx_assert "const struct sx *sx" "int what"
 .In sys/kernel.h
-.Fn SX_SYSINIT "name" "struct sx *sx" "const char *description"
+.Fn SX_SYSINIT "name" "struct sx *sx" "const char *desc"
+.Fn SX_SYSINIT_FLAGS "name" "struct sx *sx" "const char *desc" "int flags"
 .Sh DESCRIPTION
 Shared/exclusive locks are used to protect data that are read far more often
 than they are written.
@@ -295,6 +297,12 @@ but with an additional argument,
 .Fa name ,
 that is used in generating unique variable names for the related
 structures associated with the lock and the sysinit routine.
+The
+.Fn SX_SYSINIT_FLAGS
+macro can similarly be used to initialize a given
+.Fa sx
+lock using
+.Fn sx_init_flags .
 .Pp
 A thread may not hold both a shared lock and an exclusive lock on the same
 lock simultaneously;

Modified: stable/11/sys/kern/kern_rmlock.c
==============================================================================
--- stable/11/sys/kern/kern_rmlock.c	Tue Nov 28 01:15:10 2017	(r326304)
+++ stable/11/sys/kern/kern_rmlock.c	Tue Nov 28 01:15:53 2017	(r326305)
@@ -336,17 +336,10 @@ rm_wowned(const struct rmlock *rm)
 void
 rm_sysinit(void *arg)
 {
-	struct rm_args *args = arg;
+	struct rm_args *args;
 
-	rm_init(args->ra_rm, args->ra_desc);
-}
-
-void
-rm_sysinit_flags(void *arg)
-{
-	struct rm_args_flags *args = arg;
-
-	rm_init_flags(args->ra_rm, args->ra_desc, args->ra_opts);
+	args = arg;
+	rm_init_flags(args->ra_rm, args->ra_desc, args->ra_flags);
 }
 
 static int

Modified: stable/11/sys/kern/kern_rwlock.c
==============================================================================
--- stable/11/sys/kern/kern_rwlock.c	Tue Nov 28 01:15:10 2017	(r326304)
+++ stable/11/sys/kern/kern_rwlock.c	Tue Nov 28 01:15:53 2017	(r326305)
@@ -240,16 +240,9 @@ _rw_destroy(volatile uintptr_t *c)
 void
 rw_sysinit(void *arg)
 {
-	struct rw_args *args = arg;
+	struct rw_args *args;
 
-	rw_init((struct rwlock *)args->ra_rw, args->ra_desc);
-}
-
-void
-rw_sysinit_flags(void *arg)
-{
-	struct rw_args_flags *args = arg;
-
+	args = arg;
 	rw_init_flags((struct rwlock *)args->ra_rw, args->ra_desc,
 	    args->ra_flags);
 }

Modified: stable/11/sys/sys/rmlock.h
==============================================================================
--- stable/11/sys/sys/rmlock.h	Tue Nov 28 01:15:10 2017	(r326304)
+++ stable/11/sys/sys/rmlock.h	Tue Nov 28 01:15:53 2017	(r326305)
@@ -101,35 +101,21 @@ void	_rm_assert(const struct rmlock *rm, int what, con
 struct rm_args {
 	struct rmlock	*ra_rm;
 	const char 	*ra_desc;
+	int		ra_flags;
 };
 
-struct rm_args_flags {
-	struct rmlock	*ra_rm;
-	const char 	*ra_desc;
-	int		ra_opts;
-};
-
-#define	RM_SYSINIT(name, rm, desc)       				\
+#define	RM_SYSINIT_FLAGS(name, rm, desc, flags)				\
 	static struct rm_args name##_args = {				\
 		(rm),							\
 		(desc),							\
+		(flags),						\
 	};								\
 	SYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
 	    rm_sysinit, &name##_args);					\
 	SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
 	    rm_destroy, (rm))
 
-
-#define	RM_SYSINIT_FLAGS(name, rm, desc, opts)       			\
-	static struct rm_args name##_args = {				\
-		(rm),							\
-		(desc),							\
-                (opts),							\
-	};								\
-	SYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
-	    rm_sysinit_flags, &name##_args);				\
-	SYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
-	    rm_destroy, (rm))
+#define	RM_SYSINIT(name, rm, desc)	RM_SYSINIT_FLAGS(name, rm, desc, 0)
 
 #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
 #define	RA_LOCKED		LA_LOCKED

Modified: stable/11/sys/sys/rwlock.h
==============================================================================
--- stable/11/sys/sys/rwlock.h	Tue Nov 28 01:15:10 2017	(r326304)
+++ stable/11/sys/sys/rwlock.h	Tue Nov 28 01:15:53 2017	(r326305)
@@ -220,35 +220,21 @@ void	__rw_assert(const volatile uintptr_t *c, int what
 struct rw_args {
 	void		*ra_rw;
 	const char 	*ra_desc;
-};
-
-struct rw_args_flags {
-	void		*ra_rw;
-	const char 	*ra_desc;
 	int		ra_flags;
 };
 
-#define	RW_SYSINIT(name, rw, desc)					\
+#define	RW_SYSINIT_FLAGS(name, rw, desc, flags)				\
 	static struct rw_args name##_args = {				\
 		(rw),							\
 		(desc),							\
+		(flags),						\
 	};								\
 	SYSINIT(name##_rw_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
 	    rw_sysinit, &name##_args);					\
 	SYSUNINIT(name##_rw_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
 	    _rw_destroy, __DEVOLATILE(void *, &(rw)->rw_lock))
 
-
-#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, __DEVOLATILE(void *, &(rw)->rw_lock))
+#define	RW_SYSINIT(name, rw, desc)	RW_SYSINIT_FLAGS(name, rw, desc, 0)
 
 /*
  * Options passed to rw_init_flags().



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711280115.vAS1Fr1e078101>