summaryrefslogtreecommitdiffstats
path: root/init/property_service.c
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2013-08-28 21:08:42 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-08-28 21:08:43 +0000
commitb35f68a6974589fc3c762d6d2c7bac363794e355 (patch)
tree324e83df16f8316521ea95b3c812066701fd37d2 /init/property_service.c
parenta7f6e015a5cf2ac85549fe676d6641caf6af1291 (diff)
parent3899f522f181b6c99ad37c09234bdaf7625f12fb (diff)
downloadsystem_core-b35f68a6974589fc3c762d6d2c7bac363794e355.zip
system_core-b35f68a6974589fc3c762d6d2c7bac363794e355.tar.gz
system_core-b35f68a6974589fc3c762d6d2c7bac363794e355.tar.bz2
Merge "init: load factory properties"
Diffstat (limited to 'init/property_service.c')
-rwxr-xr-xinit/property_service.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/init/property_service.c b/init/property_service.c
index 27fb284..d7c2c97 100755
--- a/init/property_service.c
+++ b/init/property_service.c
@@ -403,10 +403,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;
@@ -422,6 +425,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;
@@ -430,7 +436,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;
@@ -438,7 +444,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);
}
}
@@ -511,7 +517,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)
@@ -526,7 +532,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 */
}
@@ -548,8 +554,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();