Detect DAX devices and and warn in LUKS format.

DAX / persistent memory devices do not provide atomic sector updates,
any single modification can corrupt the whole encryption block.
This commit is contained in:
Milan Broz
2023-03-18 13:45:25 +01:00
parent 2a2027ee3e
commit e4c2aa64b5
4 changed files with 34 additions and 0 deletions

View File

@@ -220,6 +220,16 @@ int crypt_dev_is_rotational(int major, int minor)
return val ? 1 : 0;
}
int crypt_dev_is_dax(int major, int minor)
{
uint64_t val;
if (!_sysfs_get_uint64(major, minor, &val, "queue/dax"))
return 0; /* if failed, expect non-DAX device */
return val ? 1 : 0;
}
int crypt_dev_is_partition(const char *dev_path)
{
uint64_t val;