class BlobLayout
Defined at line 48 of file ../../src/storage/blobfs/blob_layout.h
Layout information for where the data and Merkle tree are positioned in a blob.
Public Methods
uint64_t blobfs_block_size ()
Defined at line 50 of file ../../src/storage/blobfs/blob_layout.h
uint64_t FileSize ()
The uncompressed size of the file.
Defined at line 272 of file ../../src/storage/blobfs/blob_layout.cc
uint64_t FileBlockAlignedSize ()
The uncompressed size of the file rounded up to the next multiple of the block size.
Defined at line 274 of file ../../src/storage/blobfs/blob_layout.cc
uint64_t DataSizeUpperBound ()
The number of bytes used to store the blob's data.
When reading a compressed blob this may not be the exact size but a safe upper bound. All
bytes between the actual compressed size and |DataSizeUpperBound| will be zeros. This is
because the size of the compressed file is not stored. See https://fxbug.dev/42120973.
Defined at line 278 of file ../../src/storage/blobfs/blob_layout.cc
uint64_t DataBlockAlignedSize ()
The size of buffer required to hold |DataBlockCount| blocks.
Defined at line 280 of file ../../src/storage/blobfs/blob_layout.cc
uint64_t DataBlockCount ()
The number of blocks that the data spans.
Defined at line 284 of file ../../src/storage/blobfs/blob_layout.cc
uint64_t DataBlockOffset ()
The data may not start at the beginning of the blob contents but it will always be on a
block-aligned offset. The rest of the blob's data will be in the following |DataBlockCount| - 1
blocks.
uint64_t DataOffset ()
Defined at line 71 of file ../../src/storage/blobfs/blob_layout.h
uint64_t MerkleTreeBlockOffset ()
The first block of the blob containing part of the Merkle tree. The rest of the Merkle tree
will be in the following |MerkleTreeBlockCount| - 1 blocks.
Defined at line 85 of file ../../src/storage/blobfs/blob_layout.h
uint64_t MerkleTreeSize ()
The number of bytes required to store the Merkle tree.
Defined at line 288 of file ../../src/storage/blobfs/blob_layout.cc
uint64_t MerkleTreeBlockAlignedSize ()
The size of buffer required to hold |MerkleTreeBlockCount| blocks.
Defined at line 290 of file ../../src/storage/blobfs/blob_layout.cc
uint64_t MerkleTreeBlockCount ()
The number of blocks that the Merkle tree spans.
Defined at line 294 of file ../../src/storage/blobfs/blob_layout.cc
uint64_t MerkleTreeOffset ()
Returns the offset within the file for the merkle tree.
uint64_t MerkleTreeOffsetWithinBlockOffset ()
The offset within |MerkleTreeBlockOffset| that the Merkle tree starts at.
Defined at line 88 of file ../../src/storage/blobfs/blob_layout.h
uint64_t TotalBlockCount ()
The total number of blocks that the blob spans.
bool HasMerkleTreeAndDataSharedBlock ()
True if the data and Merkle tree share a block.
BlobLayoutFormat Format ()
The format that this layout is in.
void ~BlobLayout ()
Defined at line 119 of file ../../src/storage/blobfs/blob_layout.h
zx::result<std::unique_ptr<BlobLayout>> CreateFromInode (BlobLayoutFormat format, const Inode & inode, uint64_t blobfs_block_size)
Initializes a |BlobLayout| from a blob's inode.
In Blobfs V10Rev4, the format is stored in the inode and V8Rev4, and V9Rev4 should be migrated
to V10Rev4 at mount. If a blobfs V8Rev4 or V9Rev4 image is mounted read-only then the migration
won't happen and the format won't be in the inode requiring the format to still be passed as a
separate argument.
Defined at line 298 of file ../../src/storage/blobfs/blob_layout.cc
zx::result<std::unique_ptr<BlobLayout>> CreateFromSizes (BlobLayoutFormat format, uint64_t file_size, uint64_t data_size, uint64_t blobfs_block_size)
Initializes a |BlobLayout| from a blob's file size and data size.
For uncompressed blobs |data_size| is the same as |file_size|.
For compressed blobs |data_size| is the compressed size of the file.
Defined at line 319 of file ../../src/storage/blobfs/blob_layout.cc
Protected Methods
void BlobLayout (uint64_t file_size, uint64_t data_size, uint64_t merkle_tree_size, uint64_t blobfs_block_size)
Defined at line 265 of file ../../src/storage/blobfs/blob_layout.cc