Documentation
¶
Overview ¶
Package btrfs reads what the btrfs commands say of the subvolumes of a filesystem.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListArgs ¶
ListArgs are the arguments of the list command ParseList reads the output of: the subvolumes with their creation generation, uuids and paths, the read-only ones alone when readOnly.
func MountOfSubvol ¶
MountOfSubvol returns the mount point of the subvolume at path, or of a subvolume below it, from the content of a /proc/self/mountinfo.
A mount of a btrfs subvolume has the path of the subvolume as its root. The filesystem it is of is not told apart: a subvolume of another btrfs at the same path is taken for this one, which a caller checking a subvolume is not mounted before replacing it errs on the safe side with.
Types ¶
type Location ¶
Location is a subvolume of the btrfs filesystem of a label, as the sync keywords name it: <label>:<subvol>.
The label names the filesystem on every node: its device may change from a node to another, its label does not. The subvolume is the path from the root of the filesystem, the one an fs.btrfs resource mounts with the subvol=<subvol> mount option.
func ParseLocation ¶
ParseLocation reads a <label>:<subvol> value. The subvolume is not the root of the filesystem.
type Subvol ¶
type Subvol struct {
ID int64
// CGen is the generation the subvolume was created at. It orders
// the subvolumes of a filesystem by creation, a received one by the
// time it was received.
CGen int64
// Path is relative to the root of the filesystem when listed on a
// mount of its root, subvolid=5.
Path string
UUID string
ParentUUID string
ReceivedUUID string
}
Subvol is a subvolume, as "btrfs subvolume list -c -u -q -R" lists it.
func ParseList ¶
ParseList reads the output of "btrfs subvolume list -c -u -q -R", a line per subvolume:
ID 257 gen 8 cgen 8 top level 5 parent_uuid <u> received_uuid <u> uuid <u> path <path>
The path is the end of the line, spaces included.
func (Subvol) Identity ¶
Identity is the identifier of the snapshot that is the same on both ends of a send: the uuid of the snapshot sent is the received uuid of its copy.
A copy sent on to another node keeps the identity of the original, as a send names its parent by its received uuid when it has one, and a receive looks it up by received uuid then by uuid. So the snapshots two nodes hold in common are the ones with the same identity, whichever node was the source.
func (Subvol) IsReceived ¶
IsReceived reports whether the subvolume was made by a receive.