am 2f9e1db3: am b5d6ad81: Merge "Stop calling fsck on shutdown by default"

* commit '2f9e1db37416cdb580d870218b5fbfbed47a3758':
  Stop calling fsck on shutdown by default
This commit is contained in:
Yusuke Sato 2015-07-31 23:30:07 +00:00 committed by Android Git Automerger
commit 23ec3e468b

View file

@ -609,14 +609,13 @@ int do_powerctl(int nargs, char **args)
{ {
const char* command = args[1]; const char* command = args[1];
int len = 0; int len = 0;
int cmd = 0; unsigned int cmd = 0;
const char *reboot_target; const char *reboot_target = "";
void (*callback_on_ro_remount)(const struct mntent*) = NULL; void (*callback_on_ro_remount)(const struct mntent*) = NULL;
if (strncmp(command, "shutdown", 8) == 0) { if (strncmp(command, "shutdown", 8) == 0) {
cmd = ANDROID_RB_POWEROFF; cmd = ANDROID_RB_POWEROFF;
len = 8; len = 8;
callback_on_ro_remount = unmount_and_fsck;
} else if (strncmp(command, "reboot", 6) == 0) { } else if (strncmp(command, "reboot", 6) == 0) {
cmd = ANDROID_RB_RESTART2; cmd = ANDROID_RB_RESTART2;
len = 6; len = 6;
@ -626,10 +625,15 @@ int do_powerctl(int nargs, char **args)
} }
if (command[len] == ',') { if (command[len] == ',') {
reboot_target = &command[len + 1]; if (cmd == ANDROID_RB_POWEROFF &&
} else if (command[len] == '\0') { !strcmp(&command[len + 1], "userrequested")) {
reboot_target = ""; // The shutdown reason is PowerManager.SHUTDOWN_USER_REQUESTED.
} else { // Run fsck once the file system is remounted in read-only mode.
callback_on_ro_remount = unmount_and_fsck;
} else if (cmd == ANDROID_RB_RESTART2) {
reboot_target = &command[len + 1];
}
} else if (command[len] != '\0') {
ERROR("powerctl: unrecognized reboot target '%s'\n", &command[len]); ERROR("powerctl: unrecognized reboot target '%s'\n", &command[len]);
return -EINVAL; return -EINVAL;
} }