Allow callers to create VariableSpecs#1882
Merged
ti-mo merged 2 commits intocilium:mainfrom Dec 1, 2025
Merged
Conversation
5791c45 to
79f1b65
Compare
Contributor
Author
|
@ti-mo can you give this a review please? |
ti-mo
requested changes
Nov 3, 2025
Contributor
ti-mo
left a comment
There was a problem hiding this comment.
Thanks! I have some doubts around the caller having to manage .Value before using .Set and .Get, PTAL.
24dc2e3 to
081c036
Compare
081c036 to
582b855
Compare
582b855 to
d75f93b
Compare
Contributor
|
@lmb Please check my feedback commit and squash if okay. We need Size() and Constant() in Cilium, |
d75f93b to
ad3a9e9
Compare
VariableSpec is the only component of CollectionSpec with unexported fields. This makes it awkward to use during testing outside of package ebpf. Fix this by exporting and documenting the fields of variable spec. To achieve this, VariableSpec.Set doesn't immediately copy data into MapSpec.Contents. Instead VariableSpec.Value holds the marshaled data. The collection loader ensures that VariableSpec.Value is copied into MapSpec.Contents before loading. A nice side-effect is that this ends up creating a lot less copies of MapSpec.Contents. MapSpec uses uint32 to specify public sizes like ValueSize. This is because the kernel interfaces only allow specifying 32 bit quantities. Change the public API of VariableSpec and Variable to match this. Fixes: cilium#1868 Signed-off-by: Lorenz Bauer <lmb@isovalent.com> Co-authored-by: Timo Beckers <timo@isovalent.com>
MapSpec.dataSection() currently enforces the presence of BTF, even though the downstream code doesn't explicitly rely on it. Remove this restriction. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
ad3a9e9 to
51d805c
Compare
This file contains hidden or 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
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.
See the commit messages for details.
Fixes: #1868