Horizon::DiskMan::Disk::fs_type(3)

NAME
Horizon::DiskMan::Disk::has_fs, Horizon::DiskMan::Disk::fs_type, Horizon::DiskMan::Disk::fs_label - retrieve file system information for a disk

SYNOPSIS
#include <diskman/disk.hh>
using Horizon::DiskMan::Disk;
bool
Disk::has_fs();
const std::string
Disk::fs_type();
const std::string
Disk::fs_label();

DESCRIPTION
The Disk::has_fs() function returns whether the disk has a file system written directly to it (without a disk label or partition).

The Disk::fs_type() function provides the type of file system present and the Disk::fs_label() function provides the file system's label (if set). Both of these functions are only valid to be called if Disk::has_fs() returns true.

RETURN VALUES
The Disk::has_fs() function returns true if the disk has a file system written to it without a disk label.

The Disk::fs_type() and Disk::fs_label() functions return std::string containing the requested information, if Disk::has_fs() returns true.

EXAMPLES
The following is a simple utility that will print the label and file system type for each disk attached to the system that has one:

    #include "diskman/diskman.hh"
    #include <iostream>
    int main(void) {
        Horizon::DiskMan::DiskMan diskMan;
        auto disks = diskMan.find_disks(false, false, true);
        for(auto &disk : disks) {
            std::cout << "Disk: " << disk.name() << std::endl;
            std::cout << "FS: ";
            if(disk.has_fs()) {
                std::cout << "\"" << disk.fs_label() << "\" (" << disk.fs_type() << ")";
            } else std::cout << "No";
            std::cout << 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>