summaryrefslogtreecommitdiffstats
path: root/init/parser.h
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2011-12-20 12:53:48 -0800
committerDima Zavin <dima@android.com>2012-01-05 15:02:00 -0800
commit304f12270dc0be564eb1b64624770aa72f25e59e (patch)
tree544822e73f6d663759d4dff14b3c2c49d9e44f61 /init/parser.h
parent8886112d87bcc501e89e4763656a3ebfeb58edf2 (diff)
downloadsystem_core-304f12270dc0be564eb1b64624770aa72f25e59e.zip
system_core-304f12270dc0be564eb1b64624770aa72f25e59e.tar.gz
system_core-304f12270dc0be564eb1b64624770aa72f25e59e.tar.bz2
init: delay importing files until after parsing the current file
If we process the import directive inline, then the ordering of the commands for the "on xxx" sections would be a little unexpected. The init.rc files do not really have an implied order as to which section appears and gets processed first. The init code itself provides that ordering explicitly. For the user, the expectation is that if both the current file and the imported file define a section (e.g. "on init"), then the commands in the current file will be executed first, and then the ones from the imported file(s). The current implementation did not do that. It processed the import directive inline, and thus the imported (i.e. dependent) files would appear first in the command lists for the sections. This created unintended side effects and the solution would have been to try and put the import lines somewhere in the middle of the init file. This would be difficult to notice and hard to extract the dependencies. To solve this, we add the imports to a list for each file being parsed and process the list after finishing parsing the file. This provides predictable order for imports and provides a logical flow from the user perspective: the currently parsed file gets to run its commands before the files being imported. Change-Id: I06dc35ff286314060e16b18923683cd2787269de Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'init/parser.h')
-rw-r--r--init/parser.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/init/parser.h b/init/parser.h
index be93758..0a5802a 100644
--- a/init/parser.h
+++ b/init/parser.h
@@ -30,6 +30,7 @@ struct parse_state
void *context;
void (*parse_line)(struct parse_state *state, int nargs, char **args);
const char *filename;
+ void *priv;
};
int lookup_keyword(const char *s);