Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jul 2018 02:43:23 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336157 - in head/sys: kern sys
Message-ID:  <201807100243.w6A2hN5M035290@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Tue Jul 10 02:43:22 2018
New Revision: 336157
URL: https://svnweb.freebsd.org/changeset/base/336157

Log:
  kern_environment: bool'itize dynamic_kenv; fix small style(9) nit

Modified:
  head/sys/kern/kern_environment.c
  head/sys/sys/systm.h

Modified: head/sys/kern/kern_environment.c
==============================================================================
--- head/sys/kern/kern_environment.c	Tue Jul 10 01:42:28 2018	(r336156)
+++ head/sys/kern/kern_environment.c	Tue Jul 10 02:43:22 2018	(r336157)
@@ -39,7 +39,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <sys/types.h>
 #include <sys/param.h>
 #include <sys/proc.h>
 #include <sys/queue.h>
@@ -81,7 +80,7 @@ struct mtx	kenv_lock;
 /*
  * No need to protect this with a mutex since SYSINITS are single threaded.
  */
-int	dynamic_kenv = 0;
+bool	dynamic_kenv;
 
 #define KENV_CHECK	if (!dynamic_kenv) \
 			    panic("%s: called before SI_SUB_KMEM", __func__)
@@ -100,7 +99,7 @@ sys_kenv(td, uap)
 	size_t len, done, needed, buflen;
 	int error, i;
 
-	KASSERT(dynamic_kenv, ("kenv: dynamic_kenv = 0"));
+	KASSERT(dynamic_kenv, ("kenv: dynamic_kenv = false"));
 
 	error = 0;
 	if (uap->what == KENV_DUMP) {
@@ -344,7 +343,7 @@ init_dynamic_kenv(void *data __unused)
 	kenvp[dynamic_envpos] = NULL;
 
 	mtx_init(&kenv_lock, "kernel environment", NULL, MTX_DEF);
-	dynamic_kenv = 1;
+	dynamic_kenv = true;
 }
 SYSINIT(kenv, SI_SUB_KMEM + 1, SI_ORDER_FIRST, init_dynamic_kenv, NULL);
 
@@ -498,7 +497,7 @@ kern_setenv(const char *name, const char *value)
 	char *buf, *cp, *oldenv;
 	int namelen, vallen, i;
 
-	if (dynamic_kenv == 0 && md_env_len > 0)
+	if (!dynamic_kenv && md_env_len > 0)
 		return (setenv_static(name, value));
 
 	KENV_CHECK;

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Tue Jul 10 01:42:28 2018	(r336156)
+++ head/sys/sys/systm.h	Tue Jul 10 02:43:22 2018	(r336157)
@@ -156,7 +156,7 @@ void	kassert_panic(const char *fmt, ...)  __printflike
  * XXX most of these variables should be const.
  */
 extern int osreldate;
-extern int dynamic_kenv;
+extern bool dynamic_kenv;
 extern struct mtx kenv_lock;
 extern char *kern_envp;
 extern char *md_envp;



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