Skip to content
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: some inflateRawTypes simplifications #1173

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Oct 18, 2023

btf: remove fixupAndAssert

fixupAndAssert in inflateRawTypes is used to assert that a Type value has a
certain concrete type. The only use is validating that Func.Type is a
FuncProto so that a later check of Func.Type can type assert without error
checking. This is a bad idea since understanding why the assertion is safe 
now requires understanding how types are inflated.

Remove fixupAndAssert and instead check for errors during the type
assertion.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>

btf: rename maxTypeDepth to maxResolveDepth

Rename the constant and document where it originates. The previous name is
misleading since vmlinux BTF does contain types which are nested more deeply
than 32 items at the moment.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>

fixupAndAssert in inflateRawTypes is used to assert that a Type
value has a certain concrete type. The only use is validating
that Func.Type is a FuncProto so that a later check of Func.Type
can type assert without error checking.
This is a bad idea since understanding why the assertion is safe
now requires understanding how types are inflated.

Remove fixupAndAssert and instead check for errors during the
type assertion.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Rename the constant and document where it originates. The previous
name is misleading since vmlinux BTF does contain types which are
nested more deeply than 32 items at the moment.

Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
@lmb lmb marked this pull request as ready for review October 18, 2023 15:41
@lmb lmb merged commit 8d9fd33 into cilium:main Oct 18, 2023
12 checks passed
@lmb lmb deleted the inflate-raw-simplifications branch October 18, 2023 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant