Skip to content
API Documentation
BastionGuard™
MountEntry.vala
Go to the documentation of this file.
6using TeeJee.System;
7using TeeJee.Misc;
8using Json;
9
10public class MountEntry : GLib.Object{
11
12 public Device device = null;
13 public string mount_point = "";
14 public string mount_options = "";
15
17
18 this.device = device;
19 this.mount_point = mount_point;
20 this.mount_options = mount_options;
21 }
22
23 public string subvolume_name(){
24
25 if (mount_options.contains("subvol=")){
26
27 string txt = mount_options.split("subvol=")[1].split(",")[0].strip();
28
29 if (txt.has_prefix("/") && (txt.split("/").length == 2)){
30 txt = txt.split("/")[1];
31 }
32
33 return txt;
34 }
35 else{
36 return "";
37 }
38 }
39
40 public string lvm_name(){
41
42 if ((device != null) && (device.type == "lvm") && (device.mapped_name.length > 0)){
43 return device.mapped_name.strip();
44 }
45 else{
46 return "";
47 }
48 }
49
50 public static MountEntry? find_entry_by_mount_point(Gee.ArrayList<MountEntry> entries, string mount_path){
51
52 foreach(var entry in entries){
53 if (entry.mount_point == mount_path){
54 return entry;
55 }
56 }
57
58 return null;
59 }
60}
string type
Definition Device.vala:64
string mapped_name
Definition Device.vala:49
string mount_point
string subvolume_name()
string mount_options
Device device
string lvm_name()
static ? MountEntry find_entry_by_mount_point(Gee.ArrayList< MountEntry > entries, string mount_path)
MountEntry(Device? device, string mount_point, string mount_options)