Skip to content

Conversation

@dotcarmen
Copy link
Contributor

@dotcarmen dotcarmen commented Apr 2, 2025

#23214 has a few glitches, this is a PR fixing one of them :)

there were 3 issues with File as pointed out by #23436:

File.open

in the spec, the OpenMode argument can only be read, read|write, or read|write|execute. However, currently the interface only allows read, write, and execute. This PR addresses this problem:

  • defined an auxiliary type OpenMode.Bits which provides a bitfield representing those values from the spec
  • OpenMode's enum tags are renamed to read, read_write, and read_write_create for better clarity
  • OpenMode's enum values are implemented by bitcasting OpenMode.Bits values

File.getInfo

The file info buffer should be larger than @sizeOf(Info.*), because Info.* types have an attached null-terminated string at the end.

This method now requires the user to pass in a buffer which will contain the resulting info type.

To better align with the pattern being established in #23441, this function's return type is now struct { usize, ?*Payload }.

File.setInfo

The len accounting as-is is wrong. It should account for the length of the attached null-terminated string.

closes #23436

@linusg
Copy link
Collaborator

linusg commented Apr 2, 2025

Gonna wait a bit before merging so @truemedian can review this too.

Copy link
Contributor

@truemedian truemedian left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me other than a few nitpicks that are unrelated to fixing the original issue.

@linusg linusg merged commit 84c9cee into ziglang:master Apr 4, 2025
33 of 36 checks passed
@linusg
Copy link
Collaborator

linusg commented Apr 4, 2025

Oops, I meant to do a squash merge - apologies.

@dotcarmen dotcarmen deleted the fix-uefi-file branch April 4, 2025 13:57
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.

UEFI File interface partially unusable

3 participants