MCPcopy Create free account
hub / github.com/Starry-OS/StarryOS / new

Method new

api/src/vfs/tmp.rs:61–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 /// Creates a new empty memory filesystem.
60 #[allow(clippy::new_ret_no_self)]
61 pub fn new() -> Filesystem {
62 let fs = Arc::new(Self {
63 inodes: Mutex::new(Slab::new()),
64 root: Mutex::default(),
65 });
66 let root_ino = Inode::new(
67 &fs,
68 None,
69 NodeType::Directory,
70 NodePermission::from_bits_truncate(0o755),
71 );
72 *fs.root.lock() = Some(DirEntry::new_dir(
73 |this| DirNode::new(MemoryNode::new(fs.clone(), root_ino, Some(this))),
74 Reference::root(),
75 ));
76 Filesystem::new(fs)
77 }
78
79 fn get(&self, ino: u64) -> Arc<Inode> {
80 self.inodes.lock()[ino as usize - 1].clone()

Callers

nothing calls this directly

Calls 3

FileClass · 0.85
insertMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected