Refactor MCTP relay boilerplate into macro, clarify result nomenclature#673
Merged
williampMSFT merged 10 commits intoOpenDevicePartnership:v0.2.0from Jan 13, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the MCTP relay boilerplate into a reusable macro and standardizes nomenclature to distinguish "Result" (the generic Result enum type) from "Response" (the success case of a Result). The macro consolidates repetitive code for generating relay types across different message services.
Changes:
- Introduced
impl_odp_mctp_relay_types!macro to generate ODP MCTP relay boilerplate from service specifications - Renamed
SerializableResponsetoSerializableResultthroughout the codebase - Renamed
HostResponsetoHostResultand related types/functions - Added type aliases (
AcpiBatteryResult,ThermalResult,DebugResult) for service result types
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| embedded-service/src/relay/mod.rs | Added impl_odp_mctp_relay_types! macro to generate MCTP relay types; renamed SerializableResponse to SerializableResult |
| espi-service/src/mctp.rs | Replaced manual type definitions with macro invocation for Battery, Thermal, and Debug services |
| espi-service/src/espi_service.rs | Updated type names from HostResponse to HostResult and HostResponseMessage to HostResultMessage; renamed function try_route_request_to_comms to send_to_comms |
| battery-service-messages/src/lib.rs | Added AcpiBatteryResult type alias for Result<AcpiBatteryResponse, AcpiBatteryError> |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Merged
kurtjd
approved these changes
Jan 12, 2026
tullom
approved these changes
Jan 13, 2026
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.
This change factors out the boilerplate associated with generating relay types from the information about the set of types that are to be relayed. This should enable easier bringup of additional message relay services (e.g. UART).
In the course of this work, I noticed that some of the nomenclature around results vs responses was a bit conflicting in the relay code, so also standardized that on Result meaning 'a specific generic type of the Result enum' and Response meaning 'the success case of a Result'.