mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
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:
@@ -985,6 +985,22 @@ int device_is_rotational(struct device *device)
|
||||
return crypt_dev_is_rotational(major(st.st_rdev), minor(st.st_rdev));
|
||||
}
|
||||
|
||||
int device_is_dax(struct device *device)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (!device)
|
||||
return -EINVAL;
|
||||
|
||||
if (stat(device_path(device), &st) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (!S_ISBLK(st.st_mode))
|
||||
return 0;
|
||||
|
||||
return crypt_dev_is_dax(major(st.st_rdev), minor(st.st_rdev));
|
||||
}
|
||||
|
||||
size_t device_alignment(struct device *device)
|
||||
{
|
||||
int devfd;
|
||||
|
||||
Reference in New Issue
Block a user