summaryrefslogtreecommitdiffstats
path: root/ext4_utils/wipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext4_utils/wipe.c')
-rw-r--r--ext4_utils/wipe.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext4_utils/wipe.c b/ext4_utils/wipe.c
index 002e0213..f8af756d 100644
--- a/ext4_utils/wipe.c
+++ b/ext4_utils/wipe.c
@@ -34,6 +34,7 @@
int wipe_block_device(int fd, s64 len)
{
+#ifndef SUPPRESS_EMMC_WIPE
u64 range[2];
int ret;
@@ -47,7 +48,7 @@ int wipe_block_device(int fd, s64 len)
range[1] = len;
ret = ioctl(fd, BLKSECDISCARD, &range);
if (ret < 0) {
-#endif
+#endif /* NO_SECURE_DISCARD */
range[0] = 0;
range[1] = len;
ret = ioctl(fd, BLKDISCARD, &range);
@@ -60,8 +61,12 @@ int wipe_block_device(int fd, s64 len)
}
#ifndef NO_SECURE_DISCARD
}
-#endif
+#endif /* NO_SECURE_DISCARD */
return 0;
+#else
+ warn("Wipe via secure discard suppressed due to bug in EMMC firmware\n");
+ return 1;
+#endif /* SUPPRESS_EMMC_WIPE */
}
#else /* __linux__ */