aboutsummaryrefslogtreecommitdiff
path: root/kernel/include/kernel/filesystem/device_inode.hpp
blob: af2a51bcf6c259199d4a82b1fd65d4f1755583a7 (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
#ifndef TEACH_OS_KERNEL_FILESYSTEM_DEVICE_INODE_HPP
#define TEACH_OS_KERNEL_FILESYSTEM_DEVICE_INODE_HPP

#include "kernel/devices/device.hpp"
#include "kernel/filesystem/inode.hpp"

#include <kstd/memory>

namespace filesystem
{
  struct file;

  struct device_inode : inode
  {
    explicit device_inode(kstd::shared_ptr<devices::device> const & device);

    [[nodiscard]] auto open_file(kstd::shared_ptr<inode> const & self) const -> kstd::shared_ptr<file> override;

    [[nodiscard]] auto device() const -> kstd::shared_ptr<devices::device> const &;

  private:
    kstd::shared_ptr<devices::device> m_device{};
  };
}  // namespace filesystem

#endif