aboutsummaryrefslogtreecommitdiff
path: root/kernel/src/filesystem/rootfs/rootfs_filesystem.cpp
blob: 22502aa08a4dea6c60280a1e751e0c4e0cf7ba5f (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
#include "kernel/filesystem/rootfs/rootfs_filesystem.hpp"

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

#include <kstd/memory>

#include <string_view>

namespace filesystem::rootfs
{
  auto rootfs_filesystem::mount(kstd::shared_ptr<devices::device> const &) -> int
  {
    auto rfs_inode = kstd::make_shared<rootfs_inode>();
    rfs_inode->add_child("dev");
    m_root_inode = rfs_inode;

    return 0;
  }

  auto rootfs_filesystem::lookup(kstd::shared_ptr<inode> const & parent, std::string_view name)
      -> kstd::shared_ptr<inode>
  {
    if (auto * rfs_inode = static_cast<rootfs_inode *>(parent.get()))
      return rfs_inode->lookup_child(name);
    return nullptr;
  }
}  // namespace filesystem::rootfs