Create a fallback to install from fuse if mmap fails
We may fail to memory map the package on 32 bit builds for packages with 2GiB+ size. This cl tries to install the package with fuse when memory map fails in such cases. Bug: 127071893 Test: build 32 bit version sailfish, push package and block.map, reboot into recovery with the corresponding update_package argument. Change-Id: I5dae4f3e27ccaf8d64ff3657d36f0e75db2330b0
This commit is contained in:
@@ -128,11 +128,12 @@ static bool StartInstallPackageFuse(std::string_view path) {
|
||||
|
||||
constexpr auto FUSE_BLOCK_SIZE = 65536;
|
||||
bool is_block_map = android::base::ConsumePrefix(&path, "@");
|
||||
auto file_data_reader =
|
||||
auto fuse_data_provider =
|
||||
is_block_map ? FuseBlockDataProvider::CreateFromBlockMap(std::string(path), FUSE_BLOCK_SIZE)
|
||||
: FuseFileDataProvider::CreateFromFile(std::string(path), FUSE_BLOCK_SIZE);
|
||||
|
||||
if (!file_data_reader->Valid()) {
|
||||
if (!fuse_data_provider || !fuse_data_provider->Valid()) {
|
||||
LOG(ERROR) << "Failed to create fuse data provider.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -142,7 +143,7 @@ static bool StartInstallPackageFuse(std::string_view path) {
|
||||
umount2(SDCARD_ROOT, MNT_DETACH);
|
||||
}
|
||||
|
||||
return run_fuse_sideload(std::move(file_data_reader)) == 0;
|
||||
return run_fuse_sideload(std::move(fuse_data_provider)) == 0;
|
||||
}
|
||||
|
||||
InstallResult InstallWithFuseFromPath(std::string_view path, RecoveryUI* ui) {
|
||||
|
||||
Reference in New Issue
Block a user