diff options
author | Tianjie Xu <xunchang@google.com> | 2019-03-20 19:05:51 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-03-20 19:05:51 +0100 |
commit | b3025d752dcd170870e9fbded797f791f7b80b9c (patch) | |
tree | 9f5ad0d458a7ae8cb128e0c48caf1def481105dd /minadbd | |
parent | Merge "Create a FuseDataProvider base class" am: eeea86f5fd (diff) | |
parent | Merge "Remove the provider_vtab" (diff) | |
download | android_bootable_recovery-b3025d752dcd170870e9fbded797f791f7b80b9c.tar android_bootable_recovery-b3025d752dcd170870e9fbded797f791f7b80b9c.tar.gz android_bootable_recovery-b3025d752dcd170870e9fbded797f791f7b80b9c.tar.bz2 android_bootable_recovery-b3025d752dcd170870e9fbded797f791f7b80b9c.tar.lz android_bootable_recovery-b3025d752dcd170870e9fbded797f791f7b80b9c.tar.xz android_bootable_recovery-b3025d752dcd170870e9fbded797f791f7b80b9c.tar.zst android_bootable_recovery-b3025d752dcd170870e9fbded797f791f7b80b9c.zip |
Diffstat (limited to 'minadbd')
-rw-r--r-- | minadbd/fuse_adb_provider.cpp | 15 | ||||
-rw-r--r-- | minadbd/fuse_adb_provider.h | 2 | ||||
-rw-r--r-- | minadbd/minadbd_services.cpp | 6 |
3 files changed, 5 insertions, 18 deletions
diff --git a/minadbd/fuse_adb_provider.cpp b/minadbd/fuse_adb_provider.cpp index cada4bd2a..9d19a1ec3 100644 --- a/minadbd/fuse_adb_provider.cpp +++ b/minadbd/fuse_adb_provider.cpp @@ -18,14 +18,10 @@ #include <errno.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> -#include <functional> - #include "adb.h" #include "adb_io.h" -#include "fuse_sideload.h" bool FuseAdbDataProvider::ReadBlockAlignedData(uint8_t* buffer, uint32_t fetch_size, uint32_t start_block) const { @@ -45,14 +41,3 @@ bool FuseAdbDataProvider::ReadBlockAlignedData(uint8_t* buffer, uint32_t fetch_s void FuseAdbDataProvider::Close() { WriteFdExactly(fd_, "DONEDONE"); } - -int run_adb_fuse(android::base::unique_fd&& sfd, uint64_t file_size, uint32_t block_size) { - FuseAdbDataProvider adb_data_reader(std::move(sfd), file_size, block_size); - - provider_vtab vtab; - vtab.read_block = std::bind(&FuseAdbDataProvider::ReadBlockAlignedData, &adb_data_reader, - std::placeholders::_2, std::placeholders::_3, std::placeholders::_1); - vtab.close = [&adb_data_reader]() { adb_data_reader.Close(); }; - - return run_fuse_sideload(vtab, file_size, block_size); -} diff --git a/minadbd/fuse_adb_provider.h b/minadbd/fuse_adb_provider.h index e93aa0468..3fb689bd4 100644 --- a/minadbd/fuse_adb_provider.h +++ b/minadbd/fuse_adb_provider.h @@ -35,6 +35,4 @@ class FuseAdbDataProvider : public FuseDataProvider { void Close() override; }; -int run_adb_fuse(android::base::unique_fd&& sfd, uint64_t file_size, uint32_t block_size); - #endif diff --git a/minadbd/minadbd_services.cpp b/minadbd/minadbd_services.cpp index 3e1128546..6fe5c79bc 100644 --- a/minadbd/minadbd_services.cpp +++ b/minadbd/minadbd_services.cpp @@ -22,6 +22,7 @@ #include <unistd.h> #include <functional> +#include <memory> #include <string> #include <string_view> #include <thread> @@ -30,6 +31,7 @@ #include "adb_unique_fd.h" #include "fdevent.h" #include "fuse_adb_provider.h" +#include "fuse_sideload.h" #include "services.h" #include "sysdeps.h" @@ -44,7 +46,9 @@ static void sideload_host_service(unique_fd sfd, const std::string& args) { printf("sideload-host file size %" PRId64 " block size %d\n", file_size, block_size); - int result = run_adb_fuse(std::move(sfd), file_size, block_size); + auto adb_data_reader = + std::make_unique<FuseAdbDataProvider>(std::move(sfd), file_size, block_size); + int result = run_fuse_sideload(std::move(adb_data_reader)); printf("sideload_host finished\n"); exit(result == 0 ? 0 : 1); |