-
Notifications
You must be signed in to change notification settings - Fork 711
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
internal/sys: add constants #1537
Conversation
@@ -227,7 +227,7 @@ func init() { | |||
} | |||
|
|||
// MapFlags document which flags may be feature probed. | |||
type MapFlags = sys.MapFlags |
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.
This is the breaking change the linter is complaining about. I don't think this should make a difference in practice.
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.
Nope, should be fine since external callers never had access to sys.MapFlags
anyway.
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.
One suggestion, looks fine otherwise!
bpf.h defines a bunch of constants as unnamed enums. This makes them tricky to pull out of vmlinux BTF, so instead we rely on the internal/unix shim. This causes a small maintenance burden whenever we need a new flag, but more importantly it makes some upcoming cross platform work harder. Pull the constant definitions out of vmlinux BTF instead of relying on package unix. Unfortunately a bunch of the flags are re-used. This is most noticeable for MapFlags, for which the enum in the kernel has become a bit of a grab bag. Instead of trying hard to wrap everything into a neat type we just generate untyped constants and get rid of MapFlags. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
Some constants in bpf.h are defined using the C preprocessor and are therefore not available in BTF. Add them manually. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
internal/sys: generate constants from unnamed enums
internal/sys: add DEFINEd constants