Re: [PATCH bpf-next 16/17] selftests/bpf: add iterators tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 02, 2023 at 03:50:14PM -0800, Andrii Nakryiko wrote:

SNIP

> +
> +SEC("raw_tp")
> +__success
> +int iter_pass_iter_ptr_to_subprog(const void *ctx)
> +{
> +	int arr1[16], arr2[32];
> +	struct bpf_iter it;
> +	int n, sum1, sum2;
> +
> +	MY_PID_GUARD();
> +
> +	/* fill arr1 */
> +	n = ARRAY_SIZE(arr1);
> +	bpf_iter_num_new(&it, 0, n);
> +	fill(&it, arr1, n, 2);
> +	bpf_iter_num_destroy(&it);
> +
> +	/* fill arr2 */
> +	n = ARRAY_SIZE(arr2);
> +	bpf_iter_num_new(&it, 0, n);
> +	fill(&it, arr2, n, 10);
> +	bpf_iter_num_destroy(&it);
> +
> +	/* sum arr1 */
> +	n = ARRAY_SIZE(arr1);
> +	bpf_iter_num_new(&it, 0, n);
> +	sum1 = sum(&it, arr1, n);
> +	bpf_iter_num_destroy(&it);
> +
> +	/* sum arr2 */
> +	n = ARRAY_SIZE(arr2);
> +	bpf_iter_num_new(&it, 0, n);
> +	sum1 = sum(&it, arr2, n);
> +	bpf_iter_num_destroy(&it);
> +
> +	bpf_printk("sum1=%d, sum2=%d", sum1, sum2);

got to remove this to compile it, debug leftover?

jirka

> +
> +	return 0;
> +}
> +
> +char _license[] SEC("license") = "GPL";

SNIP



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux