| 78 | } |
| 79 | |
| 80 | auto Init() -> Expected<void> { |
| 81 | if (GetVfsState().initialized) { |
| 82 | return {}; |
| 83 | } |
| 84 | |
| 85 | LockGuard<SpinLock> guard(GetVfsState().vfs_lock_); |
| 86 | klog::Info("VFS: initializing..."); |
| 87 | |
| 88 | // 初始化挂载表(使用全局单例,与 GetMountTable() 统一) |
| 89 | GetVfsState().mount_table = &GetMountTable(); |
| 90 | |
| 91 | GetVfsState().initialized = true; |
| 92 | klog::Info("VFS: initialization complete"); |
| 93 | return {}; |
| 94 | } |
| 95 | |
| 96 | auto GetRootDentry() -> Dentry* { return GetVfsState().root_dentry; } |
| 97 |