From f5f8886e00d15a3af34e1dfaf12afb915000ad89 Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Sun, 30 Jun 2024 23:50:26 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20gucc:=20move=20partition=20struc?= =?UTF-8?q?t=20into=20own=20header?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gucc/include/gucc/fstab.hpp | 27 +++------------------------ gucc/include/gucc/partition.hpp | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 24 deletions(-) create mode 100644 gucc/include/gucc/partition.hpp diff --git a/gucc/include/gucc/fstab.hpp b/gucc/include/gucc/fstab.hpp index ce66954..4a41bd8 100644 --- a/gucc/include/gucc/fstab.hpp +++ b/gucc/include/gucc/fstab.hpp @@ -1,37 +1,16 @@ #ifndef FSTAB_HPP #define FSTAB_HPP -#include // for optional +#include "gucc/partition.hpp" + #include // for string #include // for string_view #include // for vector namespace gucc::fs { -struct Partition final { - std::string fstype; - std::string mountpoint; - std::string uuid_str; - std::string device; - - // mount points that will be written in fstab, - // excluding subvol={subvol name} - // if device is ssd, mount options for ssd should be appended - std::string mount_opts; - std::optional luks_mapper_name; - std::optional luks_uuid; - - /* - // subvolumes per partition - // e.g we have partition /dev/nvme0n1p1 with subvolumes: /@, /@home, /@cache - std::optional> subvols; - */ - // subvolume name if the partition is btrrfs subvolume - std::optional subvolume; -}; - // Generate fstab -auto generate_fstab(const std::vector& partitions, std::string_view root_mountpoint, std::string_view crypttab_opts) noexcept -> bool; +auto generate_fstab(const std::vector& partitions, std::string_view root_mountpoint) noexcept -> bool; // Generate fstab into string auto generate_fstab_content(const std::vector& partitions) noexcept -> std::string; diff --git a/gucc/include/gucc/partition.hpp b/gucc/include/gucc/partition.hpp new file mode 100644 index 0000000..d5bef54 --- /dev/null +++ b/gucc/include/gucc/partition.hpp @@ -0,0 +1,33 @@ +#ifndef PARTITION_HPP +#define PARTITION_HPP + +#include // for optional +#include // for string + +namespace gucc::fs { + +struct Partition final { + std::string fstype; + std::string mountpoint; + std::string uuid_str; + std::string device; + + // mount points that will be written in fstab, + // excluding subvol={subvol name} + // if device is ssd, mount options for ssd should be appended + std::string mount_opts; + std::optional luks_mapper_name; + std::optional luks_uuid; + + /* + // subvolumes per partition + // e.g we have partition /dev/nvme0n1p1 with subvolumes: /@, /@home, /@cache + std::optional> subvols; + */ + // subvolume name if the partition is btrrfs subvolume + std::optional subvolume; +}; + +} // namespace gucc::fs + +#endif // PARTITION_HPP