mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
std/os/uefi: file protocol improvements
This commit is contained in:
parent
92beb13914
commit
f44530302e
@ -5,16 +5,16 @@ const Status = uefi.Status;
|
||||
|
||||
pub const FileProtocol = extern struct {
|
||||
revision: u64,
|
||||
_open: extern fn (*const FileProtocol, **const FileProtocol, *u16, u64, u64) Status,
|
||||
_open: extern fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) Status,
|
||||
_close: extern fn (*const FileProtocol) Status,
|
||||
_delete: extern fn (*const FileProtocol) Status,
|
||||
_read: extern fn (*const FileProtocol, *usize, *c_void) Status,
|
||||
_write: extern fn (*const FileProtocol, *usize, *c_void) Status,
|
||||
_read: extern fn (*const FileProtocol, *usize, [*]u8) Status,
|
||||
_write: extern fn (*const FileProtocol, *usize, [*]const u8) Status,
|
||||
_get_info: extern fn (*const FileProtocol, *Guid, *usize, *c_void) Status,
|
||||
_set_info: extern fn (*const FileProtocol, *Guid, usize, *c_void) Status,
|
||||
_set_info: extern fn (*const FileProtocol, *Guid, usize, *const c_void) Status,
|
||||
_flush: extern fn (*const FileProtocol) Status,
|
||||
|
||||
pub fn open(self: *const FileProtocol, new_handle: **const FileProtocol, file_name: *u16, open_mode: u64, attributes: u64) Status {
|
||||
pub fn open(self: *const FileProtocol, new_handle: **const FileProtocol, file_name: [*:0]const u16, open_mode: u64, attributes: u64) Status {
|
||||
return self._open(self, new_handle, file_name, open_mode, attributes);
|
||||
}
|
||||
|
||||
@ -26,11 +26,11 @@ pub const FileProtocol = extern struct {
|
||||
return self._delete(self);
|
||||
}
|
||||
|
||||
pub fn read(self: *const FileProtocol, buffer_size: *usize, buffer: *c_void) Status {
|
||||
pub fn read(self: *const FileProtocol, buffer_size: *usize, buffer: [*]u8) Status {
|
||||
return self._read(self, buffer_size, buffer);
|
||||
}
|
||||
|
||||
pub fn write(self: *const FileProtocol, buffer_size: *usize, buffer: *c_void) Status {
|
||||
pub fn write(self: *const FileProtocol, buffer_size: *usize, buffer: [*]const u8) Status {
|
||||
return self._write(self, buffer_size, buffer);
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ pub const FileProtocol = extern struct {
|
||||
return self._get_info(self, information_type, buffer_size, buffer);
|
||||
}
|
||||
|
||||
pub fn set_info(self: *const FileProtocol, information_type: *Guid, buffer_size: usize, buffer: *c_void) Status {
|
||||
pub fn set_info(self: *const FileProtocol, information_type: *Guid, buffer_size: usize, buffer: *const c_void) Status {
|
||||
return self._set_info(self, information_type, buffer_size, buffer);
|
||||
}
|
||||
|
||||
@ -76,7 +76,10 @@ pub const FileInfo = extern struct {
|
||||
last_access_time: Time,
|
||||
modification_time: Time,
|
||||
attribute: u64,
|
||||
file_name: [100:0]u16,
|
||||
|
||||
pub fn getFileName(self: *const FileInfo) [*:0]const u16 {
|
||||
return @ptrCast([*:0]const u16, @ptrCast([*]const u8, self) + @sizeOf(FileInfo));
|
||||
}
|
||||
|
||||
pub const efi_file_read_only: u64 = 0x0000000000000001;
|
||||
pub const efi_file_hidden: u64 = 0x0000000000000002;
|
||||
|
||||
@ -3,7 +3,7 @@ const Guid = uefi.Guid;
|
||||
const FileProtocol = uefi.protocols.FileProtocol;
|
||||
const Status = uefi.Status;
|
||||
|
||||
const SimpleFileSystemProtocol = extern struct {
|
||||
pub const SimpleFileSystemProtocol = extern struct {
|
||||
revision: u64,
|
||||
_open_volume: extern fn (*const SimpleFileSystemProtocol, **const FileProtocol) Status,
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user