19 if (path ==
nullptr || path[0] !=
'/') {
26 if (path[0] ==
'/' && (path[1] ==
'\0' || path[1] ==
'/')) {
46 while (*mount_path !=
'\0') {
69 if (current->
inode ==
nullptr ||
83 if (
strcmp(component,
".") == 0) {
86 if (
strcmp(component,
"..") == 0) {
87 if (current->
parent !=
nullptr) {
95 if (child ==
nullptr) {
97 if (current->
inode->
ops !=
nullptr) {
99 if (!result.has_value()) {
104 auto new_child = kstd::make_unique<Dentry>();
109 strncpy(new_child->name, component,
sizeof(new_child->name) - 1);
110 new_child->name[
sizeof(new_child->name) - 1] =
'\0';
111 new_child->inode = result.value();
112 child = new_child.get();
113 AddChild(current, new_child.release());
122 if (current->
inode !=
nullptr) {
124 GetVfsState().mount_table->FindByMountDentry(current);
125 if (next_mp !=
nullptr && next_mp != mp) {
Dentry — 目录项缓存(路径名 ↔ Inode 的映射)