Horizon::DiskMan::Disk::total_size(3)

NAME
Horizon::DiskMan::Disk::total_size, Horizon::DiskMan::Disk::free_space, Horizon::DiskMan::Disk::contiguous_block, Horizon::DiskMan::Disk::sector_size - retrieve sizing information for a disk

SYNOPSIS
#include <diskman/disk.hh>
using Horizon::DiskMan::Disk;
uint32_t
Disk::total_size();
uint32_t
Disk::free_space();
uint32_t
Disk::contiguous_block();
uint32_t
Disk::sector_size();

DESCRIPTION
The Disk::total_size() function provides the size of the specified disk.

The Disk::free_space() and Disk::contiguous_block() functions provide the amount of total free space, and the largest contiguous block of free space, respectively.

The Disk::sector_size() function provides the disk's sector size.

RETURN VALUES
The Disk::total_size(), Disk::free_space(), and Disk::contiguous_block() functions return the requested information in mebibytes (MiB).

The Disk::sector_size() function returns the sector size in bytes.

EXAMPLES
The following is a simple utility that prints the name, total size, and free space for each disk attached to the system:

    #include <diskman/diskman.hh>
    #include <iostream>
    int main(void) {
        Horizon::DiskMan::DiskMan dm;
        auto disks = dm.find_disks(false, false, false);
        for(auto &disk : disks) {
            std::cout << "Disk: " << disk.name() << ":" << std::endl;
            std::cout << std::to_string(disk.total_size()) << " MiB total";
            std::cout << " (" << std::to_string(disk.free_space()) << " MiB free; ";
            std::cout << std::to_string(disk.contiguous_block()) << " MiB largest contiguous block)" << std::endl;
        }
        return 0;
    }

SEE ALSO
Horizon::DiskMan::Disk(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>