mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-14 12:40:16 +02:00
b4260e22f3
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33825 3c298f89-4303-0410-b956-a3cf2f4a3e73
34 lines
765 B
Diff
34 lines
765 B
Diff
--- a/arch/mips/bcm47xx/nvram.c
|
|
+++ b/arch/mips/bcm47xx/nvram.c
|
|
@@ -274,3 +274,30 @@ int nvram_getenv(char *name, char *val,
|
|
return NVRAM_ERR_ENVNOTFOUND;
|
|
}
|
|
EXPORT_SYMBOL(nvram_getenv);
|
|
+
|
|
+char *nvram_get(const char *name)
|
|
+{
|
|
+ char *var, *value, *end, *eq;
|
|
+
|
|
+ if (!name)
|
|
+ return NULL;
|
|
+
|
|
+ if (!nvram_buf[0])
|
|
+ early_nvram_init();
|
|
+
|
|
+ /* Look for name=value and return value */
|
|
+ var = &nvram_buf[sizeof(struct nvram_header)];
|
|
+ end = nvram_buf + sizeof(nvram_buf) - 2;
|
|
+ end[0] = end[1] = '\0';
|
|
+ for (; *var; var = value + strlen(value) + 1) {
|
|
+ eq = strchr(var, '=');
|
|
+ if (!eq)
|
|
+ break;
|
|
+ value = eq + 1;
|
|
+ if ((eq - var) == strlen(name) && strncmp(var, name, (eq - var)) == 0)
|
|
+ return value;
|
|
+ }
|
|
+
|
|
+ return NULL;
|
|
+}
|
|
+EXPORT_SYMBOL(nvram_get);
|