int crypt_set_data_device(struct crypt_device *cd, const char *device)
{
	/* metadata device must be set */
	if (!cd || !cd->device || !device)
		return -EINVAL;

	log_dbg(cd, "Setting ciphertext data device to %s.", device ?: "(none)");

	if (!isLUKS1(cd->type) && !isLUKS2(cd->type) && !isVERITY(cd->type) &&
	    !isINTEGRITY(cd->type) && !isTCRYPT(cd->type)) {
		log_err(cd, _("This operation is not supported for this device type."));
		return -EINVAL;
	}

	if (isLUKS2(cd->type) && crypt_get_luks2_reencrypt(cd)) {
		log_err(cd, _("Illegal operation with reencryption in-progress."));
		return -EINVAL;
	}

	return _crypt_set_data_device(cd, device);
}
int crypt_set_data_device(struct crypt_device *cd, const char *device)
{
	 
	if (!cd || !cd->device || !device)
		return -EINVAL;

	log_dbg(cd, "Setting ciphertext data device to %s.", device ?: "(none)");

	if (!isLUKS1(cd->type) && !isLUKS2(cd->type) && !isVERITY(cd->type) &&
	    !isINTEGRITY(cd->type) && !isTCRYPT(cd->type)) {
		log_err(cd, _("This operation is not supported for this device type."));
		return -EINVAL;
	}

	if (isLUKS2(cd->type) && crypt_get_luks2_reencrypt(cd)) {
		log_err(cd, _("Illegal operation with reencryption in-progress."));
		return -EINVAL;
	}

	return _crypt_set_data_device(cd, device);
}