Allow "private" activation (skip some udev global rules) flag.

This commit is contained in:
Milan Broz
2012-05-02 16:51:58 +02:00
parent adaf6d3eb4
commit ba7d9967a8
4 changed files with 8 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
* Relax --shared test, allow mapping even for overlapping segments. * Relax --shared test, allow mapping even for overlapping segments.
* Support shared flag for LUKS devices (dangerous). * Support shared flag for LUKS devices (dangerous).
* Switch on retry on device remove for libdevmapper. * Switch on retry on device remove for libdevmapper.
* Allow "private" activation (skip some udev global rules) flag.
2012-04-09 Milan Broz <gmazyland@gmail.com> 2012-04-09 Milan Broz <gmazyland@gmail.com>
* Fix header check to support old (cryptsetup 1.0.0) header alignment. (1.4.0) * Fix header check to support old (cryptsetup 1.0.0) header alignment. (1.4.0)

View File

@@ -640,6 +640,8 @@ int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot);
#define CRYPT_ACTIVATE_SHARED (1 << 2) #define CRYPT_ACTIVATE_SHARED (1 << 2)
/** enable discards aka TRIM */ /** enable discards aka TRIM */
#define CRYPT_ACTIVATE_ALLOW_DISCARDS (1 << 3) #define CRYPT_ACTIVATE_ALLOW_DISCARDS (1 << 3)
/** skip global udev rules in activation ("private device"), input only */
#define CRYPT_ACTIVATE_PRIVATE (1 << 4)
/** /**
* Active device runtime attributes * Active device runtime attributes

View File

@@ -435,7 +435,7 @@ int dm_create_device(const char *name,
if (!params) if (!params)
goto out_no_removal; goto out_no_removal;
if (type && !strncmp(type, "TEMP", 4)) if (dmd->flags & CRYPT_ACTIVATE_PRIVATE)
udev_flags = CRYPT_TEMP_UDEV_FLAGS; udev_flags = CRYPT_TEMP_UDEV_FLAGS;
/* All devices must have DM_UUID, only resize on old device is exception */ /* All devices must have DM_UUID, only resize on old device is exception */

View File

@@ -65,9 +65,12 @@ static int setup_mapping(const char *cipher, const char *name,
.offset = sector, .offset = sector,
.iv_offset = 0, .iv_offset = 0,
.size = 0, .size = 0,
.flags = (mode == O_RDONLY) ? CRYPT_ACTIVATE_READONLY : 0 .flags = 0
}; };
dmd.flags = CRYPT_ACTIVATE_PRIVATE;
if (mode == O_RDONLY)
dmd.flags |= CRYPT_ACTIVATE_READONLY;
/* /*
* we need to round this to nearest multiple of the underlying * we need to round this to nearest multiple of the underlying
* device's sector size, otherwise the mapping will be refused. * device's sector size, otherwise the mapping will be refused.