-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libbpf-rs aims to be a convenient but thin wrapper around libbpf functionality. Not all functionality provided of libbpf is exposed through its API. This can quickly become a blocker if, say, some getter is not hooked up, but the value required to perform an operation. In the spirit of being a thin wrapper, it makes sense for us to provide access to the underlying libbpf objects. When nothing else is available, these can be used directly in conjunction with libbpf-sys to, effectively, write Rust-syntax C code. So far we have provided very ad-hoc accessor methods for retrieving pointers to the underlying libbpf objects. With this change we formalize this approach some more, by introducing the AsLibbpfObject trait and implementing it for major libbpf-rs types. Using a trait is not the only possible way. We could also continue that path we were on earlier where relevant types had custom named accessors without a common trait (e.g., Map::as_libbpf_bpf_map_ptr). The benefits a trait brings to the table is that it unifies naming and makes it reasonably easy to get an overview of types that have libbpf counterparts. The risk is that we may have to adjust the trait signature in one way or another if a newly added type has different constraints (e.g., if a libbpf-rs object has a potentially-NULL libbpf object). Signed-off-by: Daniel Müller <[email protected]>
- Loading branch information
Showing
13 changed files
with
108 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters