diff options
| author | Tianjie Xu <xunchang@google.com> | 2019-06-25 13:59:39 -0700 |
|---|---|---|
| committer | Tianjie Xu <xunchang@google.com> | 2019-07-09 14:15:18 -0700 |
| commit | e5218615084c3bb4f12c91d0ebed823927f1bc68 (patch) | |
| tree | 780eb474a1efba66496c44047bbde193be381067 /install | |
| parent | e1701454b2f46503f5886e09d29645688bea27ca (diff) | |
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
Diffstat (limited to 'install')
| -rw-r--r-- | install/fuse_install.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/install/fuse_install.cpp b/install/fuse_install.cpp index ffde4a34..8a7a278e 100644 --- a/install/fuse_install.cpp +++ b/install/fuse_install.cpp @@ -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) { |
