summaryrefslogtreecommitdiff
path: root/include/fs/extfs.hpp
blob: 0075572647123f644fd579858f52bae50a7c724b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef EXTFS_EXTFS_HPP
#define EXTFS_EXTFS_HPP

#include "fs/detail/superblock.hpp"

#include <fstream>
#include <string>

namespace fs
  {

  struct extfs
    {
    enum struct mode : char
      {
      read_only,
      writeable
      };

    /**
     * Open the filesystem at a given path
     *
     * @param path The path to a device/file containing an ext* file system.
     * @param openMode Whether to open the file system in read_only or writeable mode.
     * @since 1.0
     */
    explicit extfs(std::string const & path, mode const openMode = mode::read_only);

    /**
     * Check if the filesystem is valid
     */
    operator bool() const;

    private:
      std::fstream m_stream{};
      detail::extfs_superblock m_primarySuperblock{};
    };

  }

#endif