-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
btf: export API to create BTF from scratch #859
Merged
Merged
Conversation
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
lmb
force-pushed
the
btf-spec-add
branch
3 times, most recently
from
November 20, 2022 15:49
f6e716d
to
575c5e9
Compare
lmb
force-pushed
the
btf-spec-add
branch
3 times, most recently
from
December 6, 2022 20:05
4db9fb3
to
1859ea6
Compare
ti-mo
reviewed
Dec 8, 2022
ti-mo
reviewed
Dec 15, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only nits, awesome stuff!
lmb
force-pushed
the
btf-spec-add
branch
2 times, most recently
from
December 17, 2022 11:02
ddd087a
to
cdaa93d
Compare
ti-mo
approved these changes
Dec 23, 2022
lmb
force-pushed
the
btf-spec-add
branch
3 times, most recently
from
January 13, 2023 20:01
2e537f2
to
9bf579e
Compare
We want to allow creating Spec from scratch, without starting from an ELF. In such cases it's a waste to maintaing a string table. Return an error in code paths that rely on Spec.strings to not be nil. Signed-off-by: Lorenz Bauer <oss@lmb.io>
Export Spec.Add which adds a Type to a Spec. It's then possible to create BTF on-the-fly like so: spec := NewSpec() id, err := spec.Add(...) handle, err := NewHandle(&spec) Spec.Add is responsible for allocating type IDs, which makes the BTF encoder a lot simpler. Attempting to create a Handle from a Spec that doesn't contain all types will return an error. This can happen if a Type is modified after it has been added to a Spec. Signed-off-by: Lorenz Bauer <oss@lmb.io>
Signed-off-by: Lorenz Bauer <oss@lmb.io>
Replace the bare-bones marshalBTF with marshalTypes, but avoid calling NewHandle to prevent circular dependencies. Signed-off-by: Lorenz Bauer <oss@lmb.io>
lmb
commented
Jan 13, 2023
tpapagian
added a commit
to cilium/tetragon
that referenced
this pull request
Apr 6, 2023
Want to include cilium/ebpf#859 Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
tpapagian
added a commit
to cilium/tetragon
that referenced
this pull request
Apr 7, 2023
Want to include cilium/ebpf#859 go get github.com/cilium/ebpf@master Signed-off-by: Anastasios Papagiannis <tasos.papagiannnis@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Spec.Add, which allows creating BTF on the fly from outside of the btf package.