summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2002-04-17 13:06:36 +0000
committermux <mux@FreeBSD.org>2002-04-17 13:06:36 +0000
commita207e41bef089b8849a230f44088a562d0b5d19f (patch)
treecb447f9f2a04a764ece9fcefc6fa6b52d19870b8 /sys/kern/vfs_mount.c
parentc79270302c4767b589a4fe70da3ba9866936358f (diff)
downloadFreeBSD-src-a207e41bef089b8849a230f44088a562d0b5d19f.zip
FreeBSD-src-a207e41bef089b8849a230f44088a562d0b5d19f.tar.gz
Rework the kernel environment subsystem. We now convert the static
environment needed at boot time to a dynamic subsystem when VM is up. The dynamic kernel environment is protected by an sx lock. This adds some new functions to manipulate the kernel environment : freeenv(), setenv(), unsetenv() and testenv(). freeenv() has to be called after every getenv() when you have finished using the string. testenv() only tests if an environment variable is present, and doesn't require a freeenv() call. setenv() and unsetenv() are self explanatory. The kenv(2) syscall exports these new functionalities to userland, mainly for kenv(1). Reviewed by: peter
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r--sys/kern/vfs_mount.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 2e5360a5..20d9b90 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -102,7 +102,8 @@ dev_t rootdev = NODEV;
void
vfs_mountroot(void *foo __unused)
{
- int i;
+ char *cp;
+ int i, error;
/*
* The root filesystem information is compiled in, and we are
@@ -139,8 +140,12 @@ vfs_mountroot(void *foo __unused)
* supplied via some other means. This is the preferred
* mechanism.
*/
- if (!vfs_mountroot_try(getenv("vfs.root.mountfrom")))
- return;
+ if ((cp = getenv("vfs.root.mountfrom")) != NULL) {
+ error = vfs_mountroot_try(cp);
+ freeenv(cp);
+ if (!error)
+ return;
+ }
/*
* Try values that may have been computed by the machine-dependant
OpenPOWER on IntegriCloud