summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Monaco <matthew.monaco@0x01b.net>2012-05-19 09:05:50 -0600
committerLennart Poettering <lennart@poettering.net>2012-05-21 17:28:06 +0200
commit2a2aab602e1d8b6bf0b440730e379f9dd6586b80 (patch)
tree981f2ee8cb4fecedb7aa3ddcb84a69d5490c669f
parentb8f8323268ae974288e49a7cc6c1c47531e436c9 (diff)
cryptsetup: support discards (TRIM)
-rw-r--r--src/cryptsetup/cryptsetup.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 6d4e965fe1..b26fcca836 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -41,6 +41,7 @@ static char *opt_hash = NULL;
static unsigned opt_tries = 0;
static bool opt_readonly = false;
static bool opt_verify = false;
+static bool opt_discards = false;
static usec_t opt_timeout = DEFAULT_TIMEOUT_USEC;
/* Options Debian's crypttab knows we don't:
@@ -98,6 +99,8 @@ static int parse_one_option(const char *option) {
opt_readonly = true;
else if (streq(option, "verify"))
opt_verify = true;
+ else if (streq(option, "allow-discards"))
+ opt_discards = true;
else if (streq(option, "luks"))
opt_type = CRYPT_LUKS1;
else if (streq(option, "plain") ||
@@ -314,6 +317,9 @@ int main(int argc, char *argv[]) {
if (opt_readonly)
flags |= CRYPT_ACTIVATE_READONLY;
+ if (opt_discards)
+ flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS;
+
if (opt_timeout > 0)
until = now(CLOCK_MONOTONIC) + opt_timeout;
else