Re: [PATCH bpf-next 2/2] selftests/bpf: add inline assembly helpers to access array elements

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

 



On 1/3/24 14:51, Andrii Nakryiko wrote:
+
+/*
+ * Helper to load and run a program.
+ * Call must define skel, map_elems, and bss_elems.
+ * Destroy the skel when you're done.
+ */
+#define load_and_run(PROG) ({
does this have to be a macro? Can you write it as a function?

can do.  (if we keep these patches).

i used a macro for the ## PROG below, but i can do something with ints and switches to turn on the autoload for a single prog. or just copy-paste the boilerplate.

+       int err;                                                        \
+       skel = array_elem_test__open();                                 \
+       if (!ASSERT_OK_PTR(skel, "array_elem_test open"))               \
+               return;                                                 \
+       bpf_program__set_autoload(skel->progs.x_ ## PROG, true);        \

thanks,

barret






[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