| ... | @@ -235,9 +235,7 @@ pub const BootServices = extern struct { | ... | @@ -235,9 +235,7 @@ pub const BootServices = extern struct { |
| 235 | InvalidParameter, | 235 | InvalidParameter, |
| 236 | }; | 236 | }; |
| 237 | | 237 | |
| 238 | pub const NumHandlesError = uefi.UnexpectedError || error{ | 238 | pub const NumHandlesError = uefi.UnexpectedError; |
| 239 | OutOfResources, | | |
| 240 | }; | | |
| 241 | | 239 | |
| 242 | pub const LocateHandleError = uefi.UnexpectedError || error{ | 240 | pub const LocateHandleError = uefi.UnexpectedError || error{ |
| 243 | BufferTooSmall, | 241 | BufferTooSmall, |
| ... | @@ -702,8 +700,17 @@ pub const BootServices = extern struct { | ... | @@ -702,8 +700,17 @@ pub const BootServices = extern struct { |
| 702 | &len, | 700 | &len, |
| 703 | null, | 701 | null, |
| 704 | )) { | 702 | )) { |
| 705 | .success => return @divExact(len, @sizeOf(Handle)), | 703 | // If len is zero, it should return not_found, otherwise buffer_too_small. |
| 706 | .out_of_resources => return error.OutOfResources, | 704 | // This is because it can/should only return success when a valid buffer is |
| | 705 | // passed with a non zero size, which is not the case. |
| | 706 | // Thus this status is considered unreachable and will return error.Unexpected |
| | 707 | // .success => unreachable, |
| | 708 | .buffer_too_small => return @divExact(len, @sizeOf(uefi.Handle)), |
| | 709 | .not_found => return 0, |
| | 710 | // This function accounts for all possible causes of this error code |
| | 711 | // as per the most recent UEFI spec 2.10A, therefore this branch is |
| | 712 | // considered unreachable and will return error.Unexpected instead |
| | 713 | // .invalid_parameter => unreachable |
| 707 | else => |status| return uefi.unexpectedStatus(status), | 714 | else => |status| return uefi.unexpectedStatus(status), |
| 708 | } | 715 | } |
| 709 | } | 716 | } |