}
}
+void OS::do_resize2fs(const fs::path& fs_path, uint64_t size_kB)
+{
+ const auto child_pid = OS::throwing_fork();
+ if (child_pid == 0) {
+ const auto cmd = "/usr/sbin/resize2fs"sv;
+
+ const auto size_arg = std::to_string(size_kB);
+
+ const auto r = execl
+ ( cmd.data(), cmd.data() /* argv[0] convention */
+ , fs_path.c_str()
+ , size_arg.c_str()
+ , (char *) NULL
+ );
+
+ LOGE("Failed to execute `%s %s %s`: %m"
+ , cmd.data()
+ , fs_path.c_str()
+ , size_arg.c_str()
+ );
+ assert(r == -1);
+
+ _exit(1);
+ } else {
+ OS::throw_if_child_failed(child_pid, "resize2fs failed!");
+ }
+}
+
void OS::do_umount(const fs::path& path)
{
const auto child_pid = OS::throwing_fork();
void do_mkfs(const fs::path& image_path, int uid, int gid, uint64_t size_kB);
+ void do_resize2fs(const fs::path& fs_path, uint64_t size_kB);
+
void do_mount(const fs::path& image_path, const fs::path& mount_path);
void do_umount(const fs::path& path);