Re: [PATCH bpf-next 4/4] selftests/bpf: test subskeleton functionality

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

 



On Wed, Mar 02, 2022 at 02:48:48AM +0000, Delyan Kratunov wrote:
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/subskeleton.c
> @@ -0,0 +1,38 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright (c) 2019 Facebook */
> +
> +#include <test_progs.h>
> +#include "test_subskeleton.skel.h"
> +
> +extern void subskeleton_lib_setup(struct bpf_object *obj);
> +extern int subskeleton_lib_subresult(struct bpf_object *obj);
> +
> +void test_subskeleton(void)
> +{
> +	int duration = 0, err, result;
> +	struct test_subskeleton *skel;
> +
> +	skel = test_subskeleton__open();
> +	if (CHECK(!skel, "skel_open", "failed to open skeleton\n"))
> +		return;
> +
> +	skel->rodata->rovar1 = 10;

The rodata vars in subskeleton will need extra '*', right?
The above is confusing to read comparing to below:

> +void subskeleton_lib_setup(struct bpf_object *obj)
> +{
> +	struct test_subskeleton_lib *lib = test_subskeleton_lib__open(obj);
> +
> +	ASSERT_OK_PTR(lib, "open subskeleton");
> +
> +	*lib->data.var1 = 1;
> +	*lib->bss.var2 = 2;
> +	lib->bss.var3->var3_1 = 3;
> +	lib->bss.var3->var3_2 = 4;
> +}

Could you add rodata to subskel as well?
Just to make it obvious that rodata is not special.

An example of generated skel in commit log would be great.



[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