Lines Matching refs:ZbiError

57 type ZbiResult<T> = Result<T, ZbiError>;
138 let (hdr, payload) = Ref::<B, ZbiHeader>::new_from_prefix(buffer).ok_or(ZbiError::Error)?; in parse()
141 usize::try_from(hdr.length).map_err(|_| ZbiError::PlatformBadLength)?; in parse()
143 return Err(ZbiError::TooBig); in parse()
170 Err(ZbiError::BadMagic) in is_valid()
172 Err(ZbiError::BadVersion) in is_valid()
176 Err(ZbiError::BadCrc) in is_valid()
226 return Err(ZbiError::TooBig); in new()
233 u32::try_from(payload_len).map_err(|_| ZbiError::PlatformBadLength)?; in new()
236 Ref::<B, ZbiHeader>::new_from_prefix(buffer).ok_or(ZbiError::Error)?; in new()
288 .map_err(|_| ZbiError::PlatformBadLength)?, in construct()
326 return Err(ZbiError::Truncated); in is_bootable()
333 Some(_) => Err(ZbiError::IncompleteKernel), in is_bootable()
334 None => Err(ZbiError::Truncated), in is_bootable()
351 Ref::<B, ZbiHeader>::new_from_prefix(buffer).ok_or(ZbiError::Error)?; in parse()
353 let length: usize = header.length.try_into().map_err(|_| ZbiError::TooBig)?; in parse()
355 return Err(ZbiError::Truncated); in parse()
359 return Err(ZbiError::BadType); in parse()
361 return Err(ZbiError::BadMagic); in parse()
363 return Err(ZbiError::BadVersion); in parse()
366 return Err(ZbiError::BadCrc); in parse()
387 return Err(ZbiError::Truncated); in set_payload_length_usize()
389 self.header.length = u32::try_from(len).map_err(|_| ZbiError::PlatformBadLength)?; in set_payload_length_usize()
455 .ok_or(ZbiError::LengthOverflow)? in get_next_payload()
457 .ok_or(ZbiError::LengthOverflow)?; in get_next_payload()
459 return Err(ZbiError::TooBig); in get_next_payload()
561 return Err(ZbiError::Crc32NotSupported); in create_entry()
569 .ok_or(ZbiError::LengthOverflow)? in create_entry()
571 .ok_or(ZbiError::LengthOverflow)?; in create_entry()
619 .ok_or(ZbiError::LengthOverflow)?; in extend()
621 return Err(ZbiError::TooBig); in extend()
668 self.state = Err(ZbiError::Truncated); in next()
946 type Error = ZbiError;
982 _ => Err(ZbiError::BadType), in try_from()
1133 pub enum ZbiError { enum
1162 impl Display for ZbiError { implementation
1165 ZbiError::Error => "Generic error", in fmt()
1166 ZbiError::BadType => "Bad type", in fmt()
1167 ZbiError::BadMagic => "Bad magic", in fmt()
1168 ZbiError::BadVersion => "Bad version", in fmt()
1169 ZbiError::BadCrc => "Bad CRC", in fmt()
1170 ZbiError::BadAlignment => "Bad Alignment", in fmt()
1171 ZbiError::Truncated => "Truncaded error", in fmt()
1172 ZbiError::TooBig => "Too big", in fmt()
1173 ZbiError::IncompleteKernel => "Incomplete Kernel", in fmt()
1174 ZbiError::PlatformBadLength => "Bad ZBI length for this platform", in fmt()
1175 ZbiError::Crc32NotSupported => "CRC32 is not supported yet", in fmt()
1176 ZbiError::LengthOverflow => "Length type overflow", in fmt()
1190 return Err(ZbiError::TooBig); in get_align_buffer_offset()
1201 _ => Err(ZbiError::BadAlignment), in is_zbi_aligned()
1353 Err(ZbiError::TooBig) in zbi_test_item_new_too_small()
1369 Err(ZbiError::BadAlignment) in zbi_test_item_new_not_aligned()
1423 assert_eq!(ZbiContainer::new(&mut buffer.0[..ZBI_HEADER_SIZE - 1]), Err(ZbiError::TooBig)); in zbi_test_container_new_too_small()
1432 Err(ZbiError::BadAlignment) in zbi_test_container_new_unaligned()
1475 assert_eq!(ZbiContainer::parse(&buffer.0[..]), Err(ZbiError::BadType)) in zbi_test_container_parse_bad_type()
1496 assert_eq!(ZbiContainer::parse(&buffer.0[..]), Err(ZbiError::BadMagic)) in zbi_test_container_parse_bad_magic()
1517 assert_eq!(ZbiContainer::parse(&buffer.0[..]), Err(ZbiError::BadVersion)) in zbi_test_container_parse_bad_version()
1538 assert_eq!(ZbiContainer::parse(&buffer.0[..]), Err(ZbiError::BadCrc)) in zbi_test_container_parse_bad_crc32()
1559 assert_eq!(ZbiContainer::parse(&buffer.0[..]), Err(ZbiError::BadCrc)) in zbi_test_container_parse_entries_bad_magic()
1606 assert_eq!(ZbiContainer::parse(&buffer.0[offset..]), Err(ZbiError::BadAlignment)); in zbi_test_container_parse_unaligned()
1622 assert_eq!(ZbiContainer::parse(&*buffer), Err(ZbiError::Truncated)); in zbi_test_container_parse_without_last_padding_fail_truncated()
1634 assert_eq!(ZbiContainer::parse(&buffer[..buffer.len() - 1]), Err(ZbiError::Truncated)); in zbi_test_container_parse_error_payload_truncated()
1646 assert_eq!(ZbiContainer::parse(&buffer[..buffer.len() - 1]), Err(ZbiError::Truncated)); in zbi_test_container_parse_error_truncated()
1661 assert_eq!(ZbiContainer::parse(&buffer.0[..]), Err(ZbiError::BadMagic)); in zbi_test_container_parse_bad_first_entry_marked()
1674 assert_eq!(ZbiContainer::parse(&buffer.0[..]), Err(ZbiError::BadMagic)); in zbi_test_container_parse_bad_entry_magic()
1687 assert_eq!(ZbiContainer::parse(&buffer.0[..]), Err(ZbiError::BadVersion)); in zbi_test_container_parse_bad_entry_version()
1702 assert_eq!(ZbiContainer::parse(&buffer.0[..]), Err(ZbiError::BadCrc)); in zbi_test_container_parse_bad_entry_crc()
1734 Err(ZbiError::Crc32NotSupported) in zbi_test_container_new_entry_crc32_not_supported()
1764 Err(ZbiError::TooBig) in zbi_test_container_new_entry_no_space_left()
1784 Err(ZbiError::TooBig) in zbi_test_container_new_entry_no_space_for_header()
1804 Err(ZbiError::TooBig) in zbi_test_container_new_entry_no_space_for_payload()
1858 Err(ZbiError::TooBig) in zbi_test_container_new_entry_payload_too_big()
1888 Err(ZbiError::TooBig) in zbi_test_container_new_entry_no_space_left_unaligned()
1967 assert_eq!(container_full.extend(&container), Err(ZbiError::TooBig)); in zbi_test_container_extend_full()
1991 assert_eq!(container_small.extend(&container), Err(ZbiError::TooBig)); in zbi_test_container_extend_1_byte_short()
2120 assert_eq!(container.get_next_payload(), Err(ZbiError::TooBig)); in zbi_test_container_get_next_paylad_header_cant_fit()
2132 assert_eq!(container.get_next_payload(), Err(ZbiError::LengthOverflow)); in zbi_test_container_get_next_paylad_length_overflow()
2305 assert_eq!(ZbiType::try_from(0), Err(ZbiError::BadType)); in zbi_test_bad_type()
2417 assert_eq!(container.is_bootable(), Err(ZbiError::Truncated)); in zbi_test_is_bootable_empty_container()
2431 assert_eq!(container.is_bootable(), Err(ZbiError::IncompleteKernel)); in zbi_test_is_bootable_wrong_arch()
2446 assert_eq!(container.is_bootable(), Err(ZbiError::IncompleteKernel)); in zbi_test_is_bootable_not_first_item_fail()
2615 let e = ZbiError::Error; in zbi_test_zbi_error()
2641 assert_eq!(align_buffer(&buffer.0[1..ZBI_ALIGNMENT_USIZE - 1]), Err(ZbiError::TooBig)); in zby_test_container_align_buffer_too_short()