Skip to content

mctp-linux: Use rustix rather than libc#58

Merged
mkj merged 2 commits into
CodeConstruct:mainfrom
mkj:pr/rustix
Jul 13, 2026
Merged

mctp-linux: Use rustix rather than libc#58
mkj merged 2 commits into
CodeConstruct:mainfrom
mkj:pr/rustix

Conversation

@mkj

@mkj mkj commented Jul 13, 2026

Copy link
Copy Markdown
Member

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.

mkj added 2 commits July 13, 2026 13:06
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>
Comment thread mctp-linux/src/lib.rs
pub const MCTP_NET_ANY: u32 = 0x00;

/// Address information for a socket
pub struct MctpSockAddr(sockaddr_mctp);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might leave it for now. It's all internal API so we can change it later.

@mkj mkj merged commit 574e3a9 into CodeConstruct:main Jul 13, 2026
3 checks passed
@mkj mkj deleted the pr/rustix branch July 13, 2026 08:58
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.

2 participants