| ... | ... | @@ -235,9 +235,7 @@ pub const BootServices = extern struct { |
| 235 | 235 | InvalidParameter, |
| 236 | 236 | }; |
| 237 | 237 | |
| 238 | | pub const NumHandlesError = uefi.UnexpectedError || error{ |
| 239 | | OutOfResources, |
| 240 | | }; |
| 238 | pub const NumHandlesError = uefi.UnexpectedError; |
| 241 | 239 | |
| 242 | 240 | pub const LocateHandleError = uefi.UnexpectedError || error{ |
| 243 | 241 | BufferTooSmall, |
| ... | ... | @@ -702,8 +700,17 @@ pub const BootServices = extern struct { |
| 702 | 700 | &len, |
| 703 | 701 | null, |
| 704 | 702 | )) { |
| 705 | | .success => return @divExact(len, @sizeOf(Handle)), |
| 706 | | .out_of_resources => return error.OutOfResources, |
| 703 | // If len is zero, it should return not_found, otherwise buffer_too_small. |
| 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 | 714 | else => |status| return uefi.unexpectedStatus(status), |
| 708 | 715 | } |
| 709 | 716 | } |