Skip to content

UEFI File interface partially unusable #23436

Description

@truemedian

Zig Version

0.15.0-dev.171+1b62a2226

Steps to Reproduce and Observed Behavior

File.open only allows specifying the modes read, write, or create. However these enumerations are for the individual bitfield values, and UEFI only allows specifying read, read|write or read|write|create.

File.getInfo and File.setInfo use the size of the struct, however Info.File, Info.FileSystem, and Info.VolumeLabel are all structs that have a variable width string appended to the end, so @sizeOf does not provide the real size of the data. This means that getInfo will always return Error.BufferTooSmall and setInfo will always return Error.BadBufferSize.

Expected Behavior

File.open's OpenMode should probably just provide enumerations for read, read|write and read|write|create.

File.getInfo needs to accept a buffer large than the Info.* struct, the helper method to read the attached string already exists.

File.setInfo needs to accept an Info.* larger than @sizeOf that struct. A helper method should likely be added to help construct these types.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavioros-uefiUnified Extensible Firmware Interfacestandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions