MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / copy_area

Method copy_area

libraries/StorageManager/StorageManager.cpp:321–338  ·  view source on GitHub ↗

copy one area to another */

Source from the content-addressed store, hash-verified

319 copy one area to another
320 */
321bool StorageAccess::copy_area(const StorageAccess &source) const
322{
323 // we deliberately allow for copies from smaller areas. This
324 // allows for a partial backup region for parameters
325 uint16_t total = MIN(source.size(), size());
326 uint16_t ofs = 0;
327 while (total > 0) {
328 uint8_t block[32];
329 uint16_t n = MIN(sizeof(block), total);
330 if (!source.read_block(block, ofs, n) ||
331 !write_block(ofs, block, n)) {
332 return false;
333 }
334 total -= n;
335 ofs += n;
336 }
337 return true;
338}
339
340#if AP_SDCARD_STORAGE_ENABLED
341/*

Callers 1

setupMethod · 0.80

Calls 3

MINFunction · 0.85
sizeMethod · 0.45
read_blockMethod · 0.45

Tested by

no test coverage detected