mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-20 23:30:14 +01:00
Simplify load_luks2_by_name.
Also adds specific error messsage when device is not actualy LUKS2.
This commit is contained in:
committed by
Milan Broz
parent
f388662418
commit
b10c0b6a02
@@ -843,18 +843,19 @@ out:
|
||||
static enum device_status_info load_luks2_by_name(struct crypt_device **r_cd, const char *active_name, const char *header_device)
|
||||
{
|
||||
int r;
|
||||
struct crypt_device *cd = NULL;
|
||||
struct crypt_device *cd;
|
||||
|
||||
assert(r_cd);
|
||||
assert(active_name);
|
||||
|
||||
r = crypt_init_by_name_and_header(&cd, active_name, header_device);
|
||||
if (r || !isLUKS2(crypt_get_type(cd))) {
|
||||
crypt_free(cd);
|
||||
if (r == -EBUSY) /* luks2 locking error (message printed by libcryptsetup) */
|
||||
if (r)
|
||||
return DEVICE_INVALID;
|
||||
|
||||
return DEVICE_NOT_LUKS;
|
||||
if (!isLUKS2(crypt_get_type(cd))) {
|
||||
log_err(_("Active device %s is not LUKS2."), active_name);
|
||||
crypt_free(cd);
|
||||
return DEVICE_INVALID;
|
||||
}
|
||||
|
||||
r = luks2_reencrypt_in_progress(cd);
|
||||
|
||||
Reference in New Issue
Block a user