diff options
| author | Ken Sumrall <ksumrall@android.com> | 2010-12-03 16:33:31 -0800 |
|---|---|---|
| committer | Ken Sumrall <ksumrall@android.com> | 2010-12-18 19:03:54 -0800 |
| commit | 752923c168009d03e9e00e590155fbd0a2880ccb (patch) | |
| tree | c35bf2554955ca2494be8bcc839d5f00a9b5553b /init/init.c | |
| parent | 36f93f01201bbff4a411c73adfbaf08bd93b1ad2 (diff) | |
| download | system_core-752923c168009d03e9e00e590155fbd0a2880ccb.tar.gz system_core-752923c168009d03e9e00e590155fbd0a2880ccb.tar.bz2 system_core-752923c168009d03e9e00e590155fbd0a2880ccb.zip | |
Changes to init to support encrypted filesystems.
These are the changes to init and init.rc necessary to
support booting with and encrypted /data filesystem.
A corresponding change to init.<device>.rc goes along
with this change.
Change-Id: I0c7e2cc39568358014a82e317735c0eae14dd683
Diffstat (limited to 'init/init.c')
| -rwxr-xr-x | init/init.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/init/init.c b/init/init.c index 7aef3872..e13d4b18 100755 --- a/init/init.c +++ b/init/init.c @@ -150,11 +150,11 @@ void service_start(struct service *svc, const char *dynamic_args) int needs_console; int n; - /* starting a service removes it from the disabled + /* starting a service removes it from the disabled or reset * state and immediately takes it out of the restarting * state if it was in there */ - svc->flags &= (~(SVC_DISABLED|SVC_RESTARTING)); + svc->flags &= (~(SVC_DISABLED|SVC_RESTARTING|SVC_RESET)); svc->time_started = 0; /* running processes require no additional work -- if @@ -300,27 +300,42 @@ void service_start(struct service *svc, const char *dynamic_args) notify_service_state(svc->name, "running"); } -void service_stop(struct service *svc) +/* The how field should be either SVC_DISABLED or SVC_RESET */ +static void service_stop_or_reset(struct service *svc, int how) { /* we are no longer running, nor should we * attempt to restart */ svc->flags &= (~(SVC_RUNNING|SVC_RESTARTING)); + if ((how != SVC_DISABLED) && (how != SVC_RESET)) { + /* Hrm, an illegal flag. Default to SVC_DISABLED */ + how = SVC_DISABLED; + } /* if the service has not yet started, prevent * it from auto-starting with its class */ - svc->flags |= SVC_DISABLED; + svc->flags |= how; if (svc->pid) { NOTICE("service '%s' is being killed\n", svc->name); - kill(-svc->pid, SIGTERM); + kill(-svc->pid, SIGKILL); notify_service_state(svc->name, "stopping"); } else { notify_service_state(svc->name, "stopped"); } } +void service_reset(struct service *svc) +{ + service_stop_or_reset(svc, SVC_RESET); +} + +void service_stop(struct service *svc) +{ + service_stop_or_reset(svc, SVC_DISABLED); +} + void property_changed(const char *name, const char *value) { if (property_triggers_enabled) @@ -725,6 +740,7 @@ int main(int argc, char **argv) action_for_each_trigger("early-fs", action_add_queue_tail); action_for_each_trigger("fs", action_add_queue_tail); action_for_each_trigger("post-fs", action_add_queue_tail); + action_for_each_trigger("post-fs-data", action_add_queue_tail); queue_builtin_action(property_service_init_action, "property_service_init"); queue_builtin_action(signal_init_action, "signal_init"); |
