diff options
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; |
