Home
last modified time | relevance | path

Searched refs:buffer (Results 1 – 25 of 52) sorted by relevance

123

/bootable/libbootloader/gbl/third_party/libzbi/src/
Dlib.rs78 pub fn align_buffer<B: ByteSlice>(buffer: B) -> ZbiResult<B> { in align_buffer()
79 let tail_offset = get_align_buffer_offset(&buffer[..])?; in align_buffer()
80 let (_, aligned_buffer) = buffer.split_at(tail_offset); in align_buffer()
135 pub fn parse(buffer: B) -> ZbiResult<(ZbiItem<B>, B)> { in parse()
136 is_zbi_aligned(&buffer)?; in parse()
138 let (hdr, payload) = Ref::<B, ZbiHeader>::new_from_prefix(buffer).ok_or(ZbiError::Error)?; in parse()
217 buffer: B, in new()
223 if buffer.len() < core::mem::size_of::<ZbiHeader>() in new()
224 || buffer.len() - core::mem::size_of::<ZbiHeader>() < payload_len in new()
229 is_zbi_aligned(&buffer)?; in new()
[all …]
/bootable/libbootloader/gbl/libbootconfig/src/
Dlib.rs36 buffer: &'a mut [u8], field
50 pub fn new(buffer: &'a mut [u8]) -> Result<Self> { in new()
51 if buffer.len() < BOOTCONFIG_TRAILER_SIZE { in new()
54 let mut ret = Self { current_size: 0, buffer: buffer }; in new()
61 self.buffer in remaining_capacity()
72 &self.buffer[..self.current_size.checked_add(BOOTCONFIG_TRAILER_SIZE).unwrap()] in config_bytes()
89 let size = reader(&mut self.buffer[self.current_size..][..remains])?; in add_with()
116 let trailer = &mut self.buffer[self.current_size..]; in update_trailer()
125 self.buffer[..self.current_size] in checksum()
213 let mut buffer = [0u8; TEST_CONFIG.len() + TEST_CONFIG_TRAILER.len()]; in test_add() localVariable
[all …]
/bootable/libbootloader/gbl/libefi/src/protocol/
Dblock_io.rs35 pub fn read_blocks(&self, lba: u64, buffer: &mut [u8]) -> EfiResult<()> { in read_blocks()
47 buffer.len(), in read_blocks()
48 buffer.as_mut_ptr() as *mut _ in read_blocks()
54 pub fn write_blocks(&self, lba: u64, buffer: &mut [u8]) -> EfiResult<()> { in write_blocks()
66 buffer.len(), in write_blocks()
67 buffer.as_mut_ptr() as _ in write_blocks()
Dsimple_text_output.rs54 let mut buffer = [0u16; 3]; in write_str() localVariable
55 let char16_msg = ch.encode_utf16(&mut buffer[..]); in write_str()
/bootable/libbootloader/gbl/libstorage/src/
Dnon_blocking.rs75 buffer: *mut [u8], in write_blocks()
101 buffer: *mut [u8], in read_blocks()
243 fn new(buffer: &'a mut [u8]) -> Self { in new()
244 Self(IoBufferState::Ready(buffer, IoStatus::Completed)) in new()
291 IoBufferState::Ready(buffer, _) => buffer, in get()
300 IoBufferState::Pending(buffer, ptr, _) => { in update()
309 self.0 = IoBufferState::Ready(unsafe { &mut **buffer }, v); in update()
319 IoBufferState::Ready(buffer, _) => { in take()
323 swap(&mut res, buffer); in take()
391 Some(buffer) => buffer.update(*io), in update_status()
[all …]
Dtestlib.rs93 fn check_alignment(&mut self, buffer: &[u8]) -> bool { in check_alignment()
94 matches!(is_buffer_aligned(buffer, self.alignment()), Ok(true)) in check_alignment()
95 && matches!(is_aligned(buffer.len().into(), self.block_size().into()), Ok(true)) in check_alignment()
135 buffer: *mut [u8], in write_blocks()
143 let buffer = unsafe { &mut *buffer }; in write_blocks() localVariable
144 assert!(self.check_alignment(buffer)); in write_blocks()
146 Some(NonBlockingIoState::Pending(query_timestamp(), blk_offset, buffer, false)); in write_blocks()
155 buffer: *mut [u8], in read_blocks()
163 let buffer = unsafe { &mut *buffer }; in read_blocks() localVariable
164 assert!(self.check_alignment(buffer)); in read_blocks()
[all …]
Dgpt.rs84 pub fn name_to_str<'a>(&self, buffer: &'a mut [u8]) -> Result<&'a str> { in name_to_str()
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()
98 unsafe { Ok(core::str::from_utf8_unchecked(&buffer[..index])) } in name_to_str()
174 pub(crate) fn new_from_buffer(max_entries: u64, buffer: &'a mut [u8]) -> Result<Gpt<'a>> { in new_from_buffer()
176 || buffer.len() < Self::required_buffer_size(max_entries)? in new_from_buffer()
180 let buffer = aligned_subslice(buffer, GPT_ENTRY_ALIGNMENT)?; in new_from_buffer() localVariable
181 *GptInfo::from_bytes(buffer) = in new_from_buffer()
183 Self::from_existing(buffer) in new_from_buffer()
191 pub fn from_existing(buffer: &'a mut [u8]) -> Result<Gpt<'a>> { in from_existing()
[all …]
/bootable/recovery/tests/unit/
Dpackage_test.cpp66 std::vector<uint8_t> buffer(file_content_.size()); in TEST_F() local
67 ASSERT_TRUE(package->ReadFullyAtOffset(buffer.data(), file_content_.size(), 0)); in TEST_F()
68 ASSERT_EQ(file_content_, std::string(buffer.begin(), buffer.end())); in TEST_F()
70 ASSERT_TRUE(package->ReadFullyAtOffset(buffer.data(), file_content_.size() - 10, 10)); in TEST_F()
71 ASSERT_EQ(file_content_.substr(10), std::string(buffer.begin(), buffer.end() - 10)); in TEST_F()
77 std::vector<uint8_t> buffer(file_content_.size()); in TEST_F() local
79 ASSERT_FALSE(package->ReadFullyAtOffset(buffer.data(), file_content_.size(), 10)); in TEST_F()
/bootable/deprecated-ota/updater/
Dblockimg.cpp223 static void allocate(size_t size, std::vector<uint8_t>* buffer) { in allocate() argument
225 if (size <= buffer->size()) return; in allocate()
226 buffer->resize(size); in allocate()
426 uint8_t buffer[buffer_size]; in receive_brotli_new_data() local
429 uint8_t* next_out = buffer; in receive_brotli_new_data()
445 if (nti->writer->Write(buffer, write_now) != write_now) { in receive_brotli_new_data()
482 static int ReadBlocks(const RangeSet& src, std::vector<uint8_t>* buffer, int fd) { in ReadBlocks() argument
490 if (!android::base::ReadFully(fd, buffer->data() + p, size)) { in ReadBlocks()
502 static int WriteBlocks(const RangeSet& tgt, const std::vector<uint8_t>& buffer, int fd) { in WriteBlocks() argument
515 if (!android::base::WriteFully(fd, buffer.data() + written, size)) { in WriteBlocks()
[all …]
Dcommands.cpp331 std::vector<uint8_t>* buffer, size_t block_size, in ReadAll() argument
334 if (buffer->size() < blocks() * block_size) { in ReadAll()
340 if (block_reader(ranges_, buffer) != 0) { in ReadAll()
344 MoveRange(buffer, location_, *buffer, block_size); in ReadAll()
354 MoveRange(buffer, stash.ranges(), stash_buffer, block_size); in ReadAll()
359 void SourceInfo::DumpBuffer(const std::vector<uint8_t>& buffer, size_t block_size) const { in DumpBuffer() argument
366 CHECK_LE((buffer_index + 1) * block_size, buffer.size()); in DumpBuffer()
369 SHA1(buffer.data() + buffer_index * block_size, block_size, digest); in DumpBuffer()
/bootable/deprecated-ota/applypatch/
Dapplypatch.cpp82 std::vector<unsigned char> buffer(partition.size); in ReadPartitionToBuffer() local
83 if (!android::base::ReadFully(dev, buffer.data(), buffer.size())) { in ReadPartitionToBuffer()
84 PLOG(ERROR) << "Failed to read " << buffer.size() << " bytes of data for partition " in ReadPartitionToBuffer()
87 SHA1(buffer.data(), buffer.size(), out->sha1); in ReadPartitionToBuffer()
89 out->data = std::move(buffer); in ReadPartitionToBuffer()
189 unsigned char buffer[4096]; in WriteBufferToPartition() local
191 for (size_t p = 0; p < len; p += sizeof(buffer)) { in WriteBufferToPartition()
193 if (to_read > sizeof(buffer)) { in WriteBufferToPartition()
194 to_read = sizeof(buffer); in WriteBufferToPartition()
197 if (!android::base::ReadFully(fd, buffer, to_read)) { in WriteBufferToPartition()
[all …]
/bootable/recovery/otautil/
Dpackage.cpp57 bool ReadFullyAtOffset(uint8_t* buffer, uint64_t byte_count, uint64_t offset) override;
105 bool ReadFullyAtOffset(uint8_t* buffer, uint64_t byte_count, uint64_t offset) override;
176 bool MemoryPackage::ReadFullyAtOffset(uint8_t* buffer, uint64_t byte_count, uint64_t offset) { in ReadFullyAtOffset() argument
182 memcpy(buffer, addr_ + offset, byte_count); in ReadFullyAtOffset()
227 bool FilePackage::ReadFullyAtOffset(uint8_t* buffer, uint64_t byte_count, uint64_t offset) { in ReadFullyAtOffset() argument
234 if (!android::base::ReadFullyAtOffset(fd_.get(), buffer, byte_count, offset)) { in ReadFullyAtOffset()
253 std::vector<uint8_t> buffer(read_size); in UpdateHashAtOffset() local
254 if (!ReadFullyAtOffset(buffer.data(), read_size, start + so_far)) { in UpdateHashAtOffset()
259 hasher(buffer.data(), read_size); in UpdateHashAtOffset()
/bootable/deprecated-ota/tests/unit/
Dcommands_test.cpp447 std::vector<uint8_t> buffer(source.blocks() * kBlockSize); in TEST() local
448 ASSERT_TRUE(source.ReadAll(&buffer, kBlockSize, block_reader, stash_reader)); in TEST()
449 ASSERT_EQ(source.blocks() * kBlockSize, buffer.size()); in TEST()
452 SHA1(buffer.data(), buffer.size(), digest); in TEST()
469 std::vector<uint8_t> buffer(source.blocks() * kBlockSize); in TEST() local
470 ASSERT_TRUE(source.ReadAll(&buffer, kBlockSize, block_reader, stash_reader)); in TEST()
471 ASSERT_EQ(source.blocks() * kBlockSize, buffer.size()); in TEST()
474 SHA1(buffer.data(), buffer.size(), digest); in TEST()
483 std::vector<uint8_t> buffer(source.blocks() * kBlockSize - 1); in TEST() local
484 ASSERT_FALSE(source.ReadAll(&buffer, kBlockSize, block_reader, stash_reader)); in TEST()
[all …]
/bootable/libbootloader/gbl/libgbl/src/fastboot/
Dsparse.rs172 let mut fill_buffer = FillBuffer { curr_val: None, curr_size: 0, buffer: fill_buffer }; in write_sparse_image()
182 let buffer = fill_buffer.get(v, sz)?; in write_sparse_image() localVariable
183 let buffer_len = to_u64(buffer.len())?; in write_sparse_image()
187 write(write_offset, &mut buffer[..to_usize(to_write).unwrap()])?; in write_sparse_image()
206 buffer: &'a mut [u8], field
212 let aligned_len = self.buffer.len() - (self.buffer.len() % size_of::<u32>()); in get()
219 let to_fill = &mut self.buffer[self.curr_size..][..gap]; in get()
222 Ok(&mut self.buffer[..size]) in get()
/bootable/recovery/minadbd/
Dfuse_adb_provider.cpp26 bool FuseAdbDataProvider::ReadBlockAlignedData(uint8_t* buffer, uint32_t fetch_size, in ReadBlockAlignedData() argument
33 if (!ReadFdExactly(fd_, buffer, fetch_size)) { in ReadBlockAlignedData()
/bootable/recovery/fuse_sideload/include/
Dfuse_provider.h44 virtual bool ReadBlockAlignedData(uint8_t* buffer, uint32_t fetch_size,
68 bool ReadBlockAlignedData(uint8_t* buffer, uint32_t fetch_size,
93 bool ReadBlockAlignedData(uint8_t* buffer, uint32_t fetch_size,
/bootable/libbootloader/gbl/libboot/src/
Dx86.rs79 pub fn from_bytes_ref(buffer: &[u8]) -> Result<&BootParams> { in from_bytes_ref()
80 Ok(Ref::<_, BootParams>::new_from_prefix(buffer) in from_bytes_ref()
87 pub fn from_bytes_mut(buffer: &mut [u8]) -> Result<&mut BootParams> { in from_bytes_mut()
88 Ok(Ref::<_, BootParams>::new_from_prefix(buffer) in from_bytes_mut()
/bootable/libbootloader/gbl/libefi/defs/protocols/
Dandroid_boot_protocol.h32 size_t* buffer_size, void* buffer);
34 size_t* buffer_size, const void* buffer);
Dblock_io_protocol.h31 size_t buffer_size, void* buffer);
33 size_t buffer_size, void* buffer);
/bootable/libbootloader/gbl/libgbl/src/slots/
Dpartition.rs49 fn validate<B: ByteSlice>(buffer: B) -> Result<Ref<B, Self>, MetadataParseError>; in validate()
109 buffer: B, in deserialize()
119 let (data, cache_status) = match MB::validate(buffer) { in deserialize()
/bootable/recovery/fuse_sideload/
Dfuse_provider.cpp57 bool FuseFileDataProvider::ReadBlockAlignedData(uint8_t* buffer, uint32_t fetch_size, in ReadBlockAlignedData() argument
68 if (!android::base::ReadFullyAtOffset(fd_, buffer, fetch_size, offset)) { in ReadBlockAlignedData()
93 bool FuseBlockDataProvider::ReadBlockAlignedData(uint8_t* buffer, uint32_t fetch_size, in ReadBlockAlignedData() argument
108 uint8_t* next_out = buffer; in ReadBlockAlignedData()
/bootable/recovery/otautil/include/private/
Dasn1_decoder.h25 asn1_context(const uint8_t* buffer, size_t length) : p_(buffer), length_(length), app_type_(0) {} in asn1_context() argument
/bootable/libbootloader/libxbc/
Dlibxbc.c33 static uint32_t checksum(const unsigned char* const buffer, uint32_t size) { in checksum() argument
36 sum += buffer[i]; in checksum()
/bootable/libbootloader/gbl/efi/src/
Davb.rs51 buffer: &mut [u8], in read_from_partition()
67 self.gpt_dev.read_gpt_partition(part_str, read_off, buffer).map_err(|_| IoError::Io)?; in read_from_partition()
68 Ok(buffer.len()) in read_from_partition()
/bootable/libbootloader/gbl/libefi/src/
Dlib.rs172 pub fn aligned_subslice(buffer: &mut [u8], alignment: usize) -> Option<&mut [u8]> { in aligned_subslice()
173 let addr = buffer.as_ptr() as usize; in aligned_subslice()
179 buffer.get_mut(aligned_offset..) in aligned_subslice()
601 buffer: &'a mut [u8], field
617 if self.offset >= self.memory_map.buffer.len() { in next()
620 let bytes = &self.memory_map.buffer[self.offset..][..self.memory_map.descriptor_size]; in next()
629 buffer: &'a mut [u8], in new()
634 Self { buffer, map_key, descriptor_size, descriptor_version } in new()
638 pub fn buffer(&self) -> &[u8] { in buffer() method
639 self.buffer in buffer()
[all …]

123