diff options
| author | Ken Sumrall <ksumrall@android.com> | 2011-03-10 19:29:39 -0800 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2011-03-10 19:29:39 -0800 |
| commit | bb889dde13c7d47b69a52159604cf5b2763ce2d2 (patch) | |
| tree | c2b6cd4edc2260921c752c6230603b286befc7fb /toolbox | |
| parent | dfa9f55700789100c1f8ee2230c33a8ba9768fd7 (diff) | |
| parent | 276df0936dbf438b32ab099b04f69f01d7f1eed7 (diff) | |
| download | system_core-bb889dde13c7d47b69a52159604cf5b2763ce2d2.tar.gz system_core-bb889dde13c7d47b69a52159604cf5b2763ce2d2.tar.bz2 system_core-bb889dde13c7d47b69a52159604cf5b2763ce2d2.zip | |
am 276df093: am 70987108: Merge "Try to unmount writable filesystems when rebooting" into honeycomb-mr1
* commit '276df0936dbf438b32ab099b04f69f01d7f1eed7':
Try to unmount writable filesystems when rebooting
Diffstat (limited to 'toolbox')
| -rw-r--r-- | toolbox/reboot.c | 14 | ||||
| -rw-r--r-- | toolbox/wipe.c | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/toolbox/reboot.c b/toolbox/reboot.c index aebe1850..f8546de2 100644 --- a/toolbox/reboot.c +++ b/toolbox/reboot.c @@ -1,7 +1,7 @@ #include <errno.h> #include <stdio.h> #include <stdlib.h> -#include <sys/reboot.h> +#include <cutils/android_reboot.h> #include <unistd.h> int reboot_main(int argc, char *argv[]) @@ -9,6 +9,7 @@ int reboot_main(int argc, char *argv[]) int ret; int nosync = 0; int poweroff = 0; + int flags = 0; opterr = 0; do { @@ -38,15 +39,16 @@ int reboot_main(int argc, char *argv[]) exit(EXIT_FAILURE); } - if(!nosync) - sync(); + if(nosync) + /* also set NO_REMOUNT_RO as remount ro includes an implicit sync */ + flags = ANDROID_RB_FLAG_NO_SYNC | ANDROID_RB_FLAG_NO_REMOUNT_RO; if(poweroff) - ret = __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_POWER_OFF, NULL); + ret = android_reboot(ANDROID_RB_POWEROFF, flags, 0); else if(argc > optind) - ret = __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, argv[optind]); + ret = android_reboot(ANDROID_RB_RESTART2, flags, argv[optind]); else - ret = reboot(RB_AUTOBOOT); + ret = android_reboot(ANDROID_RB_RESTART, flags, 0); if(ret < 0) { perror("reboot"); exit(EXIT_FAILURE); diff --git a/toolbox/wipe.c b/toolbox/wipe.c index 7e263fd4..650a0d66 100644 --- a/toolbox/wipe.c +++ b/toolbox/wipe.c @@ -5,7 +5,7 @@ #include <string.h> #include <errno.h> #include <sys/types.h> -#include <sys/reboot.h> +#include <cutils/android_reboot.h> #include <sys/stat.h> #ifndef PATH_MAX @@ -63,7 +63,7 @@ int wipe_main (int argc, char *argv[]) wipe ("/system"); wipe ("/data"); fprintf(stdout, "Device nuked! Rebooting...\n"); - ret = reboot(RB_AUTOBOOT); + ret = android_reboot(ANDROID_RB_RESTART, 0, 0); if (ret < 0) { fprintf(stderr, "Reboot failed, %s\n", strerror(errno)); return 1; |
