summaryrefslogtreecommitdiffstats
path: root/sys/dev/cfe
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2010-08-11 02:13:50 +0000
committerneel <neel@FreeBSD.org>2010-08-11 02:13:50 +0000
commitd7725ba6bbfc90b75ff4df6cce1ccfd3e3f391db (patch)
tree8278fbd2721b3fd61ccea3895438d473d59cd9bd /sys/dev/cfe
parentaa4e762c4a720fc3e1b4d3f08d09c5b65bb07735 (diff)
downloadFreeBSD-src-d7725ba6bbfc90b75ff4df6cce1ccfd3e3f391db.zip
FreeBSD-src-d7725ba6bbfc90b75ff4df6cce1ccfd3e3f391db.tar.gz
Start using the 'init_static_kenv()' API provided by r198561 to initialize
CFE environment variables.
Diffstat (limited to 'sys/dev/cfe')
-rw-r--r--sys/dev/cfe/cfe_env.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/sys/dev/cfe/cfe_env.c b/sys/dev/cfe/cfe_env.c
index a72e46e..c47086b 100644
--- a/sys/dev/cfe/cfe_env.c
+++ b/sys/dev/cfe/cfe_env.c
@@ -25,8 +25,7 @@
*/
#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/systm.h>
+#include <sys/kenv.h>
#include <dev/cfe/cfe_api.h>
@@ -43,32 +42,20 @@ static char cfe_env_buf[CFE_ENV_SIZE];
void
cfe_env_init(void)
{
- int idx, len;
- char name[64], val[128], *cp, *cplim;
+ int idx;
+ char name[KENV_MNAMELEN], val[KENV_MVALLEN];
- cp = cfe_env_buf;
- cplim = cp + CFE_ENV_SIZE;
+ init_static_kenv(cfe_env_buf, CFE_ENV_SIZE);
idx = 0;
while (1) {
if (cfe_enumenv(idx, name, sizeof(name), val, sizeof(val)) != 0)
break;
- if (bootverbose)
- printf("Importing CFE env: \"%s=%s\"\n", name, val);
-
- /*
- * name=val\0\0
- */
- len = strlen(name) + 1 + strlen(val) + 1 + 1;
- if (cplim - cp < len)
+ if (setenv(name, val) != 0) {
printf("No space to store CFE env: \"%s=%s\"\n",
name, val);
- else
- cp += sprintf(cp, "%s=%s", name, val) + 1;
+ }
++idx;
}
- *cp++ = '\0';
-
- kern_envp = cfe_env_buf;
}
OpenPOWER on IntegriCloud