libbpf-rs icon indicating copy to clipboard operation
libbpf-rs copied to clipboard

Exposing btf module

Open zyy17 opened this issue 3 years ago • 3 comments

In current implementation, the btf mod is private. I think it would be helpful if we expose btf module.

I found the similar PR but closed for some reason: https://github.com/libbpf/libbpf-rs/pull/62/files#diff-fa4e7373a6c4a1948a89dc3be8086e734bea95eb7a4f5c5f24d7bd24feb73988. I think move the btf code to libbpf-rs and make it public is the good idea.

zyy17 avatar Apr 18 '22 14:04 zyy17

@anakryiko had a comment there "Will this API still make sense if/when we add support for libbpf's BTF writing APIs? I'm worried a bit that we are exposing these types a bit too early. And that they are sufficiently different from what libbpf. Do you think that will cause problems down the line?"

Do you know when we plan to add BTF writing APIs to libbpf @anakryiko?

insearchoflosttime avatar Apr 19 '22 02:04 insearchoflosttime

libbpf has BTF writing APIs already. This is more of a question of designing Rust API and/or wrappers that would use and expose libbpf's struct btf/struct btf_type/etc. So we'd need someone with a pretty good grasp of Rust (with all the lifetime magic and stuff like that) to design and implement this properly, I think.

anakryiko avatar Apr 19 '22 23:04 anakryiko

I forget exactly what I was trying to do at the time, but IIRC I thought making btf module public would help.

I probably found another way. I also seem to remember the BTF API needed some cleaning up before I was comfortable making it public. Probably wasn’t a very well thought out public API.

On Mon, Apr 18, 2022, at 7:48 AM, Yong wrote:

In current implementation, the btf mod is private https://github.com/libbpf/libbpf-rs/blob/master/libbpf-cargo/src/lib.rs#L67. I think it would be helpful if we expose btf module.

I found the similar PR but closed for some reason: https://github.com/libbpf/libbpf-rs/pull/62/files#diff-fa4e7373a6c4a1948a89dc3be8086e734bea95eb7a4f5c5f24d7bd24feb73988. I think move the btf code to libbpf-rs and make it public is the good idea.

— Reply to this email directly, view it on GitHub https://github.com/libbpf/libbpf-rs/issues/219, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGJKJYZYOBD2OXARZPXU3DVFVY3FANCNFSM5TWBMJXA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Daniel Xu @.***

danobi avatar Apr 20 '22 05:04 danobi

This should have been addressed by https://github.com/libbpf/libbpf-rs/pull/390. Thanks @mendess for getting this done!

Edit: That's for reading. I don't believe OP was asking about writing.

danielocfb avatar Mar 30 '23 20:03 danielocfb