Namespaces

Enumerations

enum RawNandImageFlag
Name Value
kRequireWipeBeforeFlash 0x1

Supported flags for |RawNandImageHeader::flags|.

Defined at line 13 of file ../../src/storage/volume_image/ftl/raw_nand_image.h

enum Schema
Name Value
kVolumeDescriptor 0
kAddressDescriptor 1
kVolumeImage 2
kBlobManifest 3

Defines available schemas.

Defined at line 13 of file ../../src/storage/volume_image/serialization/schema.h

enum CompressionSchema
Name Value
kNone 0
kLz4 1

Supported compression schemas for the generated block images.

Defined at line 16 of file ../../src/storage/volume_image/options.h

enum ImageFormat
Name Value
kRawImage 0
kAndroidSparseImage 1

Supported image data formats.

Defined at line 20 of file ../../src/storage/volume_image/ftl/raw_nand_image.h

enum EncryptionType
Name Value
kNone 0
kZxcrypt 1

Supported encryption mechanisms for the generated images.

Defined at line 22 of file ../../src/storage/volume_image/options.h

enum Command
Name Value
kCreate 0
kCreateSparse 1
kPave 2
kExtend 3
kSize 4
kUnsupported 5

Defined at line 27 of file ../../src/storage/volume_image/adapter/commands.h

enum Option
Name Value
kNone 0
kEmpty 1

Supported options for partitions.

Defined at line 28 of file ../../src/storage/volume_image/options.h

enum FvmImageFormat
Name Value
kBlockImage 0
kSparseImage 1

Output image format.

Defined at line 40 of file ../../src/storage/volume_image/adapter/commands.h

enum AddressMapOption
Name Value
kUnknown 0
kFill 1

Supported options for |AddressMap::options|.

Defined at line 42 of file ../../src/storage/volume_image/options.h

enum PartitionImageFormat
Name Value
kBlobfs 0
kMinfs 1
kEmptyPartition 2

Supported image formats.

Defined at line 50 of file ../../src/storage/volume_image/adapter/commands.h

enum TargetType
Name Value
kBlockDevice 0
kFile 1

Defined at line 120 of file ../../src/storage/volume_image/adapter/commands.h

Records

