summaryrefslogtreecommitdiffstats
path: root/updater/blockimg.c
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2015-07-11 22:20:38 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-07-11 22:20:39 +0200
commit65c230f4b3c9fd6b42f6502b96e5b47c7b1c2f61 (patch)
treea01544b99af8c148b9f3d66b5542107624f48f1d /updater/blockimg.c
parentMerge "Allow mounting squashfs partitions" (diff)
parentRevert "Zero blocks before BLKDISCARD" (diff)
downloadandroid_bootable_recovery-65c230f4b3c9fd6b42f6502b96e5b47c7b1c2f61.tar
android_bootable_recovery-65c230f4b3c9fd6b42f6502b96e5b47c7b1c2f61.tar.gz
android_bootable_recovery-65c230f4b3c9fd6b42f6502b96e5b47c7b1c2f61.tar.bz2
android_bootable_recovery-65c230f4b3c9fd6b42f6502b96e5b47c7b1c2f61.tar.lz
android_bootable_recovery-65c230f4b3c9fd6b42f6502b96e5b47c7b1c2f61.tar.xz
android_bootable_recovery-65c230f4b3c9fd6b42f6502b96e5b47c7b1c2f61.tar.zst
android_bootable_recovery-65c230f4b3c9fd6b42f6502b96e5b47c7b1c2f61.zip
Diffstat (limited to 'updater/blockimg.c')
-rw-r--r--updater/blockimg.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/updater/blockimg.c b/updater/blockimg.c
index 0bd2559f7..a6a389507 100644
--- a/updater/blockimg.c
+++ b/updater/blockimg.c
@@ -1465,7 +1465,6 @@ pcdout:
static int PerformCommandErase(CommandParameters* params) {
char* range = NULL;
int i;
- int j;
int rc = -1;
RangeSet* tgt = NULL;
struct stat st;
@@ -1492,7 +1491,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;
}
@@ -1501,22 +1500,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