diff options
author | Dima Zavin <dima@android.com> | 2013-08-28 14:14:59 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-08-28 14:14:59 -0700 |
commit | c3c03f12ad5397588af639178ad200b56787790a (patch) | |
tree | c0e7df8021750bef2507d3de9807bf9d4f7d1e54 | |
parent | f7f3955d4d7cf78914395ddb47400d1237bf4bc2 (diff) | |
parent | 28e52c816d06d78fa823be2d310d9f4c25012c8f (diff) | |
download | system_core-c3c03f12ad5397588af639178ad200b56787790a.zip system_core-c3c03f12ad5397588af639178ad200b56787790a.tar.gz system_core-c3c03f12ad5397588af639178ad200b56787790a.tar.bz2 |
am 28e52c81: am b35f68a6: Merge "init: load factory properties"
* commit '28e52c816d06d78fa823be2d310d9f4c25012c8f':
init: load factory properties
-rw-r--r-- | init/property_service.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/init/property_service.c b/init/property_service.c index a20f7ab..322c144 100644 --- a/init/property_service.c +++ b/init/property_service.c @@ -404,10 +404,13 @@ void get_property_workspace(int *fd, int *sz) *sz = pa_workspace.size; } -static void load_properties(char *data) +static void load_properties(char *data, char *prefix) { char *key, *value, *eol, *sol, *tmp; + size_t plen; + if (prefix) + plen = strlen(prefix); sol = data; while((eol = strchr(sol, '\n'))) { key = sol; @@ -423,6 +426,9 @@ static void load_properties(char *data) tmp = value - 2; while((tmp > key) && isspace(*tmp)) *tmp-- = 0; + if (prefix && strncmp(key, prefix, plen)) + continue; + while(isspace(*value)) value++; tmp = eol - 2; while((tmp > value) && isspace(*tmp)) *tmp-- = 0; @@ -431,7 +437,7 @@ static void load_properties(char *data) } } -static void load_properties_from_file(const char *fn) +static void load_properties_from_file(const char *fn, char *prefix) { char *data; unsigned sz; @@ -439,7 +445,7 @@ static void load_properties_from_file(const char *fn) data = read_file(fn, &sz); if(data != 0) { - load_properties(data); + load_properties(data, prefix); free(data); } } @@ -512,7 +518,7 @@ void property_init(void) void property_load_boot_defaults(void) { - load_properties_from_file(PROP_PATH_RAMDISK_DEFAULT); + load_properties_from_file(PROP_PATH_RAMDISK_DEFAULT, NULL); } int properties_inited(void) @@ -527,7 +533,7 @@ static void load_override_properties() { ret = property_get("ro.debuggable", debuggable); if (ret && (strcmp(debuggable, "1") == 0)) { - load_properties_from_file(PROP_PATH_LOCAL_OVERRIDE); + load_properties_from_file(PROP_PATH_LOCAL_OVERRIDE, NULL); } #endif /* ALLOW_LOCAL_PROP_OVERRIDE */ } @@ -549,8 +555,9 @@ void start_property_service(void) { int fd; - load_properties_from_file(PROP_PATH_SYSTEM_BUILD); - load_properties_from_file(PROP_PATH_SYSTEM_DEFAULT); + load_properties_from_file(PROP_PATH_SYSTEM_BUILD, NULL); + load_properties_from_file(PROP_PATH_SYSTEM_DEFAULT, NULL); + load_properties_from_file(PROP_PATH_FACTORY, "ro."); load_override_properties(); /* Read persistent properties after all default values have been loaded. */ load_persistent_properties(); |