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

Commit a9521fe4 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
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
parent f4659b2b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ namespace android {
        int ret;
        uint64_t len = get_block_device_size(fd);

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

@@ -60,6 +61,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);
@@ -71,7 +73,9 @@ namespace android {
                return 0;
            }

#ifndef NO_SECURE_DISCARD
        }
#endif

        return ret;
    }