summaryrefslogtreecommitdiff
path: root/diskman/man/Horizon::DiskMan::Disk.3
blob: edd7b42ee575f69d75f9c9b69f6bdd40ba771b73 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
.Dd May 15, 2020
.Dt Horizon::DiskMan::Disk 3
.Os "Adélie Linux"
.Sh NAME
.Nm Horizon::DiskMan::Disk
.Nd disk class of the Horizon Disk Manager
.Sh SYNOPSIS
.In diskman/disk.hh
.Cm class Horizon::DiskMan::Disk;
.Sh DESCRIPTION
The
.Nm
class provides information about a fixed disk attached to the system.
.Ss Class methods - Identity
The
.Nm
class provides the following accessors for information about the identity of
the disk:
.Bl -tag -width Ds
.It Cm const std::string name() const
Retrieve the disk's name.  For instance,
.Qq sda
or
.Qq nvme0n1 .
.It Cm 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.
.It Cm 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.
.It Cm const std::string node() const
Retrieve the absolute path of the device node for this disk.  For instance,
.Qq /dev/sda .
.El
.Ss Class methods - Label
The
.Nm
class provides the following accessors for information about the label
present on the disk, if any:
.Bl -tag -width Ds
.It Cm bool has_label() const
Returns true if this disk has a disk label attached.
.It Cm 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.
.El
.Ss Class methods - File system
The
.Nm
class provides the following accessors for information about the file system
present on the disk, if any:
.Bl -tag -width Ds
.It Cm 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.
.It Cm 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.
.It Cm 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.
.El
.Ss Class methods - Sizing
The
.Nm
class provides the following accessors for information about the size of the
disk:
.Bl -tag -width Ds
.It Cm uint32_t total_size() const
Retrieve the total size of the disk in mebibytes (MiB).
.It Cm uint32_t free_space() const
Retrieve the amount of free space available on the disk in mebibytes (MiB).
.It Cm uint32_t contiguous_block() const
Retrieve the size of the largest contiguous block of free space on the disk
in mebibytes (MiB).
.It Cm uint32_t sector_size() const
Retrieve the sector size of the disk in bytes.
.El
.Ss Class methods - Partitions
The
.Nm
class provides the following accessors for retrieving partitions associated
with the disk's label, if present:
.Bl -tag -width Ds
.It Cm 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.
.It Cm 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.
.El
.Sh SEE ALSO
.Xr Horizon::DiskMan::Disk::name 3 ,
.Xr Horizon::DiskMan::Disk::label 3 ,
.Xr Horizon::DiskMan::Disk::fs_type 3 ,
.Xr Horizon::DiskMan::Disk::total_size 3 ,
.Xr Horizon::DiskMan::Disk::partitions 3 ,
.Xr Horizon::DiskMan::DiskMan 3 ,
.Xr Horizon::DiskMan::Partition 3 .
.Sh HISTORY
The DiskMan library first appeared in Horizon 0.9.
.Sh AUTHORS
.An A. Wilcox
.Aq awilfox@adelielinux.org