Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
surban committed Mar 14, 2024
1 parent 897c511 commit 7f69fc8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ bytes = "1.4"
libc = "0.2"
log = "0.4"
macaddr = "1.0"
nix = { version = "0.27", features = ["mount", "event", "ioctl", "poll", "fs"] }
nix = { version = "0.28", features = ["mount", "event", "ioctl", "poll", "fs"] }
proc-mounts = "0.3"
strum = { version = "0.25", features = ["derive"] }
strum = { version = "0.26", features = ["derive"] }
tokio = { version = "1.32", features = ["net", "rt", "sync"], optional = true }
uuid = "1"

[dev-dependencies]
env_logger = "0.10"
env_logger = "0.11"
rusb = "0.9"
tempfile = "3"
tokio = { version = "1", features = ["macros", "time"] }
Expand Down
8 changes: 4 additions & 4 deletions src/function/custom/aio/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//! Linux AIO driver.

use bytes::{Bytes, BytesMut};
use nix::sys::eventfd::{eventfd, EfdFlags};
use nix::sys::eventfd::{self, EfdFlags};
use std::{
collections::{hash_map::Entry, HashMap, VecDeque},
fmt,
io::{Error, ErrorKind, Result},
mem::{self, MaybeUninit},
ops::Deref,
os::fd::{AsRawFd, OwnedFd, RawFd},
os::fd::{AsRawFd, RawFd},
pin::Pin,
ptr,
sync::{mpsc, mpsc::TryRecvError, Arc},
Expand All @@ -22,13 +22,13 @@ pub use sys::opcode;

/// eventfd provided by kernel.
#[derive(Debug, Clone)]
struct EventFd(Arc<OwnedFd>);
struct EventFd(Arc<eventfd::EventFd>);

impl EventFd {
/// Create new eventfd with initial value and semaphore characteristics, if requested.
pub fn new(initval: u32, semaphore: bool) -> Result<Self> {
let flags = if semaphore { EfdFlags::EFD_SEMAPHORE } else { EfdFlags::empty() };
let fd = eventfd(initval, flags)?;
let fd = eventfd::EventFd::from_value_and_flags(initval, flags)?;
Ok(Self(Arc::new(fd)))
}

Expand Down
9 changes: 4 additions & 5 deletions src/function/custom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! The Linux kernel configuration option `CONFIG_USB_CONFIGFS_F_FS` must be enabled.

use bytes::{Bytes, BytesMut};
use nix::poll::{poll, PollFd, PollFlags};
use nix::poll::{poll, PollFd, PollFlags, PollTimeout};
use proc_mounts::MountIter;
use std::{
collections::{hash_map::Entry, HashMap, HashSet},
Expand All @@ -12,7 +12,7 @@ use std::{
fs::File,
hash::Hash,
io::{Error, ErrorKind, Read, Result, Write},
os::fd::{AsRawFd, RawFd},
os::fd::{AsFd, AsRawFd, RawFd},
path::{Path, PathBuf},
sync::{
atomic::{AtomicBool, Ordering},
Expand Down Expand Up @@ -978,15 +978,14 @@ impl Custom {
fn wait_event_sync(&mut self, timeout: Option<Duration>) -> Result<bool> {
let ep0 = self.ep0()?;

let mut fds = [PollFd::new(&ep0, PollFlags::POLLIN)];
poll(&mut fds, timeout.map(|d| d.as_millis().try_into().unwrap()).unwrap_or(-1))?;
let mut fds = [PollFd::new(ep0.as_fd(), PollFlags::POLLIN)];
poll(&mut fds, timeout.map(|d| d.as_millis().try_into().unwrap()).unwrap_or(PollTimeout::NONE))?;
Ok(fds[0].revents().map(|e| e.contains(PollFlags::POLLIN)).unwrap_or_default())
}

/// Asynchronously wait for an event to be available.
#[cfg(feature = "tokio")]
pub async fn wait_event(&mut self) -> Result<()> {
use std::os::fd::AsFd;
use tokio::io::{unix::AsyncFd, Interest};

let ep0 = self.ep0()?;
Expand Down

0 comments on commit 7f69fc8

Please sign in to comment.