uint64_t crypt_get_active_integrity_failures(struct crypt_device *cd, const char *name)
{
	struct crypt_dm_active_device dmd;
	uint64_t failures = 0;

	if (!name)
		return 0;

	/* LUKS2 / dm-crypt does not provide this count. */
	if (dm_query_device(cd, name, 0, &dmd) < 0)
		return 0;

	if (single_segment(&dmd) && dmd.segment.type == DM_INTEGRITY)
		(void)dm_status_integrity_failures(cd, name, &failures);

	dm_targets_free(cd, &dmd);

	return failures;
}
uint64_t crypt_get_active_integrity_failures(struct crypt_device *cd, const char *name)
{
	struct crypt_dm_active_device dmd;
	uint64_t failures = 0;

	if (!name)
		return 0;

	 
	if (dm_query_device(cd, name, 0, &dmd) < 0)
		return 0;

	if (single_segment(&dmd) && dmd.segment.type == DM_INTEGRITY)
		(void)dm_status_integrity_failures(cd, name, &failures);

	dm_targets_free(cd, &dmd);

	return failures;
}