~aleteoryx/muditaos

ref: ca75ebe4499b738d5b0e83fa07840ec013522abd muditaos/module-vfs/include/user/purefs/fs/directory_handle.hpp -rw-r--r-- 1001 bytes
ca75ebe4 — Lucjan Bryndza [EGD-7587] Change user partition to ext4 fs 4 years ago
                                                                                
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
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once
#include <memory>

namespace purefs::fs::internal
{
    class mount_point;
    class directory_handle
    {
      public:
        directory_handle(std::shared_ptr<mount_point> mp, int error) : m_error(error), m_mount_point(mp)
        {}
        directory_handle(const directory_handle &) = delete;
        auto operator=(const directory_handle &) = delete;
        virtual ~directory_handle()              = default;
        auto error(int error) noexcept -> void
        {
            m_error = error;
        }
        [[nodiscard]] auto error() noexcept
        {
            return m_error;
        }
        [[nodiscard]] auto mntpoint() noexcept
        {
            return m_mount_point.lock();
        }

      private:
        int m_error{};
        const std::weak_ptr<mount_point> m_mount_point;
    };
} // namespace purefs::fs::internal