Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Oct 2020 06:16:38 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r366508 - in head/sys: dev/rt geom/eli kern sys
Message-ID:  <202010070616.0976Gclk028363@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Wed Oct  7 06:16:37 2020
New Revision: 366508
URL: https://svnweb.freebsd.org/changeset/base/366508

Log:
  Move kernel env global variables, etc to sys/kenv.h
  
  The kernel globals for kenv are confined to 2 files that need them and
  a few that likely shouldn't (but as written the code does). Move them
  from sys/systm.h to sys/kenv.h. This removed a XXX from systm.h and
  cleans it up a little bit...

Modified:
  head/sys/dev/rt/if_rt.c
  head/sys/geom/eli/g_eli.c
  head/sys/kern/kern_environment.c
  head/sys/kern/subr_hints.c
  head/sys/sys/kenv.h
  head/sys/sys/systm.h

Modified: head/sys/dev/rt/if_rt.c
==============================================================================
--- head/sys/dev/rt/if_rt.c	Wed Oct  7 05:44:35 2020	(r366507)
+++ head/sys/dev/rt/if_rt.c	Wed Oct  7 06:16:37 2020	(r366508)
@@ -38,6 +38,8 @@ __FBSDID("$FreeBSD$");
 #include "if_rtvar.h"
 #include "if_rtreg.h"
 
+#include <sys/kenv.h>
+
 #include <net/if.h>
 #include <net/if_var.h>
 #include <net/if_arp.h>

Modified: head/sys/geom/eli/g_eli.c
==============================================================================
--- head/sys/geom/eli/g_eli.c	Wed Oct  7 05:44:35 2020	(r366507)
+++ head/sys/geom/eli/g_eli.c	Wed Oct  7 06:16:37 2020	(r366508)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/cons.h>
+#include <sys/kenv.h>
 #include <sys/kernel.h>
 #include <sys/linker.h>
 #include <sys/module.h>

Modified: head/sys/kern/kern_environment.c
==============================================================================
--- head/sys/kern/kern_environment.c	Wed Oct  7 05:44:35 2020	(r366507)
+++ head/sys/kern/kern_environment.c	Wed Oct  7 06:16:37 2020	(r366508)
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/malloc.h>
 #include <sys/mutex.h>
 #include <sys/priv.h>
+#include <sys/kenv.h>
 #include <sys/kernel.h>
 #include <sys/systm.h>
 #include <sys/sysent.h>

Modified: head/sys/kern/subr_hints.c
==============================================================================
--- head/sys/kern/subr_hints.c	Wed Oct  7 05:44:35 2020	(r366507)
+++ head/sys/kern/subr_hints.c	Wed Oct  7 06:16:37 2020	(r366508)
@@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/lock.h>
+#include <sys/kenv.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
 #include <sys/mutex.h>

Modified: head/sys/sys/kenv.h
==============================================================================
--- head/sys/sys/kenv.h	Wed Oct  7 05:44:35 2020	(r366507)
+++ head/sys/sys/kenv.h	Wed Oct  7 06:16:37 2020	(r366508)
@@ -42,4 +42,18 @@
 #define KENV_MNAMELEN	128	/* Maximum name length (for the syscall) */
 #define KENV_MVALLEN	128	/* Maximum value length (for the syscall) */
 
+#ifdef _KERNEL
+/*
+ * Most of these variables should be const.
+ */
+extern bool dynamic_kenv;
+extern struct mtx kenv_lock;
+extern char *kern_envp;
+extern char *md_envp;
+extern char static_env[];
+extern char static_hints[];	/* by config for now */
+
+extern char **kenvp;
+#endif /* _KERNEL */
+
 #endif /* !_SYS_KENV_H_ */

Modified: head/sys/sys/systm.h
==============================================================================
--- head/sys/sys/systm.h	Wed Oct  7 05:44:35 2020	(r366507)
+++ head/sys/sys/systm.h	Wed Oct  7 06:16:37 2020	(r366508)
@@ -204,21 +204,7 @@ void	kassert_panic(const char *fmt, ...)  __printflike
 })
 #define	SCHEDULER_STOPPED() SCHEDULER_STOPPED_TD(curthread)
 
-/*
- * XXX the hints declarations are even more misplaced than most declarations
- * in this file, since they are needed in one file (per arch) and only used
- * in two files.
- * XXX most of these variables should be const.
- */
 extern int osreldate;
-extern bool dynamic_kenv;
-extern struct mtx kenv_lock;
-extern char *kern_envp;
-extern char *md_envp;
-extern char static_env[];
-extern char static_hints[];	/* by config for now */
-
-extern char **kenvp;
 
 extern const void *zero_region;	/* address space maps to a zeroed page	*/
 



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