libxr  1.0
Want to be the best embedded framework
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:
55 enum class FileType : uint8_t
56 {
57 READ_ONLY,
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);
105} // namespace LibXR
RamFS 的目录节点片段 / Directory-node fragment of RamFS
Definition dir.hpp:9
轻量级内存文件系统 / 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
static char * DuplicateName(const char *name)
复制并持有一个节点名称 / Duplicate and retain one node name
Definition ramfs.cpp:29
static int CompareStr(const char *const &a, const char *const &b)
RamFS 名称比较函数 / Name comparator used by RamFS trees.
Definition ramfs.cpp:20
FileType
文件内部存储形态 / Internal storage kind of one file node
Definition ramfs.hpp:56
@ READ_ONLY
只读外部数据映射 / Read-only external-data view
@ READ_WRITE
可写外部数据映射 / Read-write external-data view
@ EXEC
可执行命令入口 / Executable command entry
LibXR 命名空间
Definition ch32_can.hpp:14