diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-06-05 01:11:42 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-06-05 01:11:42 +0000 |
commit | e23aed8a9fcfb15b9fc5886f40f4e8e9c615b631 (patch) | |
tree | 97089a7dfa512f68751eeb39ca000b17619794d9 /libsparse/sparse.cpp | |
parent | 8911e3e41e8c42a5679a43b35423e6377b9b93f9 (diff) | |
parent | 39bdf397fa48f62b18f39ff984a2cfa0a4524495 (diff) |
Snap for 6560464 from 39bdf397fa48f62b18f39ff984a2cfa0a4524495 to rvc-release
Change-Id: I7a62eb5b4f780309f891d5188d6d320835e5de5b
Diffstat (limited to 'libsparse/sparse.cpp')
-rw-r--r-- | libsparse/sparse.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libsparse/sparse.cpp b/libsparse/sparse.cpp index 24c6379cd..8622b4c39 100644 --- a/libsparse/sparse.cpp +++ b/libsparse/sparse.cpp @@ -136,11 +136,23 @@ static int write_all_blocks(struct sparse_file* s, struct output_file* out) { return 0; } +/* + * This is a workaround for 32-bit Windows: Limit the block size to 64 MB before + * fastboot executable binary for windows 64-bit is released (b/156057250). + */ +#define MAX_BACKED_BLOCK_SIZE ((unsigned int) (64UL << 20)) + int sparse_file_write(struct sparse_file* s, int fd, bool gz, bool sparse, bool crc) { + struct backed_block* bb; int ret; int chunks; struct output_file* out; + for (bb = backed_block_iter_new(s->backed_block_list); bb; bb = backed_block_iter_next(bb)) { + ret = backed_block_split(s->backed_block_list, bb, MAX_BACKED_BLOCK_SIZE); + if (ret) return ret; + } + chunks = sparse_count_chunks(s); out = output_file_open_fd(fd, s->block_size, s->len, gz, sparse, chunks, crc); |