From 5e6832a24d39f15261be0cad19708274db57a126 Mon Sep 17 00:00:00 2001 From: xunchang Date: Fri, 15 Mar 2019 16:04:32 -0700 Subject: Remove the provider_vtab It's no longer needed with the newly added FuseDataProvider class. Also cleans up the parameters for run_fuse_sideload. Bug: 127071893 Test: unit tests pass, run a sideload Change-Id: I1ccd6798d187cfc6ac9f559ffb3f3edf08dad55c --- fuse_sdcard_install.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'fuse_sdcard_install.cpp') diff --git a/fuse_sdcard_install.cpp b/fuse_sdcard_install.cpp index 79ef16bbc..2feb4d242 100644 --- a/fuse_sdcard_install.cpp +++ b/fuse_sdcard_install.cpp @@ -20,26 +20,21 @@ #include #include +#include #include "fuse_provider.h" #include "fuse_sideload.h" bool start_sdcard_fuse(const char* path) { - FuseFileDataProvider file_data_reader(path, 65536); + auto file_data_reader = std::make_unique(path, 65536); - if (!file_data_reader) { + if (!file_data_reader->Valid()) { return false; } - provider_vtab vtab; - vtab.read_block = std::bind(&FuseFileDataProvider::ReadBlockAlignedData, &file_data_reader, - std::placeholders::_2, std::placeholders::_3, std::placeholders::_1); - vtab.close = [&file_data_reader]() { file_data_reader.Close(); }; - // The installation process expects to find the sdcard unmounted. Unmount it with MNT_DETACH so // that our open file continues to work but new references see it as unmounted. umount2("/sdcard", MNT_DETACH); - return run_fuse_sideload(vtab, file_data_reader.file_size(), - file_data_reader.fuse_block_size()) == 0; + return run_fuse_sideload(std::move(file_data_reader)) == 0; } -- cgit v1.2.3