diff options
author | Woody Lin <woodylin@google.com> | 2020-05-13 20:50:54 +0800 |
---|---|---|
committer | Woody Lin <woodylin@google.com> | 2020-06-03 11:45:17 +0800 |
commit | a386482f1d2e29e893a59289f71ccdc715472514 (patch) | |
tree | c4322bedbe9e20d7280dc64cb4a733bad426d335 /libsparse | |
parent | 450e83eb8f2dea14f57ccd63973c27d9523ff73d (diff) | |
download | core-a386482f1d2e29e893a59289f71ccdc715472514.tar.gz |
libsparse: Limit block size to 64 MB
Limit the block size to 64 MB before fastboot executable binary for
windows 64-bit is released.
Bug: 156057250
Change-Id: Ic4edb963a3d99f718d7630aba3f351729a84e994
Diffstat (limited to 'libsparse')
-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); |