Android-cuttlefish cvd tool
fastboot_driver_interface.h
Go to the documentation of this file.
1//
2// Copyright (C) 2023 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16#pragma once
17
18#include <string>
19
21
22class Transport;
23
24namespace fastboot {
25
26enum RetCode : int {
33};
34
36 public:
37 RetCode virtual FlashPartition(const std::string& partition, android::base::borrowed_fd fd,
38 uint32_t sz) = 0;
39 RetCode virtual DeletePartition(const std::string& partition) = 0;
41 RetCode virtual Reboot(std::string* response = nullptr,
42 std::vector<std::string>* info = nullptr) = 0;
43
44 RetCode virtual RebootTo(std::string target, std::string* response = nullptr,
45 std::vector<std::string>* info = nullptr) = 0;
46 RetCode virtual GetVar(const std::string& key, std::string* val,
47 std::vector<std::string>* info = nullptr) = 0;
48 RetCode virtual FetchToFd(const std::string& partition, android::base::borrowed_fd fd,
49 int64_t offset = -1, int64_t size = -1,
50 std::string* response = nullptr,
51 std::vector<std::string>* info = nullptr) = 0;
52 RetCode virtual Download(const std::string& name, android::base::borrowed_fd fd, size_t size,
53 std::string* response = nullptr,
54 std::vector<std::string>* info = nullptr) = 0;
55 RetCode virtual RawCommand(const std::string& cmd, const std::string& message,
56 std::string* response = nullptr,
57 std::vector<std::string>* info = nullptr, int* dsize = nullptr) = 0;
58 RetCode virtual ResizePartition(const std::string& partition, const std::string& size) = 0;
59 RetCode virtual Erase(const std::string& partition, std::string* response = nullptr,
60 std::vector<std::string>* info = nullptr) = 0;
61 virtual ~IFastBootDriver() = default;
62};
63} // namespace fastboot
Definition: transport.h:23
Definition: fastboot_driver_interface.h:35
virtual RetCode Erase(const std::string &partition, std::string *response=nullptr, std::vector< std::string > *info=nullptr)=0
virtual RetCode FlashPartition(const std::string &partition, android::base::borrowed_fd fd, uint32_t sz)=0
virtual RetCode Download(const std::string &name, android::base::borrowed_fd fd, size_t size, std::string *response=nullptr, std::vector< std::string > *info=nullptr)=0
virtual RetCode Reboot(std::string *response=nullptr, std::vector< std::string > *info=nullptr)=0
virtual RetCode RawCommand(const std::string &cmd, const std::string &message, std::string *response=nullptr, std::vector< std::string > *info=nullptr, int *dsize=nullptr)=0
virtual RetCode ResizePartition(const std::string &partition, const std::string &size)=0
virtual RetCode RebootTo(std::string target, std::string *response=nullptr, std::vector< std::string > *info=nullptr)=0
virtual RetCode DeletePartition(const std::string &partition)=0
virtual ~IFastBootDriver()=default
virtual RetCode GetVar(const std::string &key, std::string *val, std::vector< std::string > *info=nullptr)=0
virtual RetCode FetchToFd(const std::string &partition, android::base::borrowed_fd fd, int64_t offset=-1, int64_t size=-1, std::string *response=nullptr, std::vector< std::string > *info=nullptr)=0
virtual RetCode WaitForDisconnect()=0
struct fs_info info
Definition: ext4_utils.cpp:42
uint32_t size
Definition: io.h:2
Definition: fastboot_driver.cpp:58
RetCode
Definition: fastboot_driver_interface.h:26
@ BAD_ARG
Definition: fastboot_driver_interface.h:28
@ IO_ERROR
Definition: fastboot_driver_interface.h:29
@ BAD_DEV_RESP
Definition: fastboot_driver_interface.h:30
@ SUCCESS
Definition: fastboot_driver_interface.h:27
@ TIMEOUT
Definition: fastboot_driver_interface.h:32
@ DEVICE_FAIL
Definition: fastboot_driver_interface.h:31
Definition: unique_fd.h:292