From f6158eb918fb86f94e418244a9351379ad568563 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Tue, 11 Jun 2019 16:09:07 -0700 Subject: Support starting fuse from a block map Factor out a new function from ApplyFromSdcard that installs a package from a local path. Inside this function, we start the fuse and choose the type of data provider depending on the path string. And similar to the existing logic, we treat the package as a block map if the path starts with a '@'. This is part of the effort to install larger than 2GiB packages on ILP32 devices. Bug: 127071893 Test: Build a 32 bit sailfish and create a 3GiB OTA package. Sideload the package, uncrypt and install the package from sdcard. Change-Id: I328ea34fa530731acbce7554bfc3059313ad6ece --- fuse_sideload/fuse_provider.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'fuse_sideload/fuse_provider.cpp') diff --git a/fuse_sideload/fuse_provider.cpp b/fuse_sideload/fuse_provider.cpp index 5ee6e247f..8fa1b5c2e 100644 --- a/fuse_sideload/fuse_provider.cpp +++ b/fuse_sideload/fuse_provider.cpp @@ -49,6 +49,11 @@ FuseFileDataProvider::FuseFileDataProvider(const std::string& path, uint32_t blo fuse_block_size_ = block_size; } +std::unique_ptr FuseFileDataProvider::CreateFromFile(const std::string& path, + uint32_t block_size) { + return std::make_unique(path, block_size); +} + bool FuseFileDataProvider::ReadBlockAlignedData(uint8_t* buffer, uint32_t fetch_size, uint32_t start_block) const { uint64_t offset = static_cast(start_block) * fuse_block_size_; @@ -127,7 +132,7 @@ bool FuseBlockDataProvider::ReadBlockAlignedData(uint8_t* buffer, uint32_t fetch return true; } -std::unique_ptr FuseBlockDataProvider::CreateFromBlockMap( +std::unique_ptr FuseBlockDataProvider::CreateFromBlockMap( const std::string& block_map_path, uint32_t fuse_block_size) { auto block_map = BlockMapData::ParseBlockMapFile(block_map_path); if (!block_map) { -- cgit v1.2.3