mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-25 01:30:05 +01:00
Rework detection of DM target flags.
Because there are already 3 targets used, the current detection based only on dm-crypt is not sufficient. Add new definition of dm_flags that allows separate target version detect. Note: we do not want to load targets explicitly; instead, we repeats detection after operation that could trigger target load. If dm_flags() call fails, then the target is not yet loaded.
This commit is contained in:
@@ -241,6 +241,7 @@ int VERITY_activate(struct crypt_device *cd,
|
||||
uint32_t activation_flags)
|
||||
{
|
||||
struct crypt_dm_active_device dmd;
|
||||
uint32_t dmv_flags;
|
||||
int r;
|
||||
|
||||
log_dbg("Trying to activate VERITY device %s using hash %s.",
|
||||
@@ -289,7 +290,7 @@ int VERITY_activate(struct crypt_device *cd,
|
||||
}
|
||||
|
||||
r = dm_create_device(cd, name, CRYPT_VERITY, &dmd, 0);
|
||||
if (r < 0 && !(dm_flags() & DM_VERITY_SUPPORTED)) {
|
||||
if (r < 0 && !dm_flags(DM_VERITY, &dmv_flags) && !(dmv_flags & DM_VERITY_SUPPORTED)) {
|
||||
log_err(cd, _("Kernel doesn't support dm-verity mapping.\n"));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user