Relax --shared test, allow mapping even for overlapping segments.

Support shared flag for LUKS devices (dangerous).
This commit is contained in:
Milan Broz
2012-05-02 00:46:42 +02:00
parent a718369374
commit f720affe8c
6 changed files with 18 additions and 21 deletions

View File

@@ -285,6 +285,7 @@ int PLAIN_activate(struct crypt_device *cd,
{
int r;
char *dm_cipher = NULL;
enum devcheck device_check;
struct crypt_dm_active_device dmd = {
.device = crypt_get_device_name(cd),
.cipher = NULL,
@@ -296,8 +297,12 @@ int PLAIN_activate(struct crypt_device *cd,
.flags = flags
};
r = device_check_and_adjust(cd, dmd.device,
(dmd.flags & CRYPT_ACTIVATE_SHARED) ? DEV_SHARED : DEV_EXCL,
if (dmd.flags & CRYPT_ACTIVATE_SHARED)
device_check = DEV_SHARED;
else
device_check = DEV_EXCL;
r = device_check_and_adjust(cd, dmd.device, device_check,
&dmd.size, &dmd.offset, &flags);
if (r)
return r;