| // Copyright 2019 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| @available(added=HEAD) |
| library fuchsia.hardware.block.partition; |
| using zx; |
| using fuchsia.hardware.block as block; |
| |
| const GUID_LENGTH uint32 = 16; |
| const NAME_LENGTH uint32 = 128; |
| |
| /// A Globally Unique IDentifier, which may be utilized to identify |
| /// a partition. |
| type Guid = struct { |
| value array<uint8, GUID_LENGTH>; |
| }; |
| |
| /// Partition describes a region of one or more block devices, labelled |
| /// with distinguishing identifiers. |
| closed protocol Partition { |
| compose block.Block; |
| |
| /// Gets the type GUID of the partition (if one exists). |
| /// If the partition has no type GUID, ZX_ERR_NOT_SUPPORTED is returned. |
| strict GetTypeGuid() -> (struct { |
| status zx.Status; |
| guid box<Guid>; |
| }); |
| |
| /// Gets the instance GUID of the partition (if one exists). |
| /// If the partition has no instance GUID, ZX_ERR_NOT_SUPPORTED is returned. |
| strict GetInstanceGuid() -> (struct { |
| status zx.Status; |
| guid box<Guid>; |
| }); |
| |
| /// Gets the name of the partition (if one exists). |
| /// If the partition has no name, ZX_ERR_NOT_SUPPORTED is returned. |
| strict GetName() -> (struct { |
| status zx.Status; |
| name string:<NAME_LENGTH, optional>; |
| }); |
| |
| /// Gets the metadata for the partition. |
| /// |
| /// Fields may be absent if the partition doesn't have the given metadata. |
| strict GetMetadata() -> (table { |
| 1: name string:<NAME_LENGTH>; |
| 2: type_guid Guid; |
| 3: instance_guid Guid; |
| /// start_block_offset will be absent if the partition is non-contiguous. |
| 4: start_block_offset uint64; |
| /// num_blocks will be absent if the partition is a dynamic volume, in which case |
| /// fuchsia.hardware.block.volume.Volume/GetVolumeInfo should be called instead. |
| 5: num_blocks uint64; |
| 6: flags uint64; |
| }) error zx.Status; |
| }; |