summaryrefslogtreecommitdiffstats
path: root/minadbd/fuse_adb_provider.h
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-03-20 04:10:50 +0100
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-03-20 04:10:50 +0100
commit9ac28bd57716550d92217f53465687d2d0fcaeba (patch)
tree9887b8f3b9f06abe942e4c2bd3669150fc17b3dd /minadbd/fuse_adb_provider.h
parentSnap for 5386257 from c5f06d7dc821dc5d98a3742fe1249fcbe0f0c1b8 to qt-release (diff)
parentMerge "Create a FuseDataProvider base class" am: eeea86f5fd am: 4aa4bf5e19 (diff)
downloadandroid_bootable_recovery-9ac28bd57716550d92217f53465687d2d0fcaeba.tar
android_bootable_recovery-9ac28bd57716550d92217f53465687d2d0fcaeba.tar.gz
android_bootable_recovery-9ac28bd57716550d92217f53465687d2d0fcaeba.tar.bz2
android_bootable_recovery-9ac28bd57716550d92217f53465687d2d0fcaeba.tar.lz
android_bootable_recovery-9ac28bd57716550d92217f53465687d2d0fcaeba.tar.xz
android_bootable_recovery-9ac28bd57716550d92217f53465687d2d0fcaeba.tar.zst
android_bootable_recovery-9ac28bd57716550d92217f53465687d2d0fcaeba.zip
Diffstat (limited to 'minadbd/fuse_adb_provider.h')
-rw-r--r--minadbd/fuse_adb_provider.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/minadbd/fuse_adb_provider.h b/minadbd/fuse_adb_provider.h
index 36d86d539..e93aa0468 100644
--- a/minadbd/fuse_adb_provider.h
+++ b/minadbd/fuse_adb_provider.h
@@ -19,14 +19,22 @@
#include <stdint.h>
-struct adb_data {
- int sfd; // file descriptor for the adb channel
+#include "android-base/unique_fd.h"
- uint64_t file_size;
- uint32_t block_size;
+#include "fuse_provider.h"
+
+// This class reads data from adb server.
+class FuseAdbDataProvider : public FuseDataProvider {
+ public:
+ FuseAdbDataProvider(android::base::unique_fd&& fd, uint64_t file_size, uint32_t block_size)
+ : FuseDataProvider(std::move(fd), file_size, block_size) {}
+
+ bool ReadBlockAlignedData(uint8_t* buffer, uint32_t fetch_size,
+ uint32_t start_block) const override;
+
+ void Close() override;
};
-int read_block_adb(const adb_data& ad, uint32_t block, uint8_t* buffer, uint32_t fetch_size);
-int run_adb_fuse(int sfd, uint64_t file_size, uint32_t block_size);
+int run_adb_fuse(android::base::unique_fd&& sfd, uint64_t file_size, uint32_t block_size);
#endif