MCPcopy Create free account
hub / github.com/bendudson/EuraliOS / sys_umount

Function sys_umount

kernel/src/syscalls.rs:882–910  ·  view source on GitHub ↗

Remove a mount point. Most of this code is the same as `sys_mount`

(
    context_ptr: *mut Context,
    path_ptr: *const u8,
    path_len: u64)

Source from the content-addressed store, hash-verified

880/// Remove a mount point.
881/// Most of this code is the same as `sys_mount`
882fn sys_umount(
883 context_ptr: *mut Context,
884 path_ptr: *const u8,
885 path_len: u64) {
886
887 let context = unsafe {&mut (*context_ptr)};
888
889 // Convert raw pointer to a slice
890 let u8_slice = unsafe {slice::from_raw_parts(path_ptr, path_len as usize)};
891 let path_string = match str::from_utf8(u8_slice) {
892 Ok(s) => s,
893 Err(_) => {
894 // Bad utf8 conversion
895 context.rax = SYSCALL_ERROR_UTF8;
896 return;
897 }
898 };
899 if let Some(mut thread) = process::take_current_thread() {
900 thread.set_context(context_ptr);
901
902 let mut vfs = thread.vfs(); // An Arc clone of the VFS
903 if vfs.umount(path_string).is_err() {
904 context.rax = SYSCALL_ERROR_NOTFOUND;
905 } else {
906 context.rax = 0; // No error
907 }
908 process::set_current_thread(thread);
909 }
910}
911
912fn sys_close(context_ptr: *mut Context, handle: u64) {
913 // Extract the current thread

Callers 1

dispatch_syscallFunction · 0.85

Calls 5

take_current_threadFunction · 0.85
set_current_threadFunction · 0.85
set_contextMethod · 0.80
vfsMethod · 0.80
umountMethod · 0.80

Tested by

no test coverage detected