/* This function walks the UBIFS index, calculates its size and checks that the size is equivalent to @idx_size. Returns zero in case of success and a negative error code in case of failure.  */
int dbg_check_idx_size(struct ubifs_info *c, long long idx_size)
/* This function walks the UBIFS index, calculates its size and checks that the size is equivalent to @idx_size. Returns zero in case of success and a negative error code in case of failure.  */
int dbg_check_idx_size(struct ubifs_info *c, long long idx_size)
{
	int err;
	long long calc = 0;
	if (!dbg_is_chk_index(c))
		return 0;
	err = dbg_walk_index(c, NULL, add_size, &calc);
	if (err) {
		ubifs_err(c, "error %d while walking the index", err);
		return err;
	}
	if (calc != idx_size) {
		ubifs_err(c, "index size check failed: calculated size is %lld, should be %lld",
			  calc, idx_size);
		dump_stack();
		return -EINVAL;
	}
	return 0;
}