Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Jul 2015 14:44:40 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285131 - head/sys/kern
Message-ID:  <201507041444.t64EiehM042721@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjg
Date: Sat Jul  4 14:44:39 2015
New Revision: 285131
URL: https://svnweb.freebsd.org/changeset/base/285131

Log:
  sysctl: get rid of sysctl_lock/unlock
  
  Inline their contents into the only consumer.

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==============================================================================
--- head/sys/kern/kern_sysctl.c	Sat Jul  4 10:33:33 2015	(r285130)
+++ head/sys/kern/kern_sysctl.c	Sat Jul  4 14:44:39 2015	(r285131)
@@ -113,26 +113,6 @@ static int	sysctl_remove_oid_locked(stru
 static int	sysctl_old_kernel(struct sysctl_req *, const void *, size_t);
 static int	sysctl_new_kernel(struct sysctl_req *, void *, size_t);
 
-static void
-sysctl_lock(struct rm_priotracker *tracker)
-{
-
-	if (tracker != NULL)
-		SYSCTL_RLOCK(tracker);
-	else
-		SYSCTL_WLOCK();
-}
-
-static void
-sysctl_unlock(struct rm_priotracker *tracker)
-{
-
-	if (tracker != NULL)
-		SYSCTL_RUNLOCK(tracker);
-	else
-		SYSCTL_WUNLOCK();
-}
-
 static struct sysctl_oid *
 sysctl_find_oidname(const char *name, struct sysctl_oid_list *list)
 {
@@ -174,7 +154,11 @@ sysctl_root_handler_locked(struct sysctl
 
 	if (oid->oid_kind & CTLFLAG_DYN)
 		atomic_add_int(&oid->oid_running, 1);
-	sysctl_unlock(tracker);
+
+	if (tracker != NULL)
+		SYSCTL_RUNLOCK(tracker);
+	else
+		SYSCTL_WUNLOCK();
 
 	if (!(oid->oid_kind & CTLFLAG_MPSAFE))
 		mtx_lock(&Giant);
@@ -182,7 +166,11 @@ sysctl_root_handler_locked(struct sysctl
 	if (!(oid->oid_kind & CTLFLAG_MPSAFE))
 		mtx_unlock(&Giant);
 
-	sysctl_lock(tracker);
+	if (tracker != NULL)
+		SYSCTL_RLOCK(tracker);
+	else
+		SYSCTL_WLOCK();
+
 	if (oid->oid_kind & CTLFLAG_DYN) {
 		if (atomic_fetchadd_int(&oid->oid_running, -1) == 1 &&
 		    (oid->oid_kind & CTLFLAG_DYING) != 0)



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