libxr
Embedded C++ framework for bare-metal, RTOS and Linux
Loading...
Searching...
No Matches
ramfs.hpp
1#pragma once
2
3#include <cstdlib>
4#include <cstring>
5#include <type_traits>
6#include <utility>
7
8#include "libxr_assert.hpp"
9#include "libxr_type.hpp"
10#include "rbt.hpp"
11
12namespace LibXR
13{
22class RamFS
24 public:
32 RamFS(const char* name = "ramfs");
33
37 enum class FsNodeType : uint8_t
38 {
39 FILE,
40 DIR,
41 CUSTOM,
42 };
43
44 class Dir;
45
46 private:
50 using Tree = RBTree<const char*>;
55 enum class FileType : uint8_t
56 {
57 READ_ONLY,
58 READ_WRITE,
59 EXEC,
60 };
61
69 static int CompareStr(const char* const& a, const char* const& b);
70
71 public:
75#include "fs_node.hpp"
79#include "file.hpp"
83#include "custom.hpp"
87#include "dir.hpp"
91#include "factory.hpp"
93 private:
103 static char* DuplicateName(const char* name);
104};
105} // namespace LibXR
RamFS 的目录节点片段 / Directory-node fragment of RamFS
Definition dir.hpp:9
红黑树实现,支持泛型键和值,并提供线程安全操作 Red-Black Tree implementation supporting generic keys and values with thread-...
Definition rbt.hpp:23
轻量级内存文件系统 / Lightweight in-memory file system
Definition ramfs.hpp:23
RamFS(const char *name="ramfs")
构造 RamFS,并创建根目录和 bin 目录 / Construct RamFS with root and bin directories
Definition ramfs.cpp:10
FsNodeType
文件系统节点类型 / File-system node type
Definition ramfs.hpp:38
@ CUSTOM
用户自定义节点 / User-defined node
@ DIR
目录 / Directory
LibXR 命名空间 / LibXR namespace.
Definition ch32_can.hpp:14