Make resize action accept --device-size parameter (supports units).

Fixes #368.
This commit is contained in:
Ondrej Kozina
2019-06-26 17:18:56 +02:00
committed by Milan Broz
parent ecb898c7ff
commit 8b959158e3
2 changed files with 16 additions and 6 deletions

View File

@@ -659,6 +659,9 @@ static int action_resize(void)
crypt_safe_free(password);
}
if (opt_device_size)
opt_size = opt_device_size / SECTOR_SIZE;
if (r >= 0)
r = crypt_resize(cd, action_argv[0], opt_size);
out:
@@ -3827,6 +3830,10 @@ int main(int argc, const char **argv)
usage(popt_context, EXIT_FAILURE, _("Options --reduce-device-size and --data-size cannot be combined."),
poptGetInvocationName(popt_context));
if (opt_device_size && opt_size)
usage(popt_context, EXIT_FAILURE, _("Options --device-size and --size cannot be combined."),
poptGetInvocationName(popt_context));
r = run_action(action);
poptFreeContext(popt_context);
return r;