Function setInfo [src]

Prototype

pub fn setInfo( self: *File, comptime info: std.meta.Tag(Info), data: *const @FieldType(Info, @tagName(info)), ) SetInfoError!void

Parameters

self: *Fileinfo: std.meta.Tag(Info)data: *const @FieldType(Info, @tagName(info))

Possible Errors

AccessDenied
BadBufferSize
DeviceError
NoMedia
Unexpected UnexpectedError
Unsupported
VolumeCorrupted
VolumeFull
WriteProtected

Source

pub fn setInfo( self: *File, comptime info: std.meta.Tag(Info), data: *const @FieldType(Info, @tagName(info)), ) SetInfoError!void { const InfoType = @FieldType(Info, @tagName(info)); const attached_str: [*:0]const u16 = switch (info) { .file => data.getFileName(), .file_system, .volume_label => data.getVolumeLabel(), }; const attached_str_len = std.mem.sliceTo(attached_str, 0).len; // add the length (not +1 for sentinel) because `@sizeOf(InfoType)` // already contains the first utf16 char const len = @sizeOf(InfoType) + (attached_str_len * 2); switch (self._set_info(self, &InfoType.guid, len, @ptrCast(data))) { .success => {}, .unsupported => return Error.Unsupported, .no_media => return Error.NoMedia, .device_error => return Error.DeviceError, .volume_corrupted => return Error.VolumeCorrupted, .write_protected => return Error.WriteProtected, .access_denied => return Error.AccessDenied, .volume_full => return Error.VolumeFull, .bad_buffer_size => return Error.BadBufferSize, else => |status| return uefi.unexpectedStatus(status), } }