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:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user