On Tue, 2024-05-28 at 15:18 -0700, Andrii Nakryiko wrote: [...] > Speaking of which, for the next revision, can you also integrate all > these new APIs into bpftool to handle the problem that Jose tried to > solve? This might also expose any of the potential issues with API > usage. Hi Andrii, Good foresight requesting to re-implement Jose's patch on top of the new API. I did the changes you requested for v1 + tried to make the bpftool changes, results are here: https://github.com/eddyz87/bpf/tree/libbpf-sort-for-dump-api-2 The attempt falls flat for the following pattern: #define __pai __attribute__((preserve_access_index)) typedef struct { int x; } foo __pai; With the following clang error: t.c:2:31: error: 'preserve_access_index' attribute only applies to structs, unions, and classes 2 | typedef struct { int x; } foo __pai; The correct syntax for this definition is as below: typedef struct { int x; } __pai foo; This cannot be achieved unless printing of typedefs is done by some custom code in bpftool. So, it looks like we won't be able to ditch callbacks in the end. Maybe the code for emit queue could be salvaged for the module thing you talked about, please provide a bit more context about it. Thanks, Eduard