r = dm_create_device(name, cd->device, dm_cipher ?: cipher, cd->type, uuid, size, skip, offset,
key_size, processed_key, read_only, reload);
+
+ if (isPLAIN(cd->type) && !uuid)
+ (void)dm_query_device(name, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, &cd->plain_uuid);
out:
free(dm_cipher);
crypt_safe_free(processed_key);
if (!cd->type || !crypt_get_uuid(cd))
return -EINVAL;
+ log_dbg("Resizing device %s to %" PRIu64 " sectors.", name, new_size);
+
r = dm_query_device(name, &device, &size, &skip, &offset,
&cipher, &key_size, &key, &read_only, NULL, &uuid);
if (r < 0) {
goto out;
}
- log_dbg("Resizing device %s to %" PRIu64 " sectors.", name, new_size);
-
r = dm_create_device(name, device, cipher, cd->type,
crypt_get_uuid(cd), new_size, skip, offset,
key_size, key, read_only, 1);
creates a mapping with <name> backed by device <device>.
\fB<options>\fR can be [\-\-hash, \-\-cipher, \-\-verify-passphrase,
-\-\-key-file, \-\-key-size, \-\-offset, \-\-skip, \-\-readonly]
+\-\-key-file, \-\-key-size, \-\-offset, \-\-skip, \-\-size, \-\-readonly]
.PP
\fIremove\fR <name>
.IP
CRYPT_ANY_SLOT, password, passwordLen,
opt_readonly ? CRYPT_ACTIVATE_READONLY : 0);
}
+
+ /* FIXME: workaround, new api missing format parameter for size.
+ * Properly fix it after bumping library version,
+ * add start_offset and size into "PLAIN" format specifiers.
+ */
+ if (r >= 0 && opt_size)
+ r = crypt_resize(cd, action_argv[0], opt_size);
+
out:
crypt_free(cd);
crypt_safe_free(password);
$CRYPTSETUP -q remove $DEV_NAME || fail
echo "key0" | $CRYPTSETUP -q create $DEV_NAME --hash sha1 $LOOPDEV || fail
$CRYPTSETUP -q remove $DEV_NAME || fail
+echo "key0" | $CRYPTSETUP -q create $DEV_NAME --hash sha1 --size 100 $LOOPDEV || fail
+$CRYPTSETUP -q status $DEV_NAME | grep "size:" | grep -q "100 sectors" || fail
+$CRYPTSETUP -q remove $DEV_NAME || fail
# verify is ignored on non-tty input
echo "key0" | $CRYPTSETUP create $DEV_NAME $LOOPDEV --hash sha1 --verify-passphrase || fail
$CRYPTSETUP -q remove $DEV_NAME || fail