77
88use super :: types:: RawUname ;
99use crate :: backend:: c;
10- use crate :: backend:: conv:: { c_int, ret, ret_error , ret_infallible, slice} ;
11- #[ cfg( feature = "fs" ) ]
10+ use crate :: backend:: conv:: { c_int, ret, ret_infallible, slice} ;
11+ #[ cfg( any ( target_os = "linux" , target_os = "android" ) ) ]
1212use crate :: fd:: BorrowedFd ;
1313use crate :: ffi:: CStr ;
1414use crate :: io;
@@ -51,12 +51,11 @@ pub(crate) fn reboot(cmd: RebootCommand) -> io::Result<()> {
5151 }
5252}
5353
54- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
5554#[ inline]
56- pub ( crate ) fn init_module ( image : & [ u8 ] , param_values : & CStr ) -> io:: Errno {
55+ pub ( crate ) fn init_module ( image : & [ u8 ] , param_values : & CStr ) -> io:: Result < ( ) > {
5756 let ( image, len) = slice ( image) ;
5857 unsafe {
59- ret_error ( syscall_readonly ! (
58+ ret ( syscall_readonly ! (
6059 __NR_init_module,
6160 image,
6261 len,
@@ -65,12 +64,14 @@ pub(crate) fn init_module(image: &[u8], param_values: &CStr) -> io::Errno {
6564 }
6665}
6766
68- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
69- #[ cfg( feature = "fs" ) ]
7067#[ inline]
71- pub ( crate ) fn finit_module ( fd : BorrowedFd < ' _ > , param_values : & CStr , flags : c:: c_int ) -> io:: Errno {
68+ pub ( crate ) fn finit_module (
69+ fd : BorrowedFd < ' _ > ,
70+ param_values : & CStr ,
71+ flags : c:: c_int ,
72+ ) -> io:: Result < ( ) > {
7273 unsafe {
73- ret_error ( syscall_readonly ! (
74+ ret ( syscall_readonly ! (
7475 __NR_finit_module,
7576 fd,
7677 param_values,
@@ -79,9 +80,7 @@ pub(crate) fn finit_module(fd: BorrowedFd<'_>, param_values: &CStr, flags: c::c_
7980 }
8081}
8182
82- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
83- #[ cfg( feature = "fs" ) ]
8483#[ inline]
85- pub ( crate ) fn delete_module ( name : & CStr , flags : c:: c_int ) -> io:: Errno {
86- unsafe { ret_error ( syscall_readonly ! ( __NR_delete_module, name, c_int( flags) ) ) }
84+ pub ( crate ) fn delete_module ( name : & CStr , flags : c:: c_int ) -> io:: Result < ( ) > {
85+ unsafe { ret ( syscall_readonly ! ( __NR_delete_module, name, c_int( flags) ) ) }
8786}
0 commit comments