diff options
author | Tao Bao <tbao@google.com> | 2015-03-31 19:25:21 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-03-31 19:25:21 +0200 |
commit | 9295980ac1554ff7c30531298aadec0750b027e0 (patch) | |
tree | 2dfb0dec13b9285f209d32e7f6d7a1436743c0cc /roots.cpp | |
parent | Merge "Add support to enter sideload mode directly" (diff) | |
parent | Revert "Erase PST partition if its marked to be erased." (diff) | |
download | android_bootable_recovery-9295980ac1554ff7c30531298aadec0750b027e0.tar android_bootable_recovery-9295980ac1554ff7c30531298aadec0750b027e0.tar.gz android_bootable_recovery-9295980ac1554ff7c30531298aadec0750b027e0.tar.bz2 android_bootable_recovery-9295980ac1554ff7c30531298aadec0750b027e0.tar.lz android_bootable_recovery-9295980ac1554ff7c30531298aadec0750b027e0.tar.xz android_bootable_recovery-9295980ac1554ff7c30531298aadec0750b027e0.tar.zst android_bootable_recovery-9295980ac1554ff7c30531298aadec0750b027e0.zip |
Diffstat (limited to 'roots.cpp')
-rw-r--r-- | roots.cpp | 37 |
1 files changed, 0 insertions, 37 deletions
@@ -39,8 +39,6 @@ static struct fstab *fstab = NULL; extern struct selabel_handle *sehandle; -static const char* PERSISTENT_PATH = "/persistent"; - void load_volume_table() { int i; @@ -266,41 +264,6 @@ int format_volume(const char* volume) { return -1; } -int erase_persistent_partition() { - Volume *v = volume_for_path(PERSISTENT_PATH); - if (v == NULL) { - // most devices won't have /persistent, so this is not an error. - return 0; - } - - int fd = open(v->blk_device, O_RDWR); - uint64_t size = get_file_size(fd); - if (size == 0) { - LOGE("failed to stat size of /persistent\n"); - close(fd); - return -1; - } - - char oem_unlock_enabled; - lseek(fd, size - 1, SEEK_SET); - read(fd, &oem_unlock_enabled, 1); - - if (oem_unlock_enabled) { - if (wipe_block_device(fd, size)) { - LOGE("error wiping /persistent: %s\n", strerror(errno)); - close(fd); - return -1; - } - - lseek(fd, size - 1, SEEK_SET); - write(fd, &oem_unlock_enabled, 1); - } - - close(fd); - - return (int) oem_unlock_enabled; -} - int setup_install_mounts() { if (fstab == NULL) { LOGE("can't set up install mounts: no fstab loaded\n"); |