mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-15 04:40:05 +01:00
Add parameter for progress update without in separate lines.
Useful for reencryption or integrity format.
This commit is contained in:
@@ -40,7 +40,7 @@ To start (or continue) re-encryption for <device> use:
|
||||
\-\-device-size, \-\-hash, \-\-iter-time, \-\-use-random | \-\-use-urandom,
|
||||
\-\-keep-key, \-\-key-size, \-\-key-file, \-\-key-slot, \-\-keyfile-offset,
|
||||
\-\-keyfile-size, \-\-tries, \-\-use-directio, \-\-use-fsync, \-\-verbose, \-\-write-log,
|
||||
\-\-uuid]
|
||||
\-\-uuid, \-\-progress-frequency]
|
||||
|
||||
To encrypt data on (not yet encrypted) device, use \fI\-\-new\fR with combination
|
||||
with \fI\-\-reduce-device-size\fR.
|
||||
@@ -192,6 +192,9 @@ of the interrupted decryption process.
|
||||
.B "\-\-batch-mode, \-q"
|
||||
Suppresses all warnings and reencryption progress output.
|
||||
.TP
|
||||
.B "\-\-progress-frequency <seconds>"
|
||||
Print separate line every <seconds> with reencryption progress.
|
||||
.TP
|
||||
.B "\-\-version"
|
||||
Show the program version.
|
||||
.SH RETURN CODES
|
||||
|
||||
@@ -924,6 +924,9 @@ Suppresses all confirmation questions. Use with care!
|
||||
If the \-y option is not specified, this option also switches off
|
||||
the passphrase verification for \fIluksFormat\fR.
|
||||
.TP
|
||||
.B "\-\-progress-frequency <seconds>"
|
||||
Print separate line every <seconds> with wipe progress.
|
||||
.TP
|
||||
.B "\-\-timeout, \-t <number of seconds>"
|
||||
The number of seconds to wait before timeout on passphrase input
|
||||
via terminal. It is relevant every time a passphrase is asked,
|
||||
|
||||
@@ -20,7 +20,8 @@ Integritysetup supports these operations:
|
||||
Formats <device> (calculates space and dm-integrity superblock and wipes the device).
|
||||
|
||||
\fB<options>\fR can be [\-\-batch\-mode, \-\-no\-wipe, \-\-journal\-size, \-\-interleave\-sectors,
|
||||
\-\-tag\-size, \-\-integrity, \-\-integrity\-key\-size, \-\-integrity\-key\-file, \-\-sector\-size]
|
||||
\-\-tag\-size, \-\-integrity, \-\-integrity\-key\-size, \-\-integrity\-key\-file, \-\-sector\-size,
|
||||
\-\-progress-frequency]
|
||||
|
||||
.PP
|
||||
\fIopen\fR <device> <name>
|
||||
@@ -64,6 +65,9 @@ Show the program version.
|
||||
.B "\-\-batch\-mode"
|
||||
Do not ask for confirmation.
|
||||
.TP
|
||||
.B "\-\-progress-frequency <seconds>"
|
||||
Print separate line every <seconds> with wipe progress.
|
||||
.TP
|
||||
.B "\-\-no\-wipe"
|
||||
Do not wipe the device after format. A device that is not initially wiped will contain invalid checksums.
|
||||
.TP
|
||||
|
||||
@@ -2020,6 +2020,7 @@ int main(int argc, const char **argv)
|
||||
{ "readonly", 'r', POPT_ARG_NONE, &opt_readonly, 0, N_("Create a readonly mapping"), NULL },
|
||||
{ "batch-mode", 'q', POPT_ARG_NONE, &opt_batch_mode, 0, N_("Do not ask for confirmation"), NULL },
|
||||
{ "timeout", 't', POPT_ARG_INT, &opt_timeout, 0, N_("Timeout for interactive passphrase prompt (in seconds)"), N_("secs") },
|
||||
{ "progress-frequency",'\0', POPT_ARG_INT, &opt_progress_frequency, 0, N_("Progress line update (in seconds)"), N_("secs") },
|
||||
{ "tries", 'T', POPT_ARG_INT, &opt_tries, 0, N_("How often the input of the passphrase can be retried"), NULL },
|
||||
{ "align-payload", '\0', POPT_ARG_INT, &opt_align_payload, 0, N_("Align payload at <n> sector boundaries - for luksFormat"), N_("SECTORS") },
|
||||
{ "header-backup-file",'\0', POPT_ARG_STRING, &opt_header_backup_file, 0, N_("File with LUKS header and keyslots backup."), NULL },
|
||||
|
||||
@@ -58,6 +58,8 @@ extern int opt_debug;
|
||||
extern int opt_verbose;
|
||||
extern int opt_batch_mode;
|
||||
extern int opt_force_password;
|
||||
extern int opt_progress_frequency;
|
||||
|
||||
|
||||
/* Common tools */
|
||||
void clogger(struct crypt_device *cd, int level, const char *file, int line,
|
||||
|
||||
@@ -1267,6 +1267,7 @@ int main(int argc, const char **argv)
|
||||
{ "key-file", 'd', POPT_ARG_STRING, &opt_key_file, 0, N_("Read the key from a file."), NULL },
|
||||
{ "iter-time", 'i', POPT_ARG_INT, &opt_iteration_time, 0, N_("PBKDF2 iteration time for LUKS (in ms)"), N_("msecs") },
|
||||
{ "batch-mode", 'q', POPT_ARG_NONE, &opt_batch_mode, 0, N_("Do not ask for confirmation"), NULL },
|
||||
{ "progress-frequency",'\0', POPT_ARG_INT, &opt_progress_frequency, 0, N_("Progress line update (in seconds)"), N_("secs") },
|
||||
{ "tries", 'T', POPT_ARG_INT, &opt_tries, 0, N_("How often the input of the passphrase can be retried"), NULL },
|
||||
{ "use-random", '\0', POPT_ARG_NONE, &opt_random, 0, N_("Use /dev/random for generating volume key."), NULL },
|
||||
{ "use-urandom", '\0', POPT_ARG_NONE, &opt_urandom, 0, N_("Use /dev/urandom for generating volume key."), NULL },
|
||||
|
||||
@@ -483,6 +483,7 @@ int main(int argc, const char **argv)
|
||||
{ "verbose", 'v', POPT_ARG_NONE, &opt_verbose, 0, N_("Shows more detailed error messages"), NULL },
|
||||
{ "debug", '\0', POPT_ARG_NONE, &opt_debug, 0, N_("Show debug messages"), NULL },
|
||||
{ "batch-mode", 'q', POPT_ARG_NONE, &opt_batch_mode, 0, N_("Do not ask for confirmation"), NULL },
|
||||
{ "progress-frequency", '\0', POPT_ARG_INT, &opt_progress_frequency, 0, N_("Progress line update (in seconds)"), N_("secs") },
|
||||
{ "no-wipe", '\0', POPT_ARG_NONE, &opt_no_wipe, 0, N_("Do not wipe device after format"), NULL },
|
||||
|
||||
{ "journal-size", 'j', POPT_ARG_STRING,&opt_journal_size_str, 0, N_("Journal size"), N_("bytes") },
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
int opt_verbose = 0;
|
||||
int opt_debug = 0;
|
||||
int opt_batch_mode = 0;
|
||||
int opt_progress_frequency = 0;
|
||||
|
||||
/* interrupt handling */
|
||||
volatile int quit = 0;
|
||||
@@ -336,9 +337,10 @@ static double time_diff(struct timeval *start, struct timeval *end)
|
||||
+ (end->tv_usec - start->tv_usec) / 1E6;
|
||||
}
|
||||
|
||||
// FIXME: detect terminal type
|
||||
void tools_clear_line(void)
|
||||
{
|
||||
if (opt_progress_frequency)
|
||||
return;
|
||||
/* vt100 code clear line */
|
||||
log_std("\33[2K\r");
|
||||
}
|
||||
@@ -348,8 +350,9 @@ void tools_time_progress(uint64_t device_size, uint64_t bytes,
|
||||
{
|
||||
struct timeval now_time;
|
||||
unsigned long long mbytes, eta;
|
||||
double tdiff, mib;
|
||||
double tdiff, mib, frequency;
|
||||
int final = (bytes == device_size);
|
||||
char *eol;
|
||||
|
||||
if (opt_batch_mode)
|
||||
return;
|
||||
@@ -361,7 +364,15 @@ void tools_time_progress(uint64_t device_size, uint64_t bytes,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!final && time_diff(end_time, &now_time) < 0.5)
|
||||
if (opt_progress_frequency) {
|
||||
frequency = (double)opt_progress_frequency;
|
||||
eol = "\n";
|
||||
} else {
|
||||
frequency = 0.5;
|
||||
eol = "";
|
||||
}
|
||||
|
||||
if (!final && time_diff(end_time, &now_time) < frequency)
|
||||
return;
|
||||
|
||||
*end_time = now_time;
|
||||
@@ -388,9 +399,9 @@ void tools_time_progress(uint64_t device_size, uint64_t bytes,
|
||||
mbytes, mib);
|
||||
else
|
||||
log_std("Progress: %5.1f%%, ETA %02llu:%02llu, "
|
||||
"%4llu MiB written, speed %5.1f MiB/s",
|
||||
"%4llu MiB written, speed %5.1f MiB/s%s",
|
||||
(double)bytes / device_size * 100,
|
||||
eta / 60, eta % 60, mbytes, mib);
|
||||
eta / 60, eta % 60, mbytes, mib, eol);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user