1 // Copyright 2019 The Fuchsia Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #pragma once 6 7 #include <fbl/function.h> 8 #include <lib/inspect/block.h> 9 #include <zircon/types.h> 10 11 namespace inspect { 12 namespace internal { 13 14 // Read blocks out of the buffer. 15 // For each block that it found, this function calls the callback function 16 // with the block's index and a pointer to the block. 17 // Returns ZX_OK if the buffer was valid and successfully loaded, 18 // otherwise returns an error describing what went wrong. 19 zx_status_t ScanBlocks(const uint8_t* buffer, size_t size, 20 fbl::Function<void(BlockIndex, const Block*)> callback); 21 22 } // namespace internal 23 } // namespace inspect 24