/* Called from syscall or from eBPF program */
static void *array_map_lookup_elem(struct bpf_map *map, void *key)
{
	struct bpf_array *array = container_of(map, struct bpf_array, map);
	u32 index = *(u32 *)key;

	if (unlikely(index >= array->map.max_entries))
		return NULL;

	#ifdef CONFIG_HIVE
	/* here array->shadow_data equals map->shadow_data */
	if (map->is_aggregated && map->shadow_data)
		return map->shadow_data + array->elem_size * 
			(index & array->index_mask);
	else {
	return array->value + (u64)array->elem_size * (index & array->index_mask);
	}
	#else
	return array->value + (u64)array->elem_size * (index & array->index_mask);
	#endif
}