static int _compare_integrity_devices(struct crypt_device *cd,
			       const struct dm_target *src,
			       const struct dm_target *tgt)
{
	/*
	 * some parameters may be implicit (and set in dm-integrity ctor)
	 *
	 *	journal_size
	 *	journal_watermark
	 *	journal_commit_time
	 *	buffer_sectors
	 *	interleave_sectors
	 */

	/* check remaining integer values that makes sense */
	if (src->u.integrity.tag_size	  != tgt->u.integrity.tag_size ||
	    src->u.integrity.offset	  != tgt->u.integrity.offset   ||
	    src->u.integrity.sector_size  != tgt->u.integrity.sector_size) {
		log_dbg(cd, "Integer parameters do not match.");
		return -EINVAL;
	}

	if (crypt_strcmp(src->u.integrity.integrity,	     tgt->u.integrity.integrity) ||
	    crypt_strcmp(src->u.integrity.journal_integrity, tgt->u.integrity.journal_integrity) ||
	    crypt_strcmp(src->u.integrity.journal_crypt,     tgt->u.integrity.journal_crypt)) {
		log_dbg(cd, "Journal parameters do not match.");
		return -EINVAL;
	}

	/* unfortunately dm-integrity doesn't support keyring */
	if (_compare_volume_keys(src->u.integrity.vk, 0, tgt->u.integrity.vk, 0) ||
	    _compare_volume_keys(src->u.integrity.journal_integrity_key, 0, tgt->u.integrity.journal_integrity_key, 0) ||
	    _compare_volume_keys(src->u.integrity.journal_crypt_key, 0, tgt->u.integrity.journal_crypt_key, 0)) {
		log_dbg(cd, "Journal keys do not match.");
		return -EINVAL;
	}

	/* unsupported underneath dm-crypt with auth. encryption */
	if (src->u.integrity.meta_device || tgt->u.integrity.meta_device)
		return -ENOTSUP;

	if (src->size != tgt->size) {
		log_dbg(cd, "Device size parameters do not match.");
		return -EINVAL;
	}

	if (device_is_identical(src->data_device, tgt->data_device) <= 0) {
		log_dbg(cd, "Data devices do not match.");
		return -EINVAL;
	}

	return 0;
}
static int _compare_integrity_devices(struct crypt_device *cd,
			       const struct dm_target *src,
			       const struct dm_target *tgt)
{
	 

	 
	if (src->u.integrity.tag_size	  != tgt->u.integrity.tag_size ||
	    src->u.integrity.offset	  != tgt->u.integrity.offset   ||
	    src->u.integrity.sector_size  != tgt->u.integrity.sector_size) {
		log_dbg(cd, "Integer parameters do not match.");
		return -EINVAL;
	}

	if (crypt_strcmp(src->u.integrity.integrity,	     tgt->u.integrity.integrity) ||
	    crypt_strcmp(src->u.integrity.journal_integrity, tgt->u.integrity.journal_integrity) ||
	    crypt_strcmp(src->u.integrity.journal_crypt,     tgt->u.integrity.journal_crypt)) {
		log_dbg(cd, "Journal parameters do not match.");
		return -EINVAL;
	}

	 
	if (_compare_volume_keys(src->u.integrity.vk, 0, tgt->u.integrity.vk, 0) ||
	    _compare_volume_keys(src->u.integrity.journal_integrity_key, 0, tgt->u.integrity.journal_integrity_key, 0) ||
	    _compare_volume_keys(src->u.integrity.journal_crypt_key, 0, tgt->u.integrity.journal_crypt_key, 0)) {
		log_dbg(cd, "Journal keys do not match.");
		return -EINVAL;
	}

	 
	if (src->u.integrity.meta_device || tgt->u.integrity.meta_device)
		return -ENOTSUP;

	if (src->size != tgt->size) {
		log_dbg(cd, "Device size parameters do not match.");
		return -EINVAL;
	}

	if (device_is_identical(src->data_device, tgt->data_device) <= 0) {
		log_dbg(cd, "Data devices do not match.");
		return -EINVAL;
	}

	return 0;
}