Skip to content

patina_smbios: Use zerocopy::IntoBytes for SMBIOS record serialization#1451

Merged
kat-perez merged 1 commit intoOpenDevicePartnership:mainfrom
kat-perez:smbios-macro-zerocopy
Apr 6, 2026
Merged

patina_smbios: Use zerocopy::IntoBytes for SMBIOS record serialization#1451
kat-perez merged 1 commit intoOpenDevicePartnership:mainfrom
kat-perez:smbios-macro-zerocopy

Conversation

@kat-perez
Copy link
Copy Markdown
Contributor

@kat-perez kat-perez commented Apr 2, 2026

Description

Replace the primitive type whitelist in the SmbiosRecord derive macro with zerocopy::IntoBytes::as_bytes(). The macro no longer validates field types at expansion time — instead, any type that implements IntoBytes is accepted, with type checking deferred to the compiler.

This means new SMBIOS field types (enums, bitfields, etc.) can be added by deriving IntoBytes without modifying the macro.

Re-export zerocopy from patina_smbios so consuming crates don't need a direct dependency.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

  • cargo make all passes
  • Updated macro proc tests to verify new behavior
  • Existing SMBIOS record serialization tests pass unchanged

Integration Instructions

SMBIOS record fields must implement zerocopy::IntoBytes. All primitive types already do. Custom types need #[derive(IntoBytes)] with an appropriate #[repr(...)].

@github-actions github-actions bot added the impact:testing Affects testing label Apr 2, 2026
@patina-automation
Copy link
Copy Markdown
Contributor

patina-automation bot commented Apr 2, 2026

✅ QEMU Validation Passed

All QEMU validation jobs completed successfully.

Note: Q35 is only built on Windows hosts (QEMU boot is disabled due to a QEMU vfat issue).

Workflow run: https://github.com/OpenDevicePartnership/patina/actions/runs/23960751784

Boot Time to EFI Shell

Platform Elapsed
Q35 (Linux Host) 28.0s
SBSA (Linux Host) 1m 10s

Dependencies

Repository Ref
patina 82b8f1c
patina-dxe-core-qemu 8a232bb
patina-fw-patcher b08d6ff
patina-qemu firmware v3.0.0
patina-qemu build script b2bf562

This comment was automatically generated by the Patina QEMU PR Validation Post workflow.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kat-perez kat-perez force-pushed the smbios-macro-zerocopy branch from b524c98 to be8e6dd Compare April 2, 2026 19:39
@kat-perez kat-perez marked this pull request as ready for review April 2, 2026 19:44
@kat-perez kat-perez force-pushed the smbios-macro-zerocopy branch 2 times, most recently from 732fc76 to 4a0a26d Compare April 2, 2026 20:59
@kat-perez kat-perez force-pushed the smbios-macro-zerocopy branch 3 times, most recently from d10f11e to a4bf89b Compare April 3, 2026 19:42
Replace the hardcoded type name list in the SmbiosRecord derive macro
with zerocopy::IntoBytes::as_bytes(). Any type that implements IntoBytes
can now be used as an SMBIOS record field without modifying the macro.
@kat-perez kat-perez force-pushed the smbios-macro-zerocopy branch from a4bf89b to 82b8f1c Compare April 3, 2026 20:05
@kat-perez kat-perez merged commit 0f014bc into OpenDevicePartnership:main Apr 6, 2026
10 checks passed
@kat-perez kat-perez deleted the smbios-macro-zerocopy branch April 6, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:testing Affects testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants