-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std.os.uefi.protocol: ziggify function signatures #23214
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,6 +13,8 @@ pub const DevicePath = extern struct { | |||||
subtype: u8, | ||||||
length: u16 align(1), | ||||||
|
||||||
pub const createFileDevicePathError = Allocator.Error; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
pub const guid align(8) = Guid{ | ||||||
.time_low = 0x09576e91, | ||||||
.time_mid = 0x6d3f, | ||||||
|
@@ -23,15 +25,15 @@ pub const DevicePath = extern struct { | |||||
}; | ||||||
|
||||||
/// Returns the next DevicePath node in the sequence, if any. | ||||||
pub fn next(self: *DevicePath) ?*DevicePath { | ||||||
pub fn next(self: *const DevicePath) ?*DevicePath { | ||||||
if (self.type == .end and @as(uefi.DevicePath.End.Subtype, @enumFromInt(self.subtype)) == .end_entire) | ||||||
return null; | ||||||
|
||||||
return @as(*DevicePath, @ptrCast(@as([*]u8, @ptrCast(self)) + self.length)); | ||||||
} | ||||||
|
||||||
/// Calculates the total length of the device path structure in bytes, including the end of device path node. | ||||||
pub fn size(self: *DevicePath) usize { | ||||||
pub fn size(self: *const DevicePath) usize { | ||||||
var node = self; | ||||||
|
||||||
while (node.next()) |next_node| { | ||||||
|
@@ -42,7 +44,7 @@ pub const DevicePath = extern struct { | |||||
} | ||||||
|
||||||
/// Creates a file device path from the existing device path and a file path. | ||||||
pub fn create_file_device_path(self: *DevicePath, allocator: Allocator, path: [:0]align(1) const u16) !*DevicePath { | ||||||
pub fn createFileDevicePath(self: *const DevicePath, allocator: Allocator, path: []const u16) !*DevicePath { | ||||||
const path_size = self.size(); | ||||||
|
||||||
// 2 * (path.len + 1) for the path and its null terminator, which are u16s | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ const Guid = uefi.Guid; | |
const Handle = uefi.Handle; | ||
const Status = uefi.Status; | ||
const cc = uefi.cc; | ||
const Error = Status.Error; | ||
|
||
/// EDID information for an active video output device | ||
pub const Active = extern struct { | ||
|
@@ -44,10 +45,19 @@ pub const Override = extern struct { | |
self: *const Override, | ||
handle: Handle, | ||
attributes: *Attributes, | ||
edid_size: *usize, | ||
edid: *?[*]u8, | ||
) Status { | ||
return self._get_edid(self, handle, attributes, edid_size, edid); | ||
) !?[]u8 { | ||
var size: usize = 0; | ||
var ptr: ?[*]u8 = null; | ||
Comment on lines
+49
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can use |
||
switch (self._get_edid(self, handle, attributes, &size, &ptr)) { | ||
.success => {}, | ||
.unsupported => return Error.Unsupported, | ||
else => |err| return uefi.unexpectedStatus(err), | ||
} | ||
|
||
if (size == 0 or ptr == null) | ||
return null; | ||
|
||
return ptr[0..size]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd assume this doesn't work as |
||
} | ||
|
||
pub const guid align(8) = Guid{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(same for a bunch more below)