Add direction hint in reencryption hotzone device name.

This commit is contained in:
Ondrej Kozina
2019-06-25 15:02:38 +02:00
committed by Milan Broz
parent 6851535fe7
commit 2f4a50064f
2 changed files with 3 additions and 2 deletions

View File

@@ -2188,7 +2188,7 @@ static bool is_reencryption_helper(const char *name)
return false;
len = strlen(name);
return (len >= 9 && (!strcmp(name + len - 8, "-hotzone") ||
return (len >= 9 && (!strncmp(name + len - 8, "-hotzone-", 9) ||
!strcmp(name + len - 8, "-overlay")));
}

View File

@@ -1184,7 +1184,8 @@ static int LUKS2_reenc_context_set_name(struct luks2_reenc_context *rh, const ch
if (!(rh->device_name = strdup(name)))
return -ENOMEM;
if (asprintf(&rh->hotzone_name, "%s-hotzone", name) < 0) {
if (asprintf(&rh->hotzone_name, "%s-hotzone-%s", name,
rh->direction == CRYPT_REENCRYPT_FORWARD ? "forward" : "backward") < 0) {
rh->hotzone_name = NULL;
return -ENOMEM;
}