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
This commit is contained in:
andi34
2019-03-23 14:39:53 +02:00
committed by Michael Bestas
parent 9bb7c225a4
commit 0ef6492518
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -74,6 +74,10 @@ LOCAL_CFLAGS := \
-Wall \
-Werror
ifeq ($(BOARD_SUPPRESS_EMMC_WIPE),true)
LOCAL_CFLAGS += -DSUPPRESS_EMMC_WIPE
endif
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(LOCAL_PATH)/include
+2
View File
@@ -1499,10 +1499,12 @@ static int PerformCommandErase(CommandParameters& params) {
// 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
}
}