Functions

  • template <>
    std::string EnumAsString<storage::volume_image::CompressionSchema> (CompressionSchema schema)

    Defined at line 12 of file ../../src/storage/volume_image/options.cc

  • uint64_t GetOffsetFromBlockStart (uint64_t byte_offset, uint64_t block_size)

    Returns the byte offset of |byte_offset| relative to the start of the block that contains

    |byte_offset|.

    Defined at line 17 of file ../../src/storage/volume_image/utils/block_utils.h

  • std::string GetBasePath ()

    Returns the path where the current binary is being executed.

    Defined at line 18 of file ../../src/storage/volume_image/utils/path.cc

  • fpromise::result<fvm::Metadata, std::string> FvmGetMetadata (const Reader & source_image)

    Returns an |fvm::Metadata| object using the reader for an fvm image.

    Defined at line 17 of file ../../src/storage/volume_image/fvm/fvm_metadata.cc

  • fpromise::result<uint64_t, std::string> FvmImageGetSize (const Reader & source_image)

    Returns |fpromise::ok| if the header from |source_image| was parsed correctly.

    On error, returns a string describing the error conditions.

    Defined at line 19 of file ../../src/storage/volume_image/fvm/fvm_image_extend.cc

  • uint64_t RawNandImageGetAdjustedPageSize (const RawNandOptions & options)

    Returns the adjusted page size of a RawNandImage with the given |options|.

    Defined at line 21 of file ../../src/storage/volume_image/ftl/raw_nand_image_utils.h

  • uint64_t GetRemainderFromBlock (uint64_t byte_count, uint64_t block_size)

    Returns the trailing bytes on the last block for a sequence of |byte_counts|.

    Defined at line 22 of file ../../src/storage/volume_image/utils/block_utils.h

  • template <>
    std::string EnumAsString<storage::volume_image::EncryptionType> (EncryptionType encryption)

    Defined at line 24 of file ../../src/storage/volume_image/options.cc

  • uint64_t RawNandImageGetAdjustedEraseBlockSize (const RawNandOptions & options)

    Returns the adjusted erase block size size of a RawNandImage with the given |options|.

    Defined at line 26 of file ../../src/storage/volume_image/ftl/raw_nand_image_utils.h

  • uint64_t GetBlockFromBytes (uint64_t byte_offset, uint64_t block_size)

    Returns the offset in number of blocks of |block_size| for |byte_offset|.

    Defined at line 27 of file ../../src/storage/volume_image/utils/block_utils.h

  • fpromise::result<Partition, std::string> CreateEmptyFvmPartition (const PartitionOptions & partition_options, const FvmOptions & fvm_options)

    Returns a Partition to be incorporated into a FVM image, containing .

    Note: Eventually as blobfs host tool gets cleaned up, it should generate the volume and address

    descriptor for blobfs, in the meantime we generate them on the fly.

    Defined at line 30 of file ../../src/storage/volume_image/adapter/empty_partition.cc

  • uint64_t RawNandImageGetPageOffset (uint64_t page_number, const RawNandOptions & options)

    Returns the offset in bytes of |page_number| page from the start, with a known |page_size| and

    |oob_bytes_size|.

    Defined at line 32 of file ../../src/storage/volume_image/ftl/raw_nand_image_utils.h

  • uint64_t GetBlockCount (uint64_t byte_offset, uint64_t byte_count, uint64_t block_size)

    Returns the number of blocks required to write |byte_count| from |byte_offset| with |block_size|.

    Defined at line 32 of file ../../src/storage/volume_image/utils/block_utils.h

  • template <>
    std::string EnumAsString<storage::volume_image::Option> (Option option)

    Defined at line 34 of file ../../src/storage/volume_image/options.cc

  • uint64_t RawNandImageGetNextEraseBlockOffset (uint64_t start_offset, const RawNandOptions & options)

    Returns the offset of the first erase block that start after or at |start_offset|.

    Defined at line 37 of file ../../src/storage/volume_image/ftl/raw_nand_image_utils.h

  • bool IsOffsetBlockAligned (uint64_t byte_offset, uint64_t block_size)

    Retruns true if the |byte_offset| is block aligned.

    Defined at line 42 of file ../../src/storage/volume_image/utils/block_utils.h

  • fpromise::result<void, std::string> RawNandImageWritePage (std::span<const uint8_t> page_content, std::span<const uint8_t> oob_bytes, uint64_t offset, Writer * writer)

    Writes a block of size |oob_bytes.size() + page_content.size()| into |writer| at |offset|.

    Defined at line 43 of file ../../src/storage/volume_image/ftl/raw_nand_image_utils.h

  • template <>
    std::string EnumAsString<storage::volume_image::AddressMapOption> (AddressMapOption option)

    Defined at line 44 of file ../../src/storage/volume_image/options.cc

  • template <>
    fpromise::result<CompressionSchema, std::string> StringAsEnum<storage::volume_image::CompressionSchema> (std::string_view compression)

    Defined at line 54 of file ../../src/storage/volume_image/options.cc

  • template <>
    fpromise::result<EncryptionType, std::string> StringAsEnum<storage::volume_image::EncryptionType> (std::string_view encryption)

    Defined at line 68 of file ../../src/storage/volume_image/options.cc

  • template <>
    fpromise::result<Option, std::string> StringAsEnum<storage::volume_image::Option> (std::string_view option)

    Defined at line 82 of file ../../src/storage/volume_image/options.cc

  • template <>
    fpromise::result<AddressMapOption, std::string> StringAsEnum<storage::volume_image::AddressMapOption> (std::string_view option)

    Defined at line 95 of file ../../src/storage/volume_image/options.cc

  • fpromise::result<Partition, std::string> OpenSparseImage (Reader & base_reader, std::optional<uint64_t> max_disk_size)

    Opens an existing FVM sparse image and exposes a partition that looks just as it would on the

    device i.e. if you were to serialize it to a block device, FVM would recognise it. At this time

    the reader embedded within the partition can only support sequential reads (which is all we need

    to support at this time).

    Defined at line 151 of file ../../src/storage/volume_image/fvm/fvm_sparse_image_reader.cc

  • std::string GetSchema (Schema schema)

    Returns a string with the respective schema.

    On error, returns an empty string.

    Defined at line 19 of file ../../src/storage/volume_image/serialization/schema.cc

  • fpromise::result<void, std::string> FtlImageWrite (const RawNandOptions & options, const Partition & partition, Writer * writer)

    Returns |fpromise::ok|, when the contents of |partition| have been written into |writer| as a

    |RawNandImage|.

    It is required for |writer| to manage gaps in unwritten parts. For example, a raw block image may

    choose to zero the contents of the unwritten parts, while a sparse format may just keep track of

    the ranges.

    Defined at line 85 of file ../../src/storage/volume_image/ftl/ftl_image.cc

  • fpromise::result<Partition, std::string> CreateBlobfsFvmPartition (std::unique_ptr<Reader> source_image, const PartitionOptions & partition_options, const FvmOptions & fvm_options)

    Returns a Partition to be incorporated into a FVM image, containing blobfs.

    Note: Eventually as blobfs host tool gets cleaned up, it should generate the volume and address

    descriptor for blobfs, in the meantime we generate them on the fly.

    Defined at line 106 of file ../../src/storage/volume_image/adapter/blobfs_partition.cc

  • fpromise::result<Partition, std::string> CreateMinfsFvmPartition (std::unique_ptr<Reader> source_image, const PartitionOptions & partition_options, const FvmOptions & fvm_options)

    Returns a Partition to be incorporated into a FVM image, containing minfs.

    Note: Eventually as minfs host tool gets cleaned up, it should generate the volume and address

    descriptor for minfs, in the meantime we generate them on the fly.

    Defined at line 85 of file ../../src/storage/volume_image/adapter/minfs_partition.cc

  • fpromise::result<void, std::string> UnpackRawFvm (const Reader & image, const std::string & out_path_prefix)

    Unpacks an input raw fvm image writing all contained partitions using their internal names,

    with dashes replaced as underscores. De-duplicating names by appending a dash and numerical

    suffix to the 2nd or later copy of a name. Blank names will all be appended with a a dash and

    numerical suffix.

    Defined at line 110 of file ../../src/storage/volume_image/fvm/fvm_unpack.cc

  • fpromise::result<void, std::string> FvmImageExtend (const Reader & source_image, const FvmOptions & options, Writer & target_image)

    Returns |fpromise::ok| if the |source_image| has successfully been written into |target_image|

    with the updated |options|.

    Supported Options:

    - |target_volume_size| updates the metadata size and the usable slices as well.

    On error, returns a string describing the error conditions.

    Defined at line 28 of file ../../src/storage/volume_image/fvm/fvm_image_extend.cc

  • Command CommandFromString (std::string_view command_str)

    For a given string returns the associated |Command|.

    Defined at line 416 of file ../../src/storage/volume_image/adapter/commands/arguments.cc

  • fpromise::result<uint64_t, std::string> FvmImageGetTrimmedSize (const Reader & source_image)

    Returns the trimmed sized of a raw fvm image. If the resource containing the fvm image, is

    truncated to the trimmed sized, all the trailing data on unallocated slices are removed.

    For example, a 14 terabyte fvm image with 1 MB worth of data, could be trimmed to a coupole of

    MBs(metadata and the actual data).

    An error is returned if the fvm image contains invalid metadata.

    Defined at line 121 of file ../../src/storage/volume_image/fvm/fvm_image_extend.cc

  • template <typename OptionEnum>
    std::string EnumAsString (OptionEnum option)

    Template specialization provided in options.cc where the stringified version of the enums are

    defined.

  • template <typename OptionEnum>
    fpromise::result<OptionEnum, std::string> StringAsEnum (std::string_view option)
  • fpromise::result<uint64_t, std::string> FvmSparseWriteImage (const FvmDescriptor & descriptor, Writer * writer, Compressor * compressor)

    Returns the size of the written image in bytes when successfully writing a |SparseImage| and

    its data with |writer|.

    Defined at line 563 of file ../../src/storage/volume_image/fvm/fvm_sparse_image.cc

  • fpromise::result<bool, std::string> FvmSparseDecompressImage (uint64_t offset, const Reader & reader, Writer & writer)

    Returns true if |reader| is a compressed |fvm::SparseImage|, and has been successfully

    decompressed into |writer|. If not compressed returns false, and this is not considered an error.

    On error, returns a description of the error condition.

    Defined at line 573 of file ../../src/storage/volume_image/fvm/fvm_sparse_image.cc

  • fpromise::result<FvmDescriptor, std::string> FvmSparseReadImage (uint64_t offset, std::unique_ptr<Reader> reader)

    Returns a |FvmDescriptor| representing the contained data in sparse image contained in |reader|

    starting at |offset|. |reader| must contain an uncompressed fvm sparse image, or an error is

    returned.

    On error, returns a description of the error condition.

    Defined at line 684 of file ../../src/storage/volume_image/fvm/fvm_sparse_image.cc

  • fpromise::result<void, std::string> Create (const CreateParams & params)

    Creates an fvm image according to |params| and |options|.

    Defined at line 203 of file ../../src/storage/volume_image/adapter/commands/create.cc

  • fpromise::result<void, std::string> Pave (const PaveParams & params)

    Given an input sparse fvm image, it will write the expanded contents to the path.

    Defined at line 69 of file ../../src/storage/volume_image/adapter/commands/pave.cc

  • fpromise::result<void, std::string> Extend (const ExtendParams & params)

    Defined at line 51 of file ../../src/storage/volume_image/adapter/commands/extend.cc

  • fpromise::result<uint64_t, std::string> Size (const SizeParams & params)

    Returns the allocated data size(metadata and slices) within a sparse image.

    If |length| is set an error is returned if the sparse image cannot be paved in a disk size of

    |length|.

    On error returns a string describing the error.

    Defined at line 23 of file ../../src/storage/volume_image/adapter/commands/size.cc