summaryrefslogtreecommitdiffstats
path: root/init/builtins.c
diff options
context:
space:
mode:
Diffstat (limited to 'init/builtins.c')
-rw-r--r--init/builtins.c50
1 files changed, 21 insertions, 29 deletions
diff --git a/init/builtins.c b/init/builtins.c
index 44faf17..e0ccf9f 100644
--- a/init/builtins.c
+++ b/init/builtins.c
@@ -35,6 +35,9 @@
#include "keywords.h"
#include "property_service.h"
#include "devices.h"
+#include "init_parser.h"
+#include "util.h"
+#include "log.h"
#include <private/android_filesystem_config.h>
@@ -218,7 +221,7 @@ int do_insmod(int nargs, char **args)
int do_import(int nargs, char **args)
{
- return parse_config_file(args[1]);
+ return init_parse_config_file(args[1]);
}
int do_mkdir(int nargs, char **args)
@@ -275,6 +278,7 @@ int do_mount(int nargs, char **args)
char *options = NULL;
unsigned flags = 0;
int n, i;
+ int wait = 0;
for (n = 4; n < nargs; n++) {
for (i = 0; mount_flags[i].name; i++) {
@@ -284,9 +288,13 @@ int do_mount(int nargs, char **args)
}
}
- /* if our last argument isn't a flag, wolf it up as an option string */
- if (n + 1 == nargs && !mount_flags[i].name)
- options = args[n];
+ if (!mount_flags[i].name) {
+ if (!strcmp(args[n], "wait"))
+ wait = 1;
+ /* if our last argument isn't a flag, wolf it up as an option string */
+ else if (n + 1 == nargs)
+ options = args[n];
+ }
}
system = args[1];
@@ -301,6 +309,8 @@ int do_mount(int nargs, char **args)
sprintf(tmp, "/dev/block/mtdblock%d", n);
+ if (wait)
+ wait_for_file(tmp, COMMAND_RETRY_TIMEOUT);
if (mount(tmp, target, system, flags, options) < 0) {
return -1;
}
@@ -347,6 +357,8 @@ int do_mount(int nargs, char **args)
ERROR("out of loopback devices");
return -1;
} else {
+ if (wait)
+ wait_for_file(source, COMMAND_RETRY_TIMEOUT);
if (mount(source, target, system, flags, options) < 0) {
return -1;
}
@@ -414,7 +426,6 @@ int do_restart(int nargs, char **args)
int do_trigger(int nargs, char **args)
{
action_for_each_trigger(args[1], action_add_queue_tail);
- drain_action_queue();
return 0;
}
@@ -547,29 +558,10 @@ int do_loglevel(int nargs, char **args) {
return -1;
}
-int do_device(int nargs, char **args) {
- int len;
- char tmp[64];
- char *source = args[1];
- int prefix = 0;
-
- if (nargs != 5)
- return -1;
- /* Check for wildcard '*' at the end which indicates a prefix. */
- len = strlen(args[1]) - 1;
- if (args[1][len] == '*') {
- args[1][len] = '\0';
- prefix = 1;
- }
- /* If path starts with mtd@ lookup the mount number. */
- if (!strncmp(source, "mtd@", 4)) {
- int n = mtd_name_to_number(source + 4);
- if (n >= 0) {
- snprintf(tmp, sizeof(tmp), "/dev/mtd/mtd%d", n);
- source = tmp;
- }
+int do_wait(int nargs, char **args)
+{
+ if (nargs == 2) {
+ return wait_for_file(args[1], COMMAND_RETRY_TIMEOUT);
}
- add_devperms_partners(source, get_mode(args[2]), decode_uid(args[3]),
- decode_uid(args[4]), prefix);
- return 0;
+ return -1;
}