Merge "fastboot: show progress when sending sparse images."
am: 6a27196516
* commit '6a27196516da6b900f39dc2c601f60452b917e21':
fastboot: show progress when sending sparse images.
This commit is contained in:
commit
69c9274c3e
3 changed files with 19 additions and 7 deletions
|
@ -157,17 +157,17 @@ void fb_queue_flash(const char *ptn, void *data, unsigned sz)
|
|||
a->msg = mkmsg("writing '%s'", ptn);
|
||||
}
|
||||
|
||||
void fb_queue_flash_sparse(const char *ptn, struct sparse_file *s, unsigned sz)
|
||||
{
|
||||
void fb_queue_flash_sparse(const char* ptn, struct sparse_file* s, unsigned sz, size_t current,
|
||||
size_t total) {
|
||||
Action *a;
|
||||
|
||||
a = queue_action(OP_DOWNLOAD_SPARSE, "");
|
||||
a->data = s;
|
||||
a->size = 0;
|
||||
a->msg = mkmsg("sending sparse '%s' (%d KB)", ptn, sz / 1024);
|
||||
a->msg = mkmsg("sending sparse '%s' %zu/%zu (%d KB)", ptn, current, total, sz / 1024);
|
||||
|
||||
a = queue_action(OP_COMMAND, "flash:%s", ptn);
|
||||
a->msg = mkmsg("writing '%s'", ptn);
|
||||
a->msg = mkmsg("writing '%s' %zu/%zu", ptn, current, total);
|
||||
}
|
||||
|
||||
static int match(const char* str, const char** value, unsigned count) {
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <android-base/parseint.h>
|
||||
#include <android-base/strings.h>
|
||||
|
@ -705,13 +707,22 @@ static void flash_buf(const char *pname, struct fastboot_buffer *buf)
|
|||
sparse_file** s;
|
||||
|
||||
switch (buf->type) {
|
||||
case FB_BUFFER_SPARSE:
|
||||
case FB_BUFFER_SPARSE: {
|
||||
std::vector<std::pair<sparse_file*, int64_t>> sparse_files;
|
||||
s = reinterpret_cast<sparse_file**>(buf->data);
|
||||
while (*s) {
|
||||
int64_t sz = sparse_file_len(*s, true, false);
|
||||
fb_queue_flash_sparse(pname, *s++, sz);
|
||||
sparse_files.emplace_back(*s, sz);
|
||||
++s;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sparse_files.size(); ++i) {
|
||||
const auto& pair = sparse_files[i];
|
||||
fb_queue_flash_sparse(pname, pair.first, pair.second, i + 1, sparse_files.size());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case FB_BUFFER:
|
||||
fb_queue_flash(pname, buf->data, buf->sz);
|
||||
break;
|
||||
|
|
|
@ -51,7 +51,8 @@ char *fb_get_error(void);
|
|||
/* engine.c - high level command queue engine */
|
||||
bool fb_getvar(Transport* transport, const std::string& key, std::string* value);
|
||||
void fb_queue_flash(const char *ptn, void *data, uint32_t sz);
|
||||
void fb_queue_flash_sparse(const char *ptn, struct sparse_file *s, uint32_t sz);
|
||||
void fb_queue_flash_sparse(const char* ptn, struct sparse_file* s, uint32_t sz, size_t current,
|
||||
size_t total);
|
||||
void fb_queue_erase(const char *ptn);
|
||||
void fb_queue_format(const char *ptn, int skip_if_not_supported, int32_t max_chunk_sz);
|
||||
void fb_queue_require(const char *prod, const char *var, bool invert,
|
||||
|
|
Loading…
Reference in a new issue