/bootable/libbootloader/gbl/libbootconfig/src/ |
D | lib.rs | 46 const BOOTCONFIG_TRAILER_SIZE: usize = 4 + 4 + BOOTCONFIG_MAGIC.len(); 51 if buffer.len() < BOOTCONFIG_TRAILER_SIZE { in new() 62 .len() in remaining_capacity() 98 if self.remaining_capacity() < config.len() { in add() 102 out[..config.len()].clone_from_slice(config.as_bytes()); in add() 103 Ok(config.len()) in add() 119 trailer[8..][..BOOTCONFIG_MAGIC.len()].clone_from_slice(BOOTCONFIG_MAGIC.as_bytes()); in update_trailer() 136 for val in &bytes[..bytes.len().checked_sub(BOOTCONFIG_TRAILER_SIZE).unwrap()] { in fmt() 146 out.get_mut(..s.len()) in write_str() 149 Ok(s.len()) in write_str() [all …]
|
/bootable/libbootloader/gbl/libfdt/src/ |
D | lib.rs | 57 match FdtHeader::from_bytes_ref(fdt)?.totalsize() <= fdt.len() { in fdt_check_header() 75 name.len().try_into().map_err(|_| FdtError::IntegerOverflow)?, in fdt_add_subnode() 92 name.len().try_into().map_err(|_| FdtError::IntegerOverflow)?, in fdt_subnode_offset() 174 let mut len: core::ffi::c_int = 0; in get_property() localVariable 181 &mut len as *mut _, in get_property() 190 u32::from_be(v.len).try_into().map_err(|_| FdtError::IntegerOverflow)?, in get_property() 193 _ => Err(map_result(len).unwrap_err()), in get_property() 201 if name.len() == 0 { in find_node() 219 fdt.as_mut().len().try_into().map_err(|_| FdtError::IntegerOverflow)?, in new_from_init() 222 let new_size: u32 = fdt.as_mut().len().try_into().map_err(|_| FdtError::IntegerOverflow)?; in new_from_init() [all …]
|
/bootable/libbootloader/gbl/third_party/libzbi/src/ |
D | lib.rs | 142 if payload.len() < item_payload_len { in parse() 223 if buffer.len() < core::mem::size_of::<ZbiHeader>() in new() 224 || buffer.len() - core::mem::size_of::<ZbiHeader>() < payload_len in new() 354 if length > payload.len() { in parse() 385 fn set_payload_length_usize(&mut self, len: usize) -> ZbiResult<()> { in set_payload_length_usize() 386 if self.buffer.len() < len { in set_payload_length_usize() 389 self.header.length = u32::try_from(len).map_err(|_| ZbiError::PlatformBadLength)?; in set_payload_length_usize() 390 self.payload_length = len; in set_payload_length_usize() 458 if self.buffer.len() < align_payload_offset { in get_next_payload() 507 self.get_next_payload()?[..payload.len()].copy_from_slice(payload); in create_entry_with_payload() [all …]
|
/bootable/libbootloader/gbl/efi/src/ |
D | android_boot.rs | 134 usize_roundup(hdr.bytes().len(), hdr.page_size)?, in load_android_simple() 139 usize_roundup(hdr.bytes().len(), hdr._base.page_size)?, in load_android_simple() 170 let off = load.len().checked_sub(kernel_size).ok_or_else(|| EfiAppError::BufferTooSmall)?; in load_android_simple() 253 let max_size = core::cmp::min(sz.try_into().unwrap(), out.len()); in load_android_simple() 261 .len()) in load_android_simple() 267 ramdisk_load_curr = usize_add(ramdisk_load_curr, bootconfig_builder.config_bytes().len())?; in load_android_simple() 283 let ramdisk_end: u64 = ramdisk_addr + u64::try_from(ramdisk_load_buffer.len()).unwrap(); in load_android_simple() 308 all_cmdline.iter().for_each(|v| all_cmdline_len += v.len()); in load_android_simple() 312 cmdline_payload[cmdline_payload_off..][..ele.len()].clone_from_slice(ele.as_bytes()); in load_android_simple() 313 cmdline_payload_off += ele.len(); in load_android_simple() [all …]
|
D | net.rs | 132 let mut recv_size = self.rx_frame.len(); in receive() 189 _ if *self.curr < self.tx_frames.len() => { 201 fn consume<R, F>(mut self, len: usize, f: F) -> R in consume() 216 let result = f(&mut unsafe { send_buffer.as_mut() }.unwrap()[..len]); in consume() 231 send_buffer.as_mut().unwrap().get_mut(..len).unwrap(), in consume() 366 if recv_size == out.len() { in receive_exact() 383 if sent_size == data.len() && self.get_socket().send_queue() == 0 { in send_exact() 390 if self.get_socket().can_send() && sent_size < data.len() { in send_exact()
|
/bootable/recovery/otautil/include/otautil/ |
D | print_sha1.h | 25 static std::string print_sha1(const uint8_t* sha1, size_t len) { in print_sha1() argument 28 for (size_t i = 0; i < len; ++i) { in print_sha1() 43 [[maybe_unused]] static std::string print_hex(const uint8_t* bytes, size_t len) { in print_hex() argument 44 return print_sha1(bytes, len); in print_hex()
|
/bootable/libbootloader/gbl/libfastboot/src/ |
D | lib.rs | 150 match out.len() < packet_size { in receive_packet() 161 &mut u64::try_from(packet.len()) in send_packet() 504 .checked_sub(data.len().try_into().map_err(|_| "")?) in upload() 556 assert_eq!(data.len(), 12); in with_mock_upload_builder() 558 sent += data.len() in with_mock_upload_builder() 561 buffer[sent - 12..][..data.len()].clone_from_slice(data); in with_mock_upload_builder() 562 sent += data.len(); in with_mock_upload_builder() 653 Ok(size) if size > remains.len() => { in process_next_packet() 736 return transport.send_packet(fastboot_okay!(res, "{:#x}", self.download_buffer.len())); in get_var() 768 f(MAX_DOWNLOAD_SIZE_NAME, &[], snprintf!(size_str, "{:#x}", self.download_buffer.len()))?; in get_var_all_with_native() [all …]
|
/bootable/libbootloader/gbl/libgbl/src/fastboot/ |
D | sparse.rs | 183 let buffer_len = to_u64(buffer.len())?; in write_sparse_image() 212 let aligned_len = self.buffer.len() - (self.buffer.len() % size_of::<u32>()); in get() 285 let mut out = vec![0u8; 2 * raw.len()]; in test_sparse_write() 288 out[off.try_into().unwrap()..][..data.len()].clone_from_slice(data); in test_sparse_write() 292 raw.len().try_into().unwrap() in test_sparse_write() 294 assert_eq!(out[..raw.len()].to_vec(), raw); in test_sparse_write() 302 let mut out = vec![0u8; 2 * raw.len()]; in test_sparse_write_non_default_block_size() 305 out[off.try_into().unwrap()..][..data.len()].clone_from_slice(data); in test_sparse_write_non_default_block_size() 309 raw.len().try_into().unwrap() in test_sparse_write_non_default_block_size() 311 assert_eq!(out[..raw.len()].to_vec(), raw); in test_sparse_write_non_default_block_size()
|
D | vars.rs | 53 Ok((name == self.0).then_some(snprintf!(out, "{}", self.1).len())) in get() 83 PARTITION_SIZE => Some(snprintf!(out, "{:#x}", gbl_fb.partition_io(part).size()).len()), in get() 84 PARTITION_TYPE => Some(snprintf!(out, "raw").len()), // Image type not supported yet. in get() 147 Some(snprintf!(out, "{:#x}", val).len()) in get()
|
/bootable/libbootloader/gbl/libefi/src/protocol/ |
D | device_path.rs | 77 let mut len: usize = 0; in new() localVariable 79 while unsafe { *text.add(len) } != 0 { in new() 80 len += 1; in new() 84 text: Some(unsafe { core::slice::from_raw_parts(text, len) }), in new() 153 assert_eq!(traces.borrow_mut().free_pool_trace.inputs.len(), 0); in test_device_path_text_null()
|
/bootable/libbootloader/gbl/libboot/src/ |
D | x86.rs | 194 assert!(cmdline_start + cmdline.len() <= 0x0A0000); in boot_linux_bzimage() 197 let cmdline_buffer = unsafe { from_raw_parts_mut(cmdline_start as *mut _, cmdline.len()) }; in boot_linux_bzimage() 204 from_raw_parts_mut(LOAD_ADDR_HIGH as *mut u8, kernel[boot_sector_size..].len()) in boot_linux_bzimage() 217 bootparam_fixup.setup_header_mut().cmdline_size = cmdline.len().try_into().unwrap(); in boot_linux_bzimage() 223 ramdisk.len().try_into().map_err(|_| BootError::IntegerOverflow)?; in boot_linux_bzimage()
|
/bootable/deprecated-ota/applypatch/ |
D | applypatch.cpp | 138 size_t len = file_contents.data.size(); in WriteBufferToPartition() local 153 if (!android::base::WriteFully(fd, data + start, len - start)) { in WriteBufferToPartition() 154 PLOG(ERROR) << "Failed to write " << len - start << " bytes to \"" << partition << "\""; in WriteBufferToPartition() 190 start = len; in WriteBufferToPartition() 191 for (size_t p = 0; p < len; p += sizeof(buffer)) { in WriteBufferToPartition() 192 size_t to_read = len - p; in WriteBufferToPartition() 209 if (start == len) { in WriteBufferToPartition() 367 SinkFn sink = [&patched, &ctx](const unsigned char* data, size_t len) { in GenerateTarget() argument 368 SHA1_Update(&ctx, data, len); in GenerateTarget() 369 patched.data.insert(patched.data.end(), data, data + len); in GenerateTarget() [all …]
|
D | imgpatch.cpp | 82 &ret, &sink](const uint8_t* data, size_t len) -> size_t { in ApplyBSDiffPatchAndStreamOutput() argument 84 strm.avail_in = len; in ApplyBSDiffPatchAndStreamOutput() 90 if (actual_target_length + len < expected_target_length) { in ApplyBSDiffPatchAndStreamOutput() 109 actual_target_length += len; in ApplyBSDiffPatchAndStreamOutput() 110 return len; in ApplyBSDiffPatchAndStreamOutput()
|
/bootable/libbootloader/gbl/libstorage/src/ |
D | testlib.rs | 95 && matches!(is_aligned(buffer.len().into(), self.block_size().into()), Ok(true)) in check_alignment() 127 num_blocks: u64::try_from(self.storage.len()).unwrap() / self.block_size, in info() 181 true => buffer.clone_from_slice(&self.storage[offset..][..buffer.len()]), in check_status() 182 _ => self.storage[offset..][..buffer.len()].clone_from_slice(buffer), in check_status() 253 Self::Data(slice) => slice.len(), in size() 399 assert!(storage.len() % (self.block_size as usize) == 0); in build() 414 assert!(name.len() < GPT_NAME_LEN_U16); 424 let delta = (block_size - store.len() % block_size) % block_size; in pad_to_block_size() 447 assert!(partitions.len() <= gpt_max_entries); in partitions_to_disk_data() 448 let entry_blocks: u64 = ((SafeNum::from(partitions.len()) * std::mem::size_of::<GptEntry>()) in partitions_to_disk_data() [all …]
|
D | lib.rs | 446 check_gpt_rw_params(gpt_buffer, part_name, offset, out.len()) in read_gpt_partition() 469 check_gpt_rw_params(gpt_buffer, part_name, offset, data.len()) in write_gpt_partition() 525 if scratch.len() < required_scratch_size(io, max_entries)? { in with_partitioned_scratch() 556 debug_assert!(is_aligned(buffer.len().into(), block_size)?); in check_range() 559 let blk_count = SafeNum::from(buffer.len()) / block_size; in check_range() 589 let aligned_read: usize = SafeNum::from(out.len()).round_down(block_size).try_into()?; in read_aligned_offset_and_buffer() 602 unaligned.clone_from_slice(&block_scratch[..unaligned.len()]); in read_aligned_offset_and_buffer() 626 min(offset.round_up(blk_io.block_size()).try_into()?, (offset + out.len()).try_into()?); in read_aligned_buffer() 629 if aligned_relative_offset < out.len() { in read_aligned_buffer() 642 (SafeNum::from(out.len()) - aligned_relative_offset).try_into()?; in read_aligned_buffer() [all …]
|
D | gpt.rs | 89 c if c.len_utf8() <= buffer[index..].len() => { in name_to_str() 90 index += c.encode_utf8(&mut buffer[index..]).len() in name_to_str() 176 || buffer.len() < Self::required_buffer_size(max_entries)? in new_from_buffer() 445 dev.scratch = vec![0u8; dev.scratch.len() - 1]; in test_gpt_buffer_too_small() 464 dev.io.storage[disk.len() - 512..].fill(0); in test_load_gpt_primary() 513 dev.io.storage[512..512 + primary_header.len()].clone_from_slice(&primary_header); in test_load_gpt_incorrect_magic() 549 dev.io.storage[block_size..block_size + primary_header.len()] in test_load_gpt_non_max_entries() 553 dev.io.storage[disk.len() - block_size..].fill(0); in test_load_gpt_non_max_entries() 584 let mut actual_boot_a = vec![0u8; expect_boot_a.len()]; in test_gpt_read() 585 let mut actual_boot_b = vec![0u8; expect_boot_b.len()]; in test_gpt_read() [all …]
|
/bootable/recovery/ |
D | recovery-persist.cpp | 92 const char *buf, size_t len, in logsave() argument 98 std::string buffer(buf, len); in logsave() 105 return len; in logsave() 188 size_t len = 0; in main() local 190 while ((read = getline(&line, &len, fp)) != -1) { in main()
|
D | interlace-frames.py | 38 assert len(frames) > 0, "Must have at least one input frame." 43 assert len(sizes) == 1, "All input images must have the same size." 45 N = len(frames)
|
/bootable/recovery/fuse_sideload/ |
D | fuse_sideload.cpp | 98 static void fuse_reply(const fuse_data* fd, uint64_t unique, const void* data, size_t len) { in fuse_reply() argument 100 hdr.len = len + sizeof(hdr); in fuse_reply() 108 vec[1].iov_len = len; in fuse_reply() 295 outhdr.len = sizeof(outhdr) + size; in handle_read() 416 ssize_t len = TEMP_FAILURE_RETRY(read(fd.ffd, request_buffer, sizeof(request_buffer))); in run_fuse_sideload() local 417 if (len == -1) { in run_fuse_sideload() 426 if (static_cast<size_t>(len) < sizeof(fuse_in_header)) { in run_fuse_sideload() 427 fprintf(stderr, "request too short: len=%zd\n", len); in run_fuse_sideload() 477 outhdr.len = sizeof(outhdr); in run_fuse_sideload()
|
/bootable/recovery/tests/manual/ |
D | recovery_test.cpp | 39 const char *buf, size_t len, void *arg) { in __pmsg_fn() argument 44 EXPECT_EQ(kInjectTxtContent.size(), len); in __pmsg_fn() 46 return len; in __pmsg_fn()
|
/bootable/libbootloader/gbl/libmisc/src/ |
D | lib.rs | 131 bcb.command[..command.len()].copy_from_slice(command.as_bytes()); in test_bcb_with_wrong_command_failed() 140 bcb.command[..command.len()].copy_from_slice(command.as_bytes()); in test_bcb_to_recovery_parsed() 152 bcb.command[..command.len()].copy_from_slice(command.as_bytes()); in test_bcb_to_fastboot_parsed_as_recovery() 164 bcb.command[..command.len()].copy_from_slice(command.as_bytes()); in test_bcb_to_bootloader_once_parsed()
|
/bootable/deprecated-ota/edify/ |
D | expr.cpp | 131 int len = argv[i]->end - argv[i]->start; in AssertFn() local 132 state->errmsg = "assert failed: " + state->script.substr(argv[i]->start, len); in AssertFn() 358 std::vector<std::string>* args, size_t start, size_t len) { in ReadArgs() argument 362 if (start + len > argv.size()) { in ReadArgs() 365 for (size_t i = start; i < start + len; ++i) { in ReadArgs() 384 std::vector<std::unique_ptr<Value>>* args, size_t start, size_t len) { in ReadValueArgs() argument 388 if (len == 0 || start + len > argv.size()) { in ReadValueArgs() 391 for (size_t i = start; i < start + len; ++i) { in ReadValueArgs()
|
/bootable/recovery/update_verifier/ |
D | care_map_generator.py | 45 assert len(lines) % step == 0, \ 46 "line count must be multiple of {}: {}".format(step, len(lines)) 49 for index in range(0, len(lines), step):
|
/bootable/recovery/recovery_utils/include/recovery_utils/ |
D | logging.h | 41 ssize_t logbasename(log_id_t id, char prio, const char* filename, const char* buf, size_t len, 44 ssize_t logrotate(log_id_t id, char prio, const char* filename, const char* buf, size_t len,
|
/bootable/recovery/recovery_utils/ |
D | logging.cpp | 88 size_t len, void* arg) { in logbasename() argument 94 return len; in logbasename() 97 ssize_t logrotate(log_id_t id, char prio, const char* filename, const char* buf, size_t len, in logrotate() argument 101 return __android_log_pmsg_file_write(id, prio, filename, buf, len); in logrotate() 110 return __android_log_pmsg_file_write(id, prio, filename, buf, len); in logrotate() 130 return __android_log_pmsg_file_write(id, prio, name.c_str(), buf, len); in logrotate()
|