59 [[nodiscard]]
auto GetName() const -> const
char* override;
140 auto Lookup(
vfs::Inode* dir,
const char* name)
257 std::array<char, kPathBufSize>
path{};
314 auto FreeFil(FIL* fil) -> void;
326 auto FreeDir(DIR* dir) -> void;
auto Close(vfs::File *file) -> Expected< void > override
关闭文件,释放底层 FIL 对象
auto Read(vfs::File *file, void *buf, size_t count) -> Expected< size_t > override
从文件读取数据
auto Seek(vfs::File *file, int64_t offset, vfs::SeekWhence whence) -> Expected< uint64_t > override
移动文件读写位置
auto Write(vfs::File *file, const void *buf, size_t count) -> Expected< size_t > override
向文件写入数据
FatFsFileOps(FatFsFileSystem *fs)
auto ReadDir(vfs::File *file, vfs::DirEntry *dirent, size_t count) -> Expected< size_t > override
读取目录条目
FatFsInodeOps(FatFsFileSystem *fs)
uint8_t volume_id_
FatFS 逻辑驱动器号
FatFsFileSystem(const FatFsFileSystem &)=delete
auto FreeInode(vfs::Inode *inode) -> Expected< void > override
释放 inode
std::array< FatFileHandle, kMaxOpenFiles > fil_pool_
auto AllocateFatInode() -> FatInode *
从 inode 池中分配一个空闲槽位
auto FreeFil(FIL *fil) -> void
归还 FIL 对象到池中
static auto SetBlockDevice(uint8_t pdrv, vfs::BlockDevice *device) -> void
注册块设备(由 Mount 调用,供 diskio.cpp 的 C 回调使用)
auto AllocateFil() -> FIL *
从 FIL 池中分配一个空闲 FIL 对象
auto operator=(const FatFsFileSystem &) -> FatFsFileSystem &=delete
static std::array< vfs::BlockDevice *, FF_VOLUMES > block_devices_
每卷块设备注册表(静态,供 diskio.cpp C 回调访问)
static constexpr size_t kMaxOpenFiles
同时打开文件数上限
auto Unmount() -> Expected< void > override
卸载 FatFS 卷
~FatFsFileSystem() override
auto FreeDir(DIR *dir) -> void
归还 DIR 对象到池中
FatFsInodeOps inode_ops_
inode 操作单例
static constexpr uint32_t kRootDirPermissions
根目录权限位
FatFsFileOps file_ops_
文件操作单例
static constexpr size_t kPathBufSize
路径缓冲区大小(字节)
static constexpr uint32_t kDefaultFilePermissions
普通文件默认权限位
vfs::Inode * root_inode_
根目录 inode(Mount 时设置)
auto AllocateDir() -> DIR *
从 DIR 池中分配一个空闲 DIR 对象
static auto GetBlockDevice(uint8_t pdrv) -> vfs::BlockDevice *
获取指定驱动器的块设备
auto Sync() -> Expected< void > override
刷新所有脏缓冲区
static constexpr size_t kMaxInodes
inode 池容量
auto FreeFatInode(FatInode *fi) -> void
释放 inode 池槽位
auto AllocateInode() -> Expected< vfs::Inode * > override
分配新 inode(由 FatFS FILINFO 快照支撑)
std::array< FatDirHandle, kMaxOpenDirs > dir_pool_
auto GetFileOps() -> vfs::FileOps *override
返回本文件系统的 FileOps 实例
auto OpenFil(vfs::Inode *inode, vfs::OpenFlags open_flags) -> Expected< void >
为 inode 打开底层 FatFS FIL 对象
auto Mount(vfs::BlockDevice *device) -> Expected< vfs::Inode * > override
挂载 FatFS 卷
auto operator=(FatFsFileSystem &&) -> FatFsFileSystem &=delete
static constexpr size_t kMaxOpenDirs
同时打开目录数上限
std::array< FatInode, kMaxInodes > inodes_
auto GetName() const -> const char *override
返回 "fatfs"
FatFsFileSystem(FatFsFileSystem &&)=delete
FATFS fatfs_obj_
FatFS 文件系统对象(每卷一个)
std::expected< T, Error > Expected
std::expected 别名模板
std::array< char, kPathBufSize > path
卷内绝对路径(供 FatFS 操作使用)
FIL * fil
FIL 对象(普通文件打开时使用);目录或未使用时为 nullptr.
DIR * dir
DIR 对象(目录迭代状态);未迭代时为 nullptr.
File — 打开的文件实例(每次 open 产生一个)