-
Notifications
You must be signed in to change notification settings - Fork 251
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
Implement query for lirc programs #32
Conversation
Fixes #2 |
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.
Thanks for this! Overall I like this approach and I think it will work for other programs as well.
b35522d
to
d2c911f
Compare
aya/src/programs/mod.rs
Outdated
pub struct ProgramInfo(bpf_prog_info); | ||
|
||
impl ProgramInfo { | ||
pub fn name(&self) -> Option<String> { |
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.
Shouldn't this return &[u8]? It's valid for the name not to be utf8, I think callers should (optionally) do the conversion here
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.
Shouldn't this return &[u8]? It's valid for the name not to be utf8, I think callers should (optionally) do the conversion here
I just realised that we use String for program names everywhere else so I'm leaving this up to you, I'm ok with either
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.
So we have both of them now as an option: fn name() which gives you &[u8]
and fn name_as_str() which returns Option<&str>
.
@@ -533,3 +579,24 @@ impl_try_from_program!( | |||
CgroupSkb, | |||
LircMode2 | |||
); | |||
|
|||
pub struct ProgramInfo(bpf_prog_info); |
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.
Can you add some docs for the struct and the accessors please?
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.
I've added some rustdoc (a bit rudimentary)
Signed-off-by: Sean Young <sean@mess.org>
thank you! |
Signed-off-by: Sean Young sean@mess.org