File System Access

struct fs::extfs

The ext* file system.

This abstraction provides a top-level interface to an ext* family file system. It grants access to information like the size of the file system, the space left on the file system as well as the label.

Since
1.0

Public Types

enum mode

How to open the file system.

Since
1.0

Values:

read_only

Open in read-only mode.

writeable

Open in read-write mode.

Public Functions

extfs(std::string const &path, mode const openMode = mode::read_only)

Open the filesystem at a given path.

Since
1.0
Note
This call will also succeed if the file system could not be opened for some reason. To check whether the file system was successfully opened, see fs::extfs::open().
Parameters
  • path: The path to a device/file containing an ext* file system.
  • openMode: Whether to open the file system in read_only or writeable mode.

bool open() const

Check if the filesystem is open.

Return
true, iff. the file system is opened, false otherwise
Since
1.0

std::string label() const

Get the label of the file system.

The ext2/3/4 file systems allow the use of a label for human readable identification of a file system. Because they are user configurable, there are no guarantees on whether or not the label is unique. Thus, a file system should never be identified solely by its label.

Return
A std::string containing the file system label. The string might be empty if no label is set.
Since
1.0

bool has_label() const

Check if the file system has a label.

ext2/3/4 file systems may or may not have a label. If a label is present, it has a maximum length of 15 character in ISO-Latin-1 encoding.

Return
true, iff. the file system has a non-null label configured, false otherwise
Since
1.0