Horizon::DiskMan::Disk::name(3)

NAME
Horizon::DiskMan::Disk::name, Horizon::DiskMan::Disk::model, Horizon::DiskMan::Disk::serial, Horizon::DiskMan::Disk::node, Horizon::DiskMan::Disk::dev_path - retrieve properties of a disk

SYNOPSIS
#include <diskman/disk.hh>
using Horizon::DiskMan::Disk;
const std::string
Disk::name();
const std::string
Disk::model();
const std::string
Disk::serial();
const std::string
Disk::node();
const std::string
Disk::dev_path();

DESCRIPTION
The Disk::name() function provides the name of the fixed disk. This is equivalent to calling basename(3) on Disk::node().

The Disk::model() function provides the vendor's given model number for the fixed disk. This is a free-form identification string provided by the disk's vendor and could be blank or meaningless depending on the vendor. Some external disk enclosures do not support retrieval of disk model numbers.

The Disk::serial() function provides the vendor's given serial number for the fixed disk. Like Disk::model(), this is a free-form string provided by the disk's vendor. You should not rely on this string being unique in a given system; some vendors simply copy the model number as the serial number. When the given serial number is non- blank and unequal to the model number, it may be unique.

The Disk::node() function provides the absolute path of the device node for this disk.

The Disk::dev_path() function provides the absolute path to the sysfs node for this disk.

RETURN VALUES
These routines return the requested information as a C++ std::string. Values are not converted from their native representation. Virtually all disks the authors have seen use US-ASCII or UTF-8, but there may be a disk in the wild that uses a legacy codepage.

EXAMPLES
The following is a simple utility that returns the model and device node of all disks present in a system:

    #include <diskman/diskman.hh>
    #include <iostream>
    using Horizon::DiskMan::DiskMan;
    int main(void) {
        DiskMan dm;
        auto disks = dm.find_disks(false, false, false);
        for(auto &disk : disks) {
            std::cout << "Disk " << disk.model() << " found at: " << disk.node() << 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>