updater: Allow devices to suppress BLKDISCARD
* On some devices TRIM is disabled for security reasons. Don't fail
flashing the ROM because discard isn't possible in this case.
Change-Id: I044619c3e0b01a496d967ef136501d0190240ad4
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index e93196b..b44e1a2 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -1499,10 +1499,12 @@
// length in bytes
blocks[1] = (range.second - range.first) * static_cast<uint64_t>(BLOCKSIZE);
+#ifndef SUPPRESS_EMMC_WIPE
if (ioctl(params.fd, BLKDISCARD, &blocks) == -1) {
PLOG(ERROR) << "BLKDISCARD ioctl failed";
return -1;
}
+#endif
}
}