DoxigAlpha

getInfo

If buffer is too small to contain all of the info, this function returns Error.BufferTooSmall. You should call getInfoSize first to determine how big the buffer should be to safely call this function.

Function parameters

Parameters

#
self:*const File
info:std.meta.Tag(Info)
buffer:[]align(@alignOf(@FieldType(Info, @tagName(info)))) u8

Type definitions in this namespace

Types

#

Source

Implementation

#
pub fn getInfo(
    self: *const File,
    comptime info: std.meta.Tag(Info),
    buffer: []align(@alignOf(@FieldType(Info, @tagName(info)))) u8,
) GetInfoError!*@FieldType(Info, @tagName(info)) {
    const InfoType = @FieldType(Info, @tagName(info));

    var len = buffer.len;
    switch (self._get_info(
        self,
        &InfoType.guid,
        &len,
        buffer.ptr,
    )) {
        .success => return @as(*InfoType, @ptrCast(buffer.ptr)),
        .buffer_too_small => return Error.BufferTooSmall,
        .unsupported => return Error.Unsupported,
        .no_media => return Error.NoMedia,
        .device_error => return Error.DeviceError,
        .volume_corrupted => return Error.VolumeCorrupted,
        else => |status| return uefi.unexpectedStatus(status),
    }
}