fstrim: Use a local definition of the IOCTL FIDTRIM number
As it is not upstream, it doesn't belong in the external/kernel-headers
... or in bionic's cleaned up copy.
It matches what is in common/android-3.10.
Bug: 15593563
Change-Id: I6fa22cd823a88805ec57f973813ac69291069c7d
diff --git a/fstrim.c b/fstrim.c
index 58fd15e..895d44f 100644
--- a/fstrim.c
+++ b/fstrim.c
@@ -39,6 +39,9 @@
#define UNUSED __attribute__((unused))
+/* From a would-be kernel header */
+#define FIDTRIM _IOWR('f', 128, struct fstrim_range) /* Deep discard trim */
+
static unsigned long long get_boot_time_ms(void)
{
struct timespec t;
@@ -102,16 +105,8 @@
memset(&range, 0, sizeof(range));
range.len = ULLONG_MAX;
SLOGI("Invoking %s ioctl on %s", deep_trim ? "FIDTRIM" : "FITRIM", fstab->recs[i].mount_point);
-#if defined(FIDTRIM)
+
ret = ioctl(fd, deep_trim ? FIDTRIM : FITRIM, &range);
-#else
- if (deep_trim) {
- ret = -1;
- errno = EINVAL;
- } else {
- ret = ioctl(fd, FITRIM, &range);
- }
-#endif
if (ret) {
SLOGE("%s ioctl failed on %s (error %d/%s)", deep_trim ? "FIDTRIM" : "FITRIM", fstab->recs[i].mount_point, errno, strerror(errno));
ret = -1;