Namespaces

Records

Functions

  • fit::result<std::string_view> CheckItemHeader (const zbi_header_t & header)

    Validates ZBI item and container headers, returning a description of the

    failure in that event. The check is agnostic of storage capacity; whether

    the encoded length is sensible is left to the caller.

    Defined at line 11 of file ../../src/lib/zbitl/checking.cc

  • std::string_view TypeName (uint32_t )

    TODO(https://fxbug.dev/42078423): Consider some way of generating this.

    Defined at line 14 of file ../../src/lib/zbitl/item.cc

  • template <typename Storage>
    Image<Storage> <deduction guide for Image> (Storage )

    Deduction guide: Image img(T{}) instantiates Image

    <T

    >.

  • template <typename Storage>
    View<Storage> <deduction guide for View> (Storage )

    Deduction guide: View v(T{}) instantiates View

    <T

    >.

  • uint32_t BytesPerPixel (zbi_pixel_format_t format)

    Returns the number of bytes per pixel for a given format.

    Defined at line 15 of file ../../src/lib/zbitl/include/lib/zbitl/items/graphics.h

  • template <typename ViewError>
    std::string ViewErrorString (const ViewError & error)

    Returns an error string from a View `Error` value.

    Defined at line 17 of file ../../src/lib/zbitl/include/lib/zbitl/error-string.h

  • template <typename ViewError, typename Printer>
    void PrintViewError (const ViewError & error, Printer && printer)

    Prints an error message from a View `Error` value, where Printer is a

    callable type with a printf-like signature.

    Defined at line 22 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • zbi_header_t SanitizeHeader (zbi_header_t header)

    Modify a header so that it passes checks. This can be used to mint new

    items from a designated initializer that omits uninteresting bits.

    Defined at line 24 of file ../../src/lib/zbitl/include/lib/zbitl/checking.h

  • fit::result<std::string_view> CheckContainerHeader (const zbi_header_t & header)

    Defined at line 27 of file ../../src/lib/zbitl/checking.cc

  • template <typename Writer>
    void JsonWriteHeader (Writer && writer, const zbi_header_t & header, std::optional<uint32_t> offset)

    Takes any class compatible with the rapidjson::Writer API. This emits keys

    and values describing the header fields. It should be called after

    writer.StartObject() and before writer.EndObject(). It doesn't call those

    itself in case the caller wants to add the "contents" key (or others).

    Defined at line 29 of file ../../src/lib/zbitl/include/lib/zbitl/json.h

  • template <typename ViewCopyError>
    std::string ViewCopyErrorString (const ViewCopyError & error)

    Returns an error string from a View `CopyError` value.

    Defined at line 30 of file ../../src/lib/zbitl/include/lib/zbitl/error-string.h

  • template <typename ViewError>
    void PrintViewError (const ViewError & error, FILE * f)

    Defined at line 34 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • template <typename ViewError>
    void PrintViewError (const ViewError & error, FILE * f)

    Defined at line 34 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • template <typename Zbi>
    fit::result<std::string_view> CheckBootable (Zbi && zbi, uint32_t kernel_type)

    Returns empty if and only if the ZBI is bootable, otherwise an error

    string. This takes any zbitl::View type or any type that acts like it.

    Note this does not check for errors from zbi.take_error() so if Zbi is

    zbitl::View then the caller must use zbi.take_error() afterwards. This

    function always scans every item so all errors Zbi::iterator detects will

    be found. But this function's return value only indicates if the items

    that were scanned before any errors were encountered added up to a complete

    ZBI (regardless of whether there were additional items with errors).

    Defined at line 42 of file ../../src/lib/zbitl/include/lib/zbitl/checking.h

  • template <typename Zbi>
    fit::result<std::string_view> CheckBootable (Zbi && zbi, uint32_t kernel_type)

    Returns empty if and only if the ZBI is bootable, otherwise an error

    string. This takes any zbitl::View type or any type that acts like it.

    Note this does not check for errors from zbi.take_error() so if Zbi is

    zbitl::View then the caller must use zbi.take_error() afterwards. This

    function always scans every item so all errors Zbi::iterator detects will

    be found. But this function's return value only indicates if the items

    that were scanned before any errors were encountered added up to a complete

    ZBI (regardless of whether there were additional items with errors).

    Defined at line 42 of file ../../src/lib/zbitl/include/lib/zbitl/checking.h

  • template <PayloadCompatibleStorage T, typename U>
    std::span<T> AsSpan (U * payload, size_t len)

    It is expected that `payload` is `kStorageAlignment`-aligned in the

    following AsSpan methods (see StorageTraits below), along with `T` itself.

    This ensures that `payload` is `alignof(T)`-aligned as well, which in

    particular means that it is safe to reinterpret a `U*` as a `T*`.

    Defined at line 44 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <PayloadCompatibleStorage T, typename U>
    std::span<T> AsSpan (U * payload, size_t len)

    It is expected that `payload` is `kStorageAlignment`-aligned in the

    following AsSpan methods (see StorageTraits below), along with `T` itself.

    This ensures that `payload` is `alignof(T)`-aligned as well, which in

    particular means that it is safe to reinterpret a `U*` as a `T*`.

    Defined at line 44 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <PayloadCompatibleStorage T, typename U>
    std::span<T> AsSpan (U * payload, size_t len)

    It is expected that `payload` is `kStorageAlignment`-aligned in the

    following AsSpan methods (see StorageTraits below), along with `T` itself.

    This ensures that `payload` is `alignof(T)`-aligned as well, which in

    particular means that it is safe to reinterpret a `U*` as a `T*`.

    Defined at line 44 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <PayloadCompatibleStorage T, typename U>
    std::span<T> AsSpan (U * payload, size_t len)

    It is expected that `payload` is `kStorageAlignment`-aligned in the

    following AsSpan methods (see StorageTraits below), along with `T` itself.

    This ensures that `payload` is `alignof(T)`-aligned as well, which in

    particular means that it is safe to reinterpret a `U*` as a `T*`.

    Defined at line 44 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename ViewCopyError, typename Printer>
    void PrintViewCopyError (const ViewCopyError & error, Printer && printer)

    Prints an error message from a View `CopyError` value, where Printer is a

    callable type with a printf-like signature.

    Defined at line 46 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • template <typename BootfsError>
    std::string BootfsErrorString (const BootfsError & error)

    Returns an error string from a Bootfs `Error` value.

    Defined at line 48 of file ../../src/lib/zbitl/include/lib/zbitl/error-string.h

  • template <typename T, typename U>
    std::span<T> AsSpan (const U & payload)

    Defined at line 52 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename T, typename U>
    std::span<T> AsSpan (const U & payload)

    Defined at line 52 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename T, typename U>
    std::span<T> AsSpan (const U & payload)

    Defined at line 52 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename T, typename U>
    std::span<T> AsSpan (const U & payload)

    Defined at line 52 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • ByteView AsBytes (const void * payload, size_t len)

    Defined at line 61 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • ByteView AsBytes (const void * payload, size_t len)

    Defined at line 61 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • ByteView AsBytes (const void * payload, size_t len)

    Defined at line 61 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • std::string_view TypeName (const zbi_header_t & header)

    Defined at line 62 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • template <typename ViewCopyError>
    void PrintViewCopyError (const ViewCopyError & error, FILE * f)

    Defined at line 63 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • template <typename ViewCopyError>
    void PrintViewCopyError (const ViewCopyError & error, FILE * f)

    Defined at line 63 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • ByteView AsBytes (std::string_view sv)

    Defined at line 65 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • ByteView AsBytes (std::string_view sv)

    Defined at line 65 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • std::string_view TypeExtension (const zbi_header_t & header)

    Defined at line 68 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • template <typename T>
    ByteView AsBytes (const T & payload)

    Defined at line 68 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename T>
    ByteView AsBytes (const T & payload)

    Defined at line 68 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename T>
    ByteView AsBytes (const T & payload)

    Defined at line 68 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • template <typename T>
    ByteView AsBytes (const T & payload)

    Defined at line 68 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

  • bool TypeIsKernel (uint32_t type)

    Returns true for any kernel item type.

    Defined at line 73 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • template <typename BootfsError, typename Printer>
    void PrintBootfsError (const BootfsError & error, Printer && printer)

    Prints an error message from a BootfsView `Error` value, where Printer is a

    callable type with a printf-like signature.

    Defined at line 75 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • bool TypeIsKernel (const zbi_header_t & header)

    Defined at line 77 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • bool TypeIsStorage (const zbi_header_t & header)

    Defined at line 82 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • uint32_t UncompressedLength (const zbi_header_t & header)

    This returns the length of the item payload after decompression.

    If this is not a ZBI_TYPE_STORAGE_* item, this is just `header.length`.

    Defined at line 86 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • uint32_t AlignedPayloadLength (uint32_t content_length)

    Defined at line 90 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • std::string_view TypeExtension (uint32_t )

    This returns the canonical file name extension string for this

    zbi_header_t.type value. It returns the default-constructed (i.e. empty())

    string_view for unknown types.

    Defined at line 90 of file ../../src/lib/zbitl/item.cc

  • template <typename Writer>
    void JsonWriteItem (Writer && writer, const zbi_header_t & header, std::optional<uint32_t> offset)

    Takes any class compatible with the rapidjson::Writer API and emits a JSON

    object describing the item's header details. This omits "contents" fields.

    Defined at line 91 of file ../../src/lib/zbitl/include/lib/zbitl/json.h

  • template <typename BootfsError>
    void PrintBootfsError (const BootfsError & error, FILE * f)

    Defined at line 93 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • template <typename BootfsError>
    void PrintBootfsError (const BootfsError & error, FILE * f)

    Defined at line 93 of file ../../src/lib/zbitl/include/lib/zbitl/error-stdio.h

  • uint32_t AlignedPayloadLength (const zbi_header_t & header)

    Defined at line 94 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • uint32_t AlignedItemLength (uint32_t content_length)

    Defined at line 98 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • uint32_t AlignedItemLength (const zbi_header_t & header)

    Defined at line 102 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • template <typename Writer, typename Payload, typename Contents>
    void JsonWriteItemWithContents (Writer && writer, Contents && contents, const zbi_header_t & header, Payload && payload, std::optional<uint32_t> offset)

    Takes any class compatible with the rapidjson::Writer API and emits a JSON

    object describing the item's header details. If there is a nonempty

    payload, this calls `contents(writer, key, header, payload)` and that

    should call `writer.Key(key)` and some appropriate value type if it wants

    to describe the contents; if it does nothing, the output is the same as for

    JsonWriteItem (above).

    Defined at line 105 of file ../../src/lib/zbitl/include/lib/zbitl/json.h

  • bool TypeIsStorage (uint32_t )

    Returns true for any ZBI_TYPE_STORAGE_* type.

    These share a protocol for other header fields, compression, etc.

    Defined at line 105 of file ../../src/lib/zbitl/item.cc

  • zbi_header_t ContainerHeader (uint32_t length)

    Defined at line 106 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

  • template <typename Writer, typename Zbi, typename Contents = JsonIgnoreContents>
    void JsonWriteZbi (Writer && writer, Zbi && zbi, std::optional<uint32_t> offset, Contents && contents)

    Defined at line 121 of file ../../src/lib/zbitl/include/lib/zbitl/json.h

  • template <typename Storage = ByteView>
    Storage StorageFromRawHeader (std::conditional_t<std::is_const_v<typename Storage::element_type>, const zbi_header_t, zbi_header_t> * zbi)

    Convert a pointer to an in-memory ZBI into a Storage type.

    We require that `zbi` is a pointer to a valid ZBI container header followed

    by its payload. Basic magic checks on the header are performed; if they

    fail, we return a Storage spanning just the header but no payload under the

    assumption that the "length" field of the header is invalid.

    The template parameter `Storage` may be any storage type that can be

    constructed with arguments the arguments (const std::byte*, size_t),

    representing the start and length of the in-memory ZBI.

    Defined at line 1292 of file ../../src/lib/zbitl/include/lib/zbitl/view.h

Concepts

template <typename T> PayloadCompatibleStorage requires { __alignof(T) <= kStorageAlignment; }

Defined at line 29 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

Variables

const std::array<unsigned int, 1 + sizeof...(_Args)> kItemTypes

Defined at line 22 of file ../../src/lib/zbitl/include/lib/zbitl/item.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 32 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_pod_v

Defined at line 33 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 35 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const bool is_uniquely_representable_pod_v

Defined at line 36 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h

const uint32_t kReadMinimum

Defined at line 443 of file ../../src/lib/zbitl/include/lib/zbitl/storage-traits.h