Support discard option even for TCRYPT devices.

This commit is contained in:
Milan Broz
2014-01-11 22:13:37 +01:00
parent 3ba95a822f
commit bec86e3d5a
2 changed files with 16 additions and 1 deletions

View File

@@ -251,6 +251,9 @@ static int action_open_tcrypt(void)
if (opt_readonly)
flags |= CRYPT_ACTIVATE_READONLY;
if (opt_allow_discards)
flags |= CRYPT_ACTIVATE_ALLOW_DISCARDS;
if (activated_name)
r = crypt_activate_by_volume_key(cd, activated_name, NULL, 0, flags);
out:
@@ -1628,6 +1631,11 @@ int main(int argc, const char **argv)
_("Option --tcrypt-hidden, --tcrypt-system or --tcrypt-backup is supported only for TCRYPT device.\n"),
poptGetInvocationName(popt_context));
if (opt_tcrypt_hidden && opt_allow_discards)
usage(popt_context, EXIT_FAILURE,
_("Option --tcrypt-hidden cannot be combined with --allow-discards.\n"),
poptGetInvocationName(popt_context));
if (opt_debug) {
opt_verbose = 1;
crypt_set_debug_level(-1);