Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3de2dee authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Ricardo Cerqueira
Browse files

PBD: Apply the same emmc discard logic as ext4_utils

If we have SECURE_DISCARD disabled (currently only affects ext4_utils)
don't invoke BLKSECDISCARD for FRP, either. Slow flash is slow.

Addresses CYNGNOS-729

Change-Id: I05f1c945aa4d6b441c6b55dd438cf06d12bd0548
(cherry picked from commit a9521fe4)
parent 8f9cafaf
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ namespace android {
        int ret;
        uint64_t len = get_block_device_size(fd);

#ifndef NO_SECURE_DISCARD
        range[0] = 0;
        range[1] = len;

@@ -59,6 +60,7 @@ namespace android {
        ret = ioctl(fd, BLKSECDISCARD, &range);
        if (ret < 0) {
            ALOGE("Something went wrong secure discarding block: %s\n", strerror(errno));
#endif
            range[0] = 0;
            range[1] = len;
            ret = ioctl(fd, BLKDISCARD, &range);
@@ -70,7 +72,9 @@ namespace android {
                return 0;
            }

#ifndef NO_SECURE_DISCARD
        }
#endif

        return ret;
    }