Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

cargo xtask improvements #1741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
phip1611 wants to merge 2 commits into main from improve-cargo-xtask
Closed

cargo xtask improvements #1741

phip1611 wants to merge 2 commits into main from improve-cargo-xtask

Conversation

Copy link
Member

@phip1611 phip1611 commented Aug 15, 2025

Prerequisite for #1699 where I want to use

#[repr(C, align(4))]
pub struct IpAddress(pub [u8; 16]);

in uefi-raw.

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

This helps to better understand why something fails.
check-raw is very strict. Relaxing it gives uefi-raw more
freedom, which is especially needed for the more high-level
IpAddress type changes.
Copy link
Member

nicholasbishop commented Aug 15, 2025
edited
Loading

Can you say more about why the IpAddress type needs align(4)? The current definition as a union is intentionally done that way to match edk2 and the UEFI spec. (Note that the spec briefly describes it under data types in a way that sounds like it's just a [u8; 16] buffer, but it's later fully defined in a kind of hidden spot under EFI_PXE_BASE_CODE_PROTOCOL as a union.) There are two issues with it being a [u8; 16] wrapper:

Copy link
Member Author

phip1611 commented Aug 15, 2025
edited
Loading

Ah, interesting. I actually wanted to make it a struct and drop the union. If always all bytes are initialized, some things get much easier. But I didn't know the problem with packed wrappers.

Counter idea: we keep the union but make the fields private. Via a public constructor we can ensure that always all bytes are initialized, even for v4 addresses.

What do you think about this?

Copy link
Member

I think uefi-raw is the wrong place for that abstraction, it should simply match the C API as close as possible and be public. In uefi, we should drop IpAddress and replace with core::net::IpAddr as discussed in #1575.

Copy link
Member Author

it should simply match the C API

While I definitely see this as perfectly fine for the majority of the code base, I believe that this may be a valid exception. Preventing undefined bytes here would be a low-hanging fruit.

I don't have a very strong opinion, but a tendency. Let me continue my "experiments" to simplify and improve the network code and then I'd leave some more comments on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /