2018-06-26 22:38:35 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include <string>
|
2023-01-28 05:39:06 +01:00
|
|
|
#include <vector>
|
2018-06-26 22:38:35 +02:00
|
|
|
|
2023-01-28 05:39:06 +01:00
|
|
|
#include <android-base/unique_fd.h>
|
2018-06-26 22:38:35 +02:00
|
|
|
#include <bootimg.h>
|
2023-01-28 05:39:06 +01:00
|
|
|
#include <liblp/liblp.h>
|
|
|
|
#include <sparse/sparse.h>
|
|
|
|
|
|
|
|
using SparsePtr = std::unique_ptr<sparse_file, decltype(&sparse_file_destroy)>;
|
2018-06-26 22:38:35 +02:00
|
|
|
|
|
|
|
/* util stuff */
|
|
|
|
double now();
|
|
|
|
void set_verbose();
|
|
|
|
|
|
|
|
// These printf-like functions are implemented in terms of vsnprintf, so they
|
|
|
|
// use the same attribute for compile-time format string checking.
|
|
|
|
void die(const char* fmt, ...) __attribute__((__noreturn__))
|
|
|
|
__attribute__((__format__(__printf__, 1, 2)));
|
2019-06-28 07:15:29 +02:00
|
|
|
|
2018-06-26 22:38:35 +02:00
|
|
|
void verbose(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2)));
|
2019-06-28 07:15:29 +02:00
|
|
|
|
|
|
|
void die(const std::string& str) __attribute__((__noreturn__));
|
2023-01-28 05:39:06 +01:00
|
|
|
|
|
|
|
bool should_flash_in_userspace(const android::fs_mgr::LpMetadata& metadata,
|
|
|
|
const std::string& partition_name);
|
|
|
|
bool is_sparse_file(android::base::borrowed_fd fd);
|
|
|
|
int64_t get_file_size(android::base::borrowed_fd fd);
|
|
|
|
|
|
|
|
class ImageSource {
|
|
|
|
public:
|
|
|
|
virtual ~ImageSource(){};
|
|
|
|
virtual bool ReadFile(const std::string& name, std::vector<char>* out) const = 0;
|
|
|
|
virtual android::base::unique_fd OpenFile(const std::string& name) const = 0;
|
|
|
|
};
|