libxr 1.0
Want to be the best embedded framework
|
轻量级的内存文件系统,实现基本的文件、目录和设备管理 A lightweight in-memory file system implementing basic file, directory, and device management More...
#include <ramfs.hpp>
Data Structures | |
class | Device |
设备类,继承自红黑树节点 DeviceNode Device class inheriting from Red-Black tree node DeviceNode More... | |
class | DeviceNode |
设备节点,继承自 FsNode Device node, inheriting from FsNode More... | |
class | Dir |
目录类,继承自 RBTree 节点,用于管理文件、子目录和设备 Directory class, inheriting from RBTree node, used for managing files, subdirectories, and devices More... | |
class | DirNode |
目录节点,继承自 FsNode Directory node, inheriting from FsNode More... | |
class | FileNode |
文件节点类,继承自 FsNode,表示文件 File node class, inheriting from FsNode, representing a file More... | |
class | FsNode |
文件系统节点基类,所有文件和目录均继承自该类 Base class for file system nodes; all files and directories inherit from this More... | |
struct | StorageBlock |
Public Types | |
enum class | FsNodeType : uint8_t { FILE , DIR , DEVICE , STORAGE , UNKNOW } |
文件系统节点类型 Types of file system nodes More... | |
enum class | FileType : uint8_t { READ_ONLY , READ_WRITE , EXEC } |
文件类型 Types of files More... | |
typedef LibXR::RamFS::FileNode | FileNode |
typedef RBTree< const char * >::Node< FileNode > | File |
Public Member Functions | |
RamFS (const char *name="ramfs") | |
构造函数,初始化内存文件系统的根目录 Constructor that initializes the root directory of the in-memory file system | |
void | Add (File &file) |
向文件系统的根目录添加文件 Adds a file to the root directory of the file system | |
void | Add (Dir &dir) |
向文件系统的根目录添加子目录 Adds a subdirectory to the root directory of the file system | |
void | Add (Device &dev) |
向文件系统的根目录添加设备 Adds a device to the root directory of the file system | |
File * | FindFile (const char *name) |
在整个文件系统中查找文件 Finds a file in the entire file system | |
Dir * | FindDir (const char *name) |
在整个文件系统中查找目录 Finds a directory in the entire file system | |
Device * | FindDevice (const char *name) |
在整个文件系统中查找设备 Finds a device in the entire file system | |
Static Public Member Functions | |
static int | CompareStr (const char *const &a, const char *const &b) |
比较两个字符串 Compares two strings | |
template<typename DataType > | |
static File | CreateFile (const char *name, DataType &raw) |
创建一个新的文件 Creates a new file | |
template<typename ArgType > | |
static File | CreateFile (const char *name, int(*exec)(ArgType arg, int argc, char **argv), ArgType &&arg) |
创建一个可执行文件 Creates an executable file | |
static Dir | CreateDir (const char *name) |
创建一个新的目录 Creates a new directory | |
Data Fields | |
Dir | root_ |
文件系统的根目录 Root directory of the file system | |
Dir | bin_ |
bin 目录,用于存放可执行文件 bin directory for storing executable files | |
Dir | dev_ |
dev 目录,用于存放设备文件 dev directory for storing device files | |
轻量级的内存文件系统,实现基本的文件、目录和设备管理 A lightweight in-memory file system implementing basic file, directory, and device management
|
strong |
文件类型 Types of files
Enumerator | |
---|---|
READ_ONLY | 只读 Read-only |
READ_WRITE | 读写 Read/Write |
EXEC | 可执行 Executable |
|
strong |
构造函数,初始化内存文件系统的根目录 Constructor that initializes the root directory of the in-memory file system
name | 根目录的名称(默认为 "ramfs") Name of the root directory (default: "ramfs") |
Definition at line 28 of file ramfs.hpp.
向文件系统的根目录添加设备 Adds a device to the root directory of the file system
dev | 要添加的设备 The device to be added |
Definition at line 593 of file ramfs.hpp.
|
inline |
创建一个新的目录 Creates a new directory
name | 目录名称 The name of the directory |
创建一个新的文件 Creates a new file
DataType | 文件存储的数据类型 Data type stored in the file |
name | 文件名 The name of the file |
raw | 文件存储的数据 Data stored in the file |
Definition at line 493 of file ramfs.hpp.
|
inlinestatic |
创建一个可执行文件 Creates an executable file
ArgType | 可执行文件的参数类型 The argument type for the executable file |
name | 文件名 The name of the file |
exec | 可执行函数 The executable function |
arg | 可执行文件的参数 The argument for the executable file |
Definition at line 526 of file ramfs.hpp.
在整个文件系统中查找设备 Finds a device in the entire file system
name | 设备名 The name of the device |
Definition at line 618 of file ramfs.hpp.
在整个文件系统中查找目录 Finds a directory in the entire file system
name | 目录名 The name of the directory |
Definition at line 610 of file ramfs.hpp.
在整个文件系统中查找文件 Finds a file in the entire file system
name | 文件名 The name of the file |
Definition at line 602 of file ramfs.hpp.
Dir LibXR::RamFS::bin_ |
Dir LibXR::RamFS::dev_ |
Dir LibXR::RamFS::root_ |