-
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: move Spec.Add to dedicated type #1069
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
commented
Jun 22, 2023
lmb
commented
Jun 22, 2023
lmb
commented
Jun 22, 2023
Share a single pool of bytes.Buffer across the whole library. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Allow specifying which ByteOrder to encode BTF into via a new field in marshalOptions. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Remove the dependency on the ELF string table to pre-size the string table builder for large Specs. Instead we use the heuristic that for vmlinux the number of strings is roughly equal to the number of types. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
rgo3
approved these changes
Jun 22, 2023
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, human linter goes brrr. Otherwise LGTM.
Spec allows both querying Types as well as constructing new BTF blobs via Add. This has some unfortunate consequences: we need to do extra work so that Added types can be queried and query code needs to be aware that the set of types can change. The query API also allows observing side-effects of adding types which we'd rather hide, for example when working around datasec bugs. It's also difficult to make the implementation efficient for both use cases at once. Split the code for constructing new BTF blobs into a separate struct. NewHandle now takes a Builder instead of a Spec which is a breaking change. Other API changes are to functions which have not appeared in a release yet. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
NewSpec was added to be able to create BTF from scratch using Spec.Add. This usecase was migrated to Builder and Spec.Add doesn't exist anymore. Unexport NewSpec so we can still use it for testing but users only experience API breakage once. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Extend the datasec validation workaround to all Datasec. This is safe to do because there are no methods on Builder which allow going from TypeID to Type. Signed-off-by: Lorenz Bauer <lmb@isovalent.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.
internal: add NewBuffer
btf: add marshalOptions.Order
btf: use number of types to pre-size string table
btf: refactor to Builder
btf: unexport NewSpec
btf: generalise datasecWorkaround to Builder.Add