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

Method create

api/src/vfs/tmp.rs:378–393  ·  view source on GitHub ↗
(
        &self,
        name: &str,
        node_type: NodeType,
        permission: NodePermission,
    )

Source from the content-addressed store, hash-verified

376 }
377
378 fn create(
379 &self,
380 name: &str,
381 node_type: NodeType,
382 permission: NodePermission,
383 ) -> VfsResult<DirEntry> {
384 let dir = self.inode.as_dir()?;
385 let mut entries = dir.entries.lock();
386
387 if entries.contains_key(name) {
388 return Err(VfsError::AlreadyExists);
389 }
390 let inode = Inode::new(&self.fs, Some(self.inode.ino), node_type, permission);
391 entries.insert(name.into(), InodeRef::new(self.fs.clone(), inode.ino));
392 self.new_entry(name, node_type, inode)
393 }
394
395 fn link(&self, name: &str, target: &DirEntry) -> VfsResult<DirEntry> {
396 let dir = self.inode.as_dir()?;

Callers 2

flags_to_optionsFunction · 0.45
sys_memfd_createFunction · 0.45

Calls 3

as_dirMethod · 0.80
insertMethod · 0.80
new_entryMethod · 0.80

Tested by

no test coverage detected