blob: 6705e19729270bb3256bac2134bbeb88ccef39ea [file] [log] [blame]
// Copyright 2018 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.
library fuchsia.hardware.block.volume;
using zx;
/// Information about the parent device of the current volume.
type ParentVolumeInfo = struct {
/// The size of a single slice, in bytes.
slice_size uint64;
/// The number of addressable slices within a volume.
virtual_slice_count uint64;
/// The total number of slices which are allocatable.
physical_slice_count_total uint64;
/// The total number of slices which are allocated.
physical_slice_count_used uint64;
};
/// Describes an region within a Volume. Both units are in "slices".
type SliceExtent = struct {
offset uint64;
length uint64;
};
const MAX_SLICE_QUERY_REQUESTS uint32 = 16;
/// Information about an extent of virtual slices.
type SliceRegion = struct {
/// True if the virtual slices are allocated, false otherwise.
allocated bool;
/// The number of contiguous virtual slices.
count uint64;
};
@transport("Banjo")
@banjo_layout("ddk-protocol")
protocol BlockVolume {
/// Attempts to extend a virtual partition.
Extend(struct {
extent SliceExtent;
}) -> (struct {
status zx.status;
});
/// Shrinks a virtual Partition.
Shrink(struct {
extent SliceExtent;
}) -> (struct {
status zx.status;
});
/// Acquire slice size information about the parent volume.
Query() -> (struct {
status zx.status;
info ParentVolumeInfo;
});
/// Returns the number of contiguous slices from a collection
/// of start offsets.
QuerySlices(struct {
start vector<uint64>:MAX_SLICE_QUERY_REQUESTS;
}) -> (struct {
status zx.status;
responses vector<SliceRegion>:MAX_SLICE_QUERY_REQUESTS;
});
/// Destroys the current partition, removing it from the Volume Manager, and
/// freeing all underlying storage.
Destroy() -> (struct {
status zx.status;
});
};