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

Method FindInDirectory

src/filesystem/ramfs/ramfs.cpp:481–495  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479// 辅助函数实现
480
481auto RamFs::FindInDirectory(RamInode* dir, const char* name) -> RamDirEntry* {
482 if (dir == nullptr || dir->inode.type != FileType::kDirectory ||
483 dir->data == nullptr) {
484 return nullptr;
485 }
486
487 RamDirEntry* entries = static_cast<RamDirEntry*>(dir->data);
488 for (size_t i = 0; i < dir->child_count; ++i) {
489 if (strcmp(entries[i].name, name) == 0) {
490 return &entries[i];
491 }
492 }
493
494 return nullptr;
495}
496
497auto RamFs::AddToDirectory(RamInode* dir, const char* name, Inode* inode)
498 -> Expected<void> {

Callers 3

LookupMethod · 0.80
UnlinkMethod · 0.80
RmdirMethod · 0.80

Calls 1

strcmpFunction · 0.85

Tested by

no test coverage detected