mctp-linux: Use rustix rather than libc#58
Merged
Merged
Conversation
Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
rustix provides higher level wrappers for syscalls, reducing unsafe code. This removes the libc dependency from mctp-linux, and rustix compiles to direct syscalls for slightly smaller code size. rustix is already an indirect dependency from async-io. No functional change expected. Signed-off-by: Matt Johnston <matt@codeconstruct.com.au>
jk-ozlabs
reviewed
Jul 13, 2026
| pub const MCTP_NET_ANY: u32 = 0x00; | ||
|
|
||
| /// Address information for a socket | ||
| pub struct MctpSockAddr(sockaddr_mctp); |
Member
There was a problem hiding this comment.
Given we're now only using sockaddr_mctp within with_sockaddr and From <SocketAddrAny>, should we decouple these types?
I assume that MctpSockAddr would then just have the network, addr, type, and tag, and doesn't need to share layout with the C struct any more. We'd create the struct sockaddr_mctp as needed.
Not sure if that's worth the churn though.
Member
Author
There was a problem hiding this comment.
Might leave it for now. It's all internal API so we can change it later.
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.
rustix provides higher level wrappers for syscalls, reducing unsafe code.
This removes the libc dependency from mctp-linux, and rustix compiles to
direct syscalls for slightly smaller code size. rustix is already an
indirect dependency from async-io.
No functional change expected.