mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Detect unsupported zoned devices for LUKS header device.
Zoned device cannot be written with direct-io and cannot be used for LUKS header logic without significant changes. Do not allow to use them for LUKS header but allow it for data device, as dm-crypt supports it. Fixes: #877
This commit is contained in:
@@ -1007,6 +1007,22 @@ int device_is_dax(struct device *device)
|
||||
return crypt_dev_is_dax(major(st.st_rdev), minor(st.st_rdev));
|
||||
}
|
||||
|
||||
int device_is_zoned(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_zoned(major(st.st_rdev), minor(st.st_rdev));
|
||||
}
|
||||
|
||||
size_t device_alignment(struct device *device)
|
||||
{
|
||||
int devfd;
|
||||
|
||||
Reference in New Issue
Block a user