Skip to content

Commit 8af965e

Browse files
committed
Avoid generating bindings for non-perf types and constants
The current way of generating bindings via bindgen creates entries for any type or constant that is reachable when including the headers listed in wrapper.h. In addition to the perf-related structs we care about, this includes: - A variety of unrelated kernel API types - A bunch of constants used as implementation details for making ioctls - A constant for every single syscall number - ... and more besides There is no reason to include these in the generated bindings. Once present, however, removing or changing them becomes a breaking change. This is a one-shot change that changes the generation to only keep the relevant structs. This is a breaking change and would require a perf-event-open-sys2 v6.0.0.
1 parent 4cb9fa1 commit 8af965e

4 files changed

Lines changed: 11 additions & 971 deletions

File tree

perf-event-open-sys/regenerate.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ function gen_bindings {
9393
--impl-debug
9494
--with-derive-default
9595
--no-prepend-enum-name
96+
97+
# This ends up being a needless changed line when updating bindgen
98+
# versions.
99+
--disable-header-comment
100+
101+
--allowlist-var 'PERF_.*'
102+
--allowlist-var '__NR_perf_event_open'
103+
--allowlist-var '[A-Z]+_NS_INDEX'
104+
--allowlist-var 'HW_BREAKPOINT_[A-Z0-9_]+'
105+
106+
--allowlist-type 'perf_.*'
96107
)
97108

98109
bindgen "${BINDGEN_ARGS[@]}" \

0 commit comments

Comments
 (0)