Horizon::DiskMan::Disk(3)

NAME
Horizon::DiskMan::Disk - disk class of the Horizon Disk Manager

SYNOPSIS
#include <diskman/disk.hh>
class Horizon::DiskMan::Disk;

DESCRIPTION
The Horizon::DiskMan::Disk class provides information about a fixed disk attached to the system.

  Class methods - Identity
The Horizon::DiskMan::Disk class provides the following accessors for information about the identity of the disk:

const std::string name() const
    Retrieve the disk's name. For instance, "sda" or "nvme0n1".

const std::string model() const
    Retrieve the disk's model. This is specified by the vendor. Typically, this is the model number of the disk. Some vendors include the vendor name in the model field.

const std::string serial() const
    Retrieve the disk's serial number. This may be equivalent to the model name, if the vendor did not specify a serial number.

const std::string node() const
    Retrieve the absolute path of the device node for this disk. For instance, "/dev/sda".

  Class methods - Label
The Horizon::DiskMan::Disk class provides the following accessors for information about the label present on the disk, if any:

bool has_label() const
    Returns true if this disk has a disk label attached.

enum Label label() const
    Retrieve the type of disk label in use on this disk. Calling this function is only valid if has_label() is true.

  Class methods - File system
The Horizon::DiskMan::Disk class provides the following accessors for information about the file system present on the disk, if any:

bool has_fs() const
    Returns true if this disk has a file system written to it. Note that this means that the file system is directly written to the disk; it is not contained within a partition.

const std::string fs_type() const
    Retrieve the type of file system written on this disk. Calling this function is only valid if has_fs() is true.

const std::string fs_label() const
    Retrieve the label of the file system written on this disk. Calling this function is only valid if has_fs() is true.

  Class methods - Sizing
The Horizon::DiskMan::Disk class provides the following accessors for information about the size of the disk:

uint32_t total_size() const
    Retrieve the total size of the disk in mebibytes (MiB).

uint32_t free_space() const
    Retrieve the amount of free space available on the disk in mebibytes (MiB).

uint32_t contiguous_block() const
    Retrieve the size of the largest contiguous block of free space on the disk in mebibytes (MiB).

uint32_t sector_size() const
    Retrieve the sector size of the disk in bytes.

  Class methods - Partitions
The Horizon::DiskMan::Disk class provides the following accessors for retrieving partitions associated with the disk's label, if present:

const std::vector<Horizon::DiskMan::Partition> partitions() const
    Retrieve the partitions contained in the label, if any. Calling this function is only valid is has_label() is true.

bool reload_partitions()
    Attempt to (re)load the partition table from the disk. Returns true if the partition table was loaded successfully; otherwise, returns false.

SEE ALSO
Horizon::DiskMan::Disk::name(3), Horizon::DiskMan::Disk::label(3), Horizon::DiskMan::Disk::fs_type(3), Horizon::DiskMan::Disk::total_size(3), Horizon::DiskMan::Disk::partitions(3), Horizon::DiskMan::DiskMan(3), Horizon::DiskMan::Partition(3).

HISTORY
The DiskMan library first appeared in Horizon 0.9.

AUTHORS
A. Wilcox <awilfox@adelielinux.org>