alnyan/yggdrasil: implement rename() syscall
This commit is contained in:
parent
97aa48417d
commit
9a21c79df2
@ -1,6 +1,6 @@
|
|||||||
use yggdrasil_rt::io::{
|
use yggdrasil_rt::io::{
|
||||||
FileAttr as OsFileAttr, FileMetadataUpdate, FileMetadataUpdateMode, FileMode as OsFileMode,
|
FileAttr as OsFileAttr, FileMetadataUpdate, FileMetadataUpdateMode, FileMode as OsFileMode,
|
||||||
FileType as OsFileType, RawFd as OsRawFd,
|
FileType as OsFileType, RawFd as OsRawFd, Rename,
|
||||||
};
|
};
|
||||||
use yggdrasil_rt::time::SystemTime as RtSystemTime;
|
use yggdrasil_rt::time::SystemTime as RtSystemTime;
|
||||||
|
|
||||||
@ -139,8 +139,17 @@ pub fn unlink(path: &Path) -> io::Result<()> {
|
|||||||
run_with_path_str(path, |path_str| cvt_io(unsafe { yggdrasil_rt::sys::remove(None, path_str) }))
|
run_with_path_str(path, |path_str| cvt_io(unsafe { yggdrasil_rt::sys::remove(None, path_str) }))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
|
pub fn rename(old: &Path, new: &Path) -> io::Result<()> {
|
||||||
todo!()
|
let old = old.to_str().unwrap();
|
||||||
|
let new = new.to_str().unwrap();
|
||||||
|
cvt_io(unsafe {
|
||||||
|
yggdrasil_rt::sys::rename(&Rename {
|
||||||
|
source_at: None,
|
||||||
|
destination_at: None,
|
||||||
|
source: old,
|
||||||
|
destination: new,
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_perm(path: &Path, perm: FilePermissions) -> io::Result<()> {
|
pub fn set_perm(path: &Path, perm: FilePermissions) -> io::Result<()> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user