diff options
author | Xin Li <delphij@google.com> | 2020-07-15 17:55:15 -0700 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2020-07-15 17:55:15 -0700 |
commit | 1521c58c5dbdeeaa1d098ae62a5879c1b24749d7 (patch) | |
tree | a8c5c6b5144cb27cd55cb602c231840dd3d1905e /libsparse/sparse.cpp | |
parent | 755a3dd78d913f812e5eddb9980557fa83678b3a (diff) | |
parent | add3b3a137cdf32852352c1426cbfaa4707dd623 (diff) |
Merge ab/12162526 into stage-aosp-rvc-ts-dev
Bug: 148878042
Change-Id: I54c668427c06c415584cc80d6e7d35d451b28393
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); |