MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / dev_new

Function dev_new

src/fs/mod.rs:135–145  ·  view source on GitHub ↗

Create a new device

(path: &str, tp: DevType)

Source from the content-addressed store, hash-verified

133
134// Create a new device
135pub fn dev_new(path: &str, tp: DevType) -> Option<usize>
136{
137 let flags = OpenFlag::CREATE as usize | OpenFlag::DEVICE as usize;
138 if let Some(handle) = crate::sys::sc::open(path, flags)
139 {
140 let buffer = [tp as u8; 1];
141 return crate::sys::sc::write(handle, &buffer);
142 }
143
144 None
145}
146
147
148// Open device

Callers 1

new_devFunction · 0.85

Calls 2

openFunction · 0.70
writeFunction · 0.70

Tested by

no test coverage detected