mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-16 05:10:03 +01:00
cryptsetup: add close --cancel-deferred
Allows to remove a previously set deferred removal from the command line. [mbroz: ported to new CLI parsing]
This commit is contained in:
committed by
Milan Broz
parent
3062a9ba91
commit
53d3ca0062
@@ -101,7 +101,7 @@ For backward compatibility there are \fBclose\fR command aliases:
|
||||
\fBtcryptClose\fR (all behaves exactly the same, device type is
|
||||
determined automatically from active device).
|
||||
|
||||
\fB<options>\fR can be [\-\-deferred]
|
||||
\fB<options>\fR can be [\-\-deferred] or [\-\-cancel\-deferred]
|
||||
|
||||
.PP
|
||||
\fIstatus\fR <name>
|
||||
@@ -1267,6 +1267,9 @@ for \fBpwquality.conf(5)\fR and \fBpasswdqc.conf(5)\fR.
|
||||
.B "\-\-deferred"
|
||||
Defers device removal in \fIclose\fR command until the last user closes it.
|
||||
.TP
|
||||
.B "\-\-cancel\-deferred"
|
||||
Removes a previously configured deferred device removal in \fIclose\fR command.
|
||||
.TP
|
||||
.B "\-\-disable\-locks"
|
||||
Disable lock protection for metadata on disk.
|
||||
This option is valid only for LUKS2 and ignored for other formats.
|
||||
|
||||
@@ -617,6 +617,8 @@ static int action_close(void)
|
||||
|
||||
if (ARG_SET(OPT_DEFERRED_ID))
|
||||
flags |= CRYPT_DEACTIVATE_DEFERRED;
|
||||
if (ARG_SET(OPT_CANCEL_DEFERRED_ID))
|
||||
flags |= CRYPT_DEACTIVATE_DEFERRED_CANCEL;
|
||||
|
||||
r = crypt_init_by_name(&cd, action_argv[0]);
|
||||
if (r == 0)
|
||||
@@ -3679,6 +3681,11 @@ int main(int argc, const char **argv)
|
||||
_("Options --refresh and --test-passphrase are mutually exclusive."),
|
||||
poptGetInvocationName(popt_context));
|
||||
|
||||
if (ARG_SET(OPT_CANCEL_DEFERRED_ID) && ARG_SET(OPT_DEFERRED_ID))
|
||||
usage(popt_context, EXIT_FAILURE,
|
||||
_("Options --cancel-deferred and --deferred cannot be used at the same time."),
|
||||
poptGetInvocationName(popt_context));
|
||||
|
||||
/* open action specific check */
|
||||
if (ARG_SET(OPT_SHARED_ID) && strcmp_or_null(device_type, "plain"))
|
||||
usage(popt_context, EXIT_FAILURE,
|
||||
|
||||
@@ -29,6 +29,8 @@ ARG(OPT_ALLOW_DISCARDS, '\0', POPT_ARG_NONE, N_("Allow discards (aka TRIM) reque
|
||||
|
||||
ARG(OPT_BATCH_MODE, 'q', POPT_ARG_NONE, N_("Do not ask for confirmation"), NULL, CRYPT_ARG_BOOL, {}, {})
|
||||
|
||||
ARG(OPT_CANCEL_DEFERRED, '\0', POPT_ARG_NONE, N_("Cancel a previously set deferred device removal"), NULL, CRYPT_ARG_BOOL, {}, OPT_DEFERRED_ACTIONS)
|
||||
|
||||
ARG(OPT_CIPHER, 'c', POPT_ARG_STRING, N_("The cipher used to encrypt the disk (see /proc/crypto)"), NULL, CRYPT_ARG_STRING, {}, {})
|
||||
|
||||
ARG(OPT_DEBUG, '\0', POPT_ARG_NONE, N_("Show debug messages"), NULL, CRYPT_ARG_BOOL, {}, {})
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#define OPT_BITMAP_SECTORS_PER_BIT "bitmap-sectors-per-bit"
|
||||
#define OPT_BLOCK_SIZE "block-size"
|
||||
#define OPT_BUFFER_SECTORS "buffer-sectors"
|
||||
#define OPT_CANCEL_DEFERRED "cancel-deferred"
|
||||
#define OPT_CHECK_AT_MOST_ONCE "check-at-most-once"
|
||||
#define OPT_CIPHER "cipher"
|
||||
#define OPT_DATA_BLOCK_SIZE "data-block-size"
|
||||
|
||||
Reference in New Issue
Block a user