src/storage/blobfs/test/unit/utils.cc
// Create a block and node map of the requested size, update the superblock of
// the |space_manager|, and create an allocator from this provided info.
Create a block and node map of the requested size, update the superblock of
the |space_manager|, and create an allocator from this provided info.
Create a block and node map of the requested size update the superblock of the |space_manager| and create an allocator from this provided info .
void InitializeAllocator(size_t blocks, size_t nodes, MockSpaceManager* space_manager,
                         std::unique_ptr<Allocator>* out) {
  RawBitmap block_map;
  ASSERT_EQ(block_map.Reset(blocks), ZX_OK);
  fzl::ResizeableVmoMapper node_map;
  ASSERT_EQ(node_map.CreateAndMap(nodes * kBlobfsBlockSize, "node map"), ZX_OK);
  space_manager->MutableInfo().inode_count = nodes;
  space_manager->MutableInfo().data_block_count = blocks;
  std::unique_ptr<IdAllocator> nodes_bitmap = {};
  ASSERT_EQ(IdAllocator::Create(nodes, &nodes_bitmap), ZX_OK);
  *out = std::make_unique<Allocator>(space_manager, std::move(block_map), std::move(node_map),
                                     std::move(nodes_bitmap));
  (*out)->SetLogging(false);
}
void InitializeAllocator ( size_t blocks , size_t nodes , MockSpaceManager * space_manager , std :: unique_ptr < Allocator > * out ) { RawBitmap block_map ; ASSERT_EQ ( block_map . Reset ( blocks ) , ZX_OK ) ; fzl :: ResizeableVmoMapper node_map ; ASSERT_EQ ( node_map . CreateAndMap ( nodes * kBlobfsBlockSize , " " ) , ZX_OK ) ; space_manager -> MutableInfo ( ) . inode_count = nodes ; space_manager -> MutableInfo ( ) . data_block_count = blocks ; std :: unique_ptr < IdAllocator > nodes_bitmap = { } ; ASSERT_EQ ( IdAllocator :: Create ( nodes , & nodes_bitmap ) , ZX_OK ) ; * out = std :: make_unique < Allocator > ( space_manager , std :: move ( block_map ) , std :: move ( node_map ) , std :: move ( nodes_bitmap ) ) ; ( * out ) -> SetLogging ( false ) ; }
Create a block and node map of the requested size, update the superblock of
the |space_manager|, and create an allocator from this provided info.
Create a block and node map of the requested size update the superblock of the |space_manager| and create an allocator from this provided info .