MCPcopy Create free account
hub / github.com/Simple-XX/SimpleKernel / ReadDir

Function ReadDir

src/filesystem/vfs/readdir.cpp:13–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11namespace vfs {
12
13auto ReadDir(File* file, DirEntry* dirent, size_t count) -> Expected<size_t> {
14 if (file == nullptr || dirent == nullptr) {
15 return std::unexpected(Error(ErrorCode::kInvalidArgument));
16 }
17
18 LockGuard<SpinLock> guard(GetVfsState().vfs_lock_);
19 if (file->inode == nullptr || file->inode->type != FileType::kDirectory) {
20 return std::unexpected(Error(ErrorCode::kFsNotADirectory));
21 }
22
23 if (file->ops == nullptr) {
24 return std::unexpected(Error(ErrorCode::kDeviceNotSupported));
25 }
26
27 return file->ops->ReadDir(file, dirent, count);
28}
29} // namespace vfs

Callers 2

ramfs_testFunction · 0.85
fatfs_testFunction · 0.85

Calls 3

ErrorClass · 0.85
GetVfsStateFunction · 0.85
ReadDirMethod · 0.45

Tested by 2

ramfs_testFunction · 0.68
fatfs_testFunction · 0.68