summaryrefslogtreecommitdiffstats
path: root/updater/blockimg.c
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-07-01 08:09:12 +0200
committerTao Bao <tbao@google.com>2015-07-01 08:10:44 +0200
commit7125f9594db027ce4313d940ce2cafac67ae8c31 (patch)
tree618806a885d90b8e42bde8857b29b1829631c897 /updater/blockimg.c
parentMore accurate checking for overlapped ranges. (diff)
downloadandroid_bootable_recovery-7125f9594db027ce4313d940ce2cafac67ae8c31.tar
android_bootable_recovery-7125f9594db027ce4313d940ce2cafac67ae8c31.tar.gz
android_bootable_recovery-7125f9594db027ce4313d940ce2cafac67ae8c31.tar.bz2
android_bootable_recovery-7125f9594db027ce4313d940ce2cafac67ae8c31.tar.lz
android_bootable_recovery-7125f9594db027ce4313d940ce2cafac67ae8c31.tar.xz
android_bootable_recovery-7125f9594db027ce4313d940ce2cafac67ae8c31.tar.zst
android_bootable_recovery-7125f9594db027ce4313d940ce2cafac67ae8c31.zip
Diffstat (limited to '')
-rw-r--r--updater/blockimg.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/updater/blockimg.c b/updater/blockimg.c
index 1e95f4e7c..5b8a6a3c2 100644
--- a/updater/blockimg.c
+++ b/updater/blockimg.c
@@ -1404,7 +1404,6 @@ pcdout:
static int PerformCommandErase(CommandParameters* params) {
char* range = NULL;
int i;
- int j;
int rc = -1;
RangeSet* tgt = NULL;
struct stat st;
@@ -1431,7 +1430,7 @@ static int PerformCommandErase(CommandParameters* params) {
range = strtok_r(NULL, " ", &params->cpos);
if (range == NULL) {
- fprintf(stderr, "missing target blocks for erase\n");
+ fprintf(stderr, "missing target blocks for zero\n");
goto pceout;
}
@@ -1440,22 +1439,7 @@ static int PerformCommandErase(CommandParameters* params) {
if (params->canwrite) {
fprintf(stderr, " erasing %d blocks\n", tgt->size);
- allocate(BLOCKSIZE, &params->buffer, &params->bufsize);
- memset(params->buffer, 0, BLOCKSIZE);
-
for (i = 0; i < tgt->count; ++i) {
- // Always zero the blocks first to work around possibly flaky BLKDISCARD
- // Bug: 20881595
- if (!check_lseek(params->fd, (off64_t) tgt->pos[i * 2] * BLOCKSIZE, SEEK_SET)) {
- goto pceout;
- }
-
- for (j = tgt->pos[i * 2]; j < tgt->pos[i * 2 + 1]; ++j) {
- if (write_all(params->fd, params->buffer, BLOCKSIZE) == -1) {
- goto pceout;
- }
- }
-
// offset in bytes
blocks[0] = tgt->pos[i * 2] * (uint64_t) BLOCKSIZE;
// length in bytes