Loading fsck_unshare_blocks.cpp +4 −9 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ static constexpr const char* SYSTEM_E2FSCK_BIN = "/system/bin/e2fsck_static"; static constexpr const char* TMP_E2FSCK_BIN = "/tmp/e2fsck.bin"; static constexpr const char* SYSTEM_ROOT = "/system"; static bool copy_file(const char* source, const char* dest) { android::base::unique_fd source_fd(open(source, O_RDONLY)); Loading Loading @@ -121,14 +120,10 @@ bool do_fsck_unshare_blocks() { std::vector<std::string> partitions = { "/odm", "/oem", "/product", "/vendor" }; // Temporarily mount system so we can copy e2fsck_static. bool mounted = false; if (volume_for_mount_point(SYSTEM_ROOT) == nullptr) { mounted = ensure_path_mounted_at("/", "/mnt/system") != -1; partitions.push_back("/"); } else { mounted = ensure_path_mounted_at(SYSTEM_ROOT, "/mnt/system") != -1; partitions.push_back(SYSTEM_ROOT); } std::string system_root = get_system_root(); bool mounted = ensure_path_mounted_at(system_root.c_str(), "/mnt/system"); partitions.push_back(system_root); if (!mounted) { LOG(ERROR) << "Failed to mount system image."; return false; Loading recovery.cpp +2 −9 Original line number Diff line number Diff line Loading @@ -78,7 +78,6 @@ static constexpr const char* CACHE_ROOT = "/cache"; static constexpr const char* DATA_ROOT = "/data"; static constexpr const char* METADATA_ROOT = "/metadata"; static constexpr const char* SDCARD_ROOT = "/sdcard"; static constexpr const char* SYSTEM_ROOT = "/system"; // We define RECOVERY_API_VERSION in Android.mk, which will be picked up by build system and packed // into target_files.zip. Assert the version defined in code and in Android.mk are consistent. Loading Loading @@ -837,15 +836,9 @@ static Device::BuiltinAction prompt_and_wait(Device* device, int status) { } case Device::MOUNT_SYSTEM: // the system partition is mounted at /mnt/system if (volume_for_mount_point(SYSTEM_ROOT) == nullptr) { if (ensure_path_mounted_at("/", "/mnt/system") != -1) { if (ensure_path_mounted_at(get_system_root().c_str(), "/mnt/system") != -1) { ui->Print("Mounted /system.\n"); } } else { if (ensure_path_mounted_at(SYSTEM_ROOT, "/mnt/system") != -1) { ui->Print("Mounted /system.\n"); } } break; case Device::KEY_INTERRUPTED: Loading roots.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ static struct fstab* fstab = nullptr; static bool did_map_logical_partitions = false; static constexpr const char* SYSTEM_ROOT = "/system"; extern struct selabel_handle* sehandle; Loading Loading @@ -408,3 +409,11 @@ int setup_install_mounts() { bool logical_partitions_mapped() { return did_map_logical_partitions; } std::string get_system_root() { if (volume_for_mount_point(SYSTEM_ROOT) == nullptr) { return "/"; } else { return SYSTEM_ROOT; } } roots.h +2 −0 Original line number Diff line number Diff line Loading @@ -55,4 +55,6 @@ int setup_install_mounts(); bool logical_partitions_mapped(); std::string get_system_root(); #endif // RECOVERY_ROOTS_H_ Loading
fsck_unshare_blocks.cpp +4 −9 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ static constexpr const char* SYSTEM_E2FSCK_BIN = "/system/bin/e2fsck_static"; static constexpr const char* TMP_E2FSCK_BIN = "/tmp/e2fsck.bin"; static constexpr const char* SYSTEM_ROOT = "/system"; static bool copy_file(const char* source, const char* dest) { android::base::unique_fd source_fd(open(source, O_RDONLY)); Loading Loading @@ -121,14 +120,10 @@ bool do_fsck_unshare_blocks() { std::vector<std::string> partitions = { "/odm", "/oem", "/product", "/vendor" }; // Temporarily mount system so we can copy e2fsck_static. bool mounted = false; if (volume_for_mount_point(SYSTEM_ROOT) == nullptr) { mounted = ensure_path_mounted_at("/", "/mnt/system") != -1; partitions.push_back("/"); } else { mounted = ensure_path_mounted_at(SYSTEM_ROOT, "/mnt/system") != -1; partitions.push_back(SYSTEM_ROOT); } std::string system_root = get_system_root(); bool mounted = ensure_path_mounted_at(system_root.c_str(), "/mnt/system"); partitions.push_back(system_root); if (!mounted) { LOG(ERROR) << "Failed to mount system image."; return false; Loading
recovery.cpp +2 −9 Original line number Diff line number Diff line Loading @@ -78,7 +78,6 @@ static constexpr const char* CACHE_ROOT = "/cache"; static constexpr const char* DATA_ROOT = "/data"; static constexpr const char* METADATA_ROOT = "/metadata"; static constexpr const char* SDCARD_ROOT = "/sdcard"; static constexpr const char* SYSTEM_ROOT = "/system"; // We define RECOVERY_API_VERSION in Android.mk, which will be picked up by build system and packed // into target_files.zip. Assert the version defined in code and in Android.mk are consistent. Loading Loading @@ -837,15 +836,9 @@ static Device::BuiltinAction prompt_and_wait(Device* device, int status) { } case Device::MOUNT_SYSTEM: // the system partition is mounted at /mnt/system if (volume_for_mount_point(SYSTEM_ROOT) == nullptr) { if (ensure_path_mounted_at("/", "/mnt/system") != -1) { if (ensure_path_mounted_at(get_system_root().c_str(), "/mnt/system") != -1) { ui->Print("Mounted /system.\n"); } } else { if (ensure_path_mounted_at(SYSTEM_ROOT, "/mnt/system") != -1) { ui->Print("Mounted /system.\n"); } } break; case Device::KEY_INTERRUPTED: Loading
roots.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ static struct fstab* fstab = nullptr; static bool did_map_logical_partitions = false; static constexpr const char* SYSTEM_ROOT = "/system"; extern struct selabel_handle* sehandle; Loading Loading @@ -408,3 +409,11 @@ int setup_install_mounts() { bool logical_partitions_mapped() { return did_map_logical_partitions; } std::string get_system_root() { if (volume_for_mount_point(SYSTEM_ROOT) == nullptr) { return "/"; } else { return SYSTEM_ROOT; } }
roots.h +2 −0 Original line number Diff line number Diff line Loading @@ -55,4 +55,6 @@ int setup_install_mounts(); bool logical_partitions_mapped(); std::string get_system_root(); #endif // RECOVERY_ROOTS_H_