feat: I/O safety for 'kmod'
//! For more details see
use std::ffi::CStr;
-use std::os::unix::io::AsRawFd;
+use std::os::unix::io::{AsFd, AsRawFd};
use crate::errno::Errno;
use crate::Result;
@@ -79,15 +79,15 @@ libc_bitflags!(
/// ```
///
/// See [`man init_module(2)`](https://man7.org/linux/man-pages/man2/init_module.2.html) for more information.
-pub fn finit_module<T: AsRawFd>(
- fd: &T,
+pub fn finit_module<Fd: AsFd>(
+ fd: &Fd,
param_values: &CStr,
flags: ModuleInitFlags,
) -> Result<()> {
let res = unsafe {
libc::syscall(
libc::SYS_finit_module,
- fd.as_raw_fd(),
+ fd.as_fd().as_raw_fd(),
param_values.as_ptr(),
flags.bits(),
)
