/* Only to be used on 8-bit arrays. array_len is actual len in bytes (not encoded le_value_length). buf is null-terminated.  */
static int zap_leaf_array_equal(zap_leaf_phys_t *l, zfs_endian_t endian, int blksft, int chunk, int array_len, const char *buf)
/* Only to be used on 8-bit arrays. array_len is actual len in bytes (not encoded le_value_length). buf is null-terminated.  */
static int zap_leaf_array_equal(zap_leaf_phys_t *l, zfs_endian_t endian, int blksft, int chunk, int array_len, const char *buf)
{
	int bseen = 0;
	while (bseen < array_len) {
		struct zap_leaf_array *la = &ZAP_LEAF_CHUNK(l, blksft, chunk).l_array;
		int toread = min(array_len - bseen, ZAP_LEAF_ARRAY_BYTES);
		if (chunk >= ZAP_LEAF_NUMCHUNKS(blksft))
			return 0;
		if (memcmp(la->la_array, buf + bseen, toread) != 0)
			break;
		chunk = zfs_to_cpu16(la->la_next, endian);
		bseen += toread;
	}
	return (bseen == array_len);
}