1
- use super :: abi :: {
1
+ use super :: hermit_abi :: {
2
2
self , dirent64, stat as stat_struct, DT_DIR , DT_LNK , DT_REG , DT_UNKNOWN , O_APPEND , O_CREAT ,
3
3
O_EXCL , O_RDONLY , O_RDWR , O_TRUNC , O_WRONLY , S_IFDIR , S_IFLNK , S_IFMT , S_IFREG ,
4
4
} ;
@@ -361,7 +361,7 @@ impl File {
361
361
mode = 0 ;
362
362
}
363
363
364
- let fd = unsafe { cvt ( abi :: open ( path. as_ptr ( ) , flags, mode) ) ? } ;
364
+ let fd = unsafe { cvt ( hermit_abi :: open ( path. as_ptr ( ) , flags, mode) ) ? } ;
365
365
Ok ( File ( unsafe { FileDesc :: from_raw_fd ( fd as i32 ) } ) )
366
366
}
367
367
@@ -442,7 +442,7 @@ impl DirBuilder {
442
442
443
443
pub fn mkdir ( & self , path : & Path ) -> io:: Result < ( ) > {
444
444
run_path_with_cstr ( path, & |path| {
445
- cvt ( unsafe { abi :: mkdir ( path. as_ptr ( ) , self . mode ) } ) . map ( |_| ( ) )
445
+ cvt ( unsafe { hermit_abi :: mkdir ( path. as_ptr ( ) , self . mode ) } ) . map ( |_| ( ) )
446
446
} )
447
447
}
448
448
@@ -504,7 +504,7 @@ impl FromRawFd for File {
504
504
}
505
505
506
506
pub fn readdir ( path : & Path ) -> io:: Result < ReadDir > {
507
- let fd_raw = run_path_with_cstr ( path, & |path| cvt ( unsafe { abi :: opendir ( path. as_ptr ( ) ) } ) ) ?;
507
+ let fd_raw = run_path_with_cstr ( path, & |path| cvt ( unsafe { hermit_abi :: opendir ( path. as_ptr ( ) ) } ) ) ?;
508
508
let fd = unsafe { FileDesc :: from_raw_fd ( fd_raw as i32 ) } ;
509
509
let root = path. to_path_buf ( ) ;
510
510
@@ -516,7 +516,7 @@ pub fn readdir(path: &Path) -> io::Result<ReadDir> {
516
516
vec. resize ( sz, 0 ) ;
517
517
518
518
let readlen =
519
- unsafe { abi :: getdents64 ( fd. as_raw_fd ( ) , vec. as_mut_ptr ( ) as * mut dirent64 , sz) } ;
519
+ unsafe { hermit_abi :: getdents64 ( fd. as_raw_fd ( ) , vec. as_mut_ptr ( ) as * mut dirent64 , sz) } ;
520
520
if readlen > 0 {
521
521
// shrink down to the minimal size
522
522
vec. resize ( readlen. try_into ( ) . unwrap ( ) , 0 ) ;
@@ -525,7 +525,7 @@ pub fn readdir(path: &Path) -> io::Result<ReadDir> {
525
525
526
526
// if the buffer is too small, getdents64 returns EINVAL
527
527
// otherwise, getdents64 returns an error number
528
- if readlen != ( -abi :: errno:: EINVAL ) . into ( ) {
528
+ if readlen != ( -hermit_abi :: errno:: EINVAL ) . into ( ) {
529
529
return Err ( Error :: from_raw_os_error ( readlen. try_into ( ) . unwrap ( ) ) ) ;
530
530
}
531
531
@@ -543,7 +543,7 @@ pub fn readdir(path: &Path) -> io::Result<ReadDir> {
543
543
}
544
544
545
545
pub fn unlink ( path : & Path ) -> io:: Result < ( ) > {
546
- run_path_with_cstr ( path, & |path| cvt ( unsafe { abi :: unlink ( path. as_ptr ( ) ) } ) . map ( |_| ( ) ) )
546
+ run_path_with_cstr ( path, & |path| cvt ( unsafe { hermit_abi :: unlink ( path. as_ptr ( ) ) } ) . map ( |_| ( ) ) )
547
547
}
548
548
549
549
pub fn rename ( _old : & Path , _new : & Path ) -> io:: Result < ( ) > {
@@ -555,7 +555,7 @@ pub fn set_perm(_p: &Path, _perm: FilePermissions) -> io::Result<()> {
555
555
}
556
556
557
557
pub fn rmdir ( path : & Path ) -> io:: Result < ( ) > {
558
- run_path_with_cstr ( path, & |path| cvt ( unsafe { abi :: rmdir ( path. as_ptr ( ) ) } ) . map ( |_| ( ) ) )
558
+ run_path_with_cstr ( path, & |path| cvt ( unsafe { hermit_abi :: rmdir ( path. as_ptr ( ) ) } ) . map ( |_| ( ) ) )
559
559
}
560
560
561
561
pub fn remove_dir_all ( _path : & Path ) -> io:: Result < ( ) > {
@@ -577,15 +577,15 @@ pub fn link(_original: &Path, _link: &Path) -> io::Result<()> {
577
577
pub fn stat ( path : & Path ) -> io:: Result < FileAttr > {
578
578
run_path_with_cstr ( path, & |path| {
579
579
let mut stat_val: stat_struct = unsafe { mem:: zeroed ( ) } ;
580
- cvt ( unsafe { abi :: stat ( path. as_ptr ( ) , & mut stat_val) } ) ?;
580
+ cvt ( unsafe { hermit_abi :: stat ( path. as_ptr ( ) , & mut stat_val) } ) ?;
581
581
Ok ( FileAttr :: from_stat ( stat_val) )
582
582
} )
583
583
}
584
584
585
585
pub fn lstat ( path : & Path ) -> io:: Result < FileAttr > {
586
586
run_path_with_cstr ( path, & |path| {
587
587
let mut stat_val: stat_struct = unsafe { mem:: zeroed ( ) } ;
588
- cvt ( unsafe { abi :: lstat ( path. as_ptr ( ) , & mut stat_val) } ) ?;
588
+ cvt ( unsafe { hermit_abi :: lstat ( path. as_ptr ( ) , & mut stat_val) } ) ?;
589
589
Ok ( FileAttr :: from_stat ( stat_val) )
590
590
} )
591
591
}
0 commit comments