1. Overview
The FsTabEntry module provides fstab parsing and device resolution for BastionGuard Backup. It models Linux filesystem-table entries, reads and writes fstab-compatible text, extracts BTRFS subvolume options, identifies system mount points, and resolves physical or encrypted devices.
The implementation is written in Vala and uses GLib/GIO together with the application utility namespaces required by the file.
2. Dependencies and Integration
The module imports:
TeeJee.LoggingTeeJee.FileSystemTeeJee.JsonHelperTeeJee.ProcessHelperTeeJee.GtkHelperTeeJee.SystemTeeJee.Misc
Key runtime integrations include:
- GTK – graphical widgets, dialogs, images, event processing, or window lifecycle
- Gee – typed lists, maps, queues, or collection operations
3. Declared Types
3.1 FsTabEntry
public class FsTabEntry : GLib.Object
This class encapsulates the state and operations described by this source file.
4. State, Properties, Constants, and Signals
Public and protected state
public bool is_comment– Boolean state controlling or reporting comment.public bool is_empty_line– Boolean state controlling or reporting empty line.public string device_string– Runtime state used by the module.public string mount_point– Filesystem mount location.public string type– Runtime state used by the module.public string options– Runtime state used by the module.public string dump– Runtime state used by the module.public string pass– Runtime state used by the module.public string line– Runtime state used by the module.public string device_uuid– Runtime state used by the module.
5. Public API and Operational Methods
5.1 read_file()
public static Gee.ArrayList<FsTabEntry> read_file(string file_path)
Reads and parses file into the module data model.
- Performs filesystem access and handles files or directories through GLib or TeeJee helpers.
5.2 write_file()
public static string write_file( Gee.ArrayList<FsTabEntry> entries, string file_path, bool keep_comments_and_empty_lines = false)
Serializes and writes file to its configured destination.
- Performs filesystem access and handles files or directories through GLib or TeeJee helpers.
5.3 subvolume_name()
public string subvolume_name()
Implements the subvolume name operation for this module.
5.4 is_for_system_directory()
public bool is_for_system_directory()
Evaluates is for system directory and returns a Boolean capability or state result.
5.5 find_entry_by_mount_point()
public static FsTabEntry? find_entry_by_mount_point(Gee.ArrayList<FsTabEntry> entries, string mount_path)
Searches for entry by mount point and returns the matching object or value.
5.6 resolve_device()
public Device? resolve_device(Gee.ArrayList<CryptTabEntry> crypttab, Gtk.Window? parent_window)
Resolves the fstab device expression by UUID, device path, label, PARTUUID, or crypttab mapping and can trigger encrypted-device handling through the Device layer.
5.7 append_option()
public void append_option(string option)
Implements the append option operation for this module.
5.8 remove_option()
public void remove_option(string option)
Removes option and reports whether cleanup completed successfully.
6. Filesystem Paths and Resource Locations
The source references the following absolute or template paths:
/cdrom
/dev/
/dev/mapper/
/media
/mnt
/mount
/sdcard
Some values are templates completed at runtime with application names, process IDs, device identifiers, or file names.
7. External Commands and System Interfaces
The module constructs, checks, or parses commands containing:
# <file system> <mount point> <type> <options> <dump> <pass>\n\n
/mount
Execution success is determined from command exit status and, where applicable, parsed standard output or standard error.
8. Operational Flow
- Read or discover source data and normalize it into the module data model.
- Apply the requested operation and update runtime or persistent state.
- Finalize the operation and release files, mounts, child processes, widgets, or cached state.
9. Error Handling and Diagnostics
- Boolean, nullable, or empty-string return values communicate recoverable failures to callers.
10. Runtime and Security Considerations
- Dynamic command construction: caller-controlled values must be validated and escaped before being inserted into shell commands.
- Linux-specific paths: the module depends on Linux virtual filesystems or privileged system directories.
- Persistence: direct JSON writes may benefit from temporary-file and atomic-rename handling when configuration integrity is critical.
- Shared state: static caches and global switches are shared by all callers and are not automatically thread-isolated.
- GTK lifecycle: widgets and local main loops require a valid graphical context and careful close/destroy handling.
- Privilege and cleanup: mount or encryption operations should always pair successful setup with deterministic unmount or lock cleanup.
11. Licensing
The source is distributed under the GNU General Public License version 2 or any later version.
The source header identifies:
Copyright 2012-2018 Tony George <teejeetech@gmail.com>
