From c7a82b9c6c7e8450883ad1e5f663dd1ff58515ac Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Tue, 10 Jul 2018 02:43:22 +0000 Subject: kern_environment: bool'itize dynamic_kenv; fix small style(9) nit --- sys/kern/kern_environment.c | 9 ++++----- sys/sys/systm.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_environment.c b/sys/kern/kern_environment.c index d5f0873fa40e..dbac88315b32 100644 --- a/sys/kern/kern_environment.c +++ b/sys/kern/kern_environment.c @@ -39,7 +39,6 @@ #include __FBSDID("$FreeBSD$"); -#include #include #include #include @@ -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; diff --git a/sys/sys/systm.h b/sys/sys/systm.h index eba8c9a048d7..bb13c1b2047b 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -156,7 +156,7 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2); * 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; -- cgit v1.2.3