diff --git a/Cargo.lock b/Cargo.lock index fe6dbef0542..28290ad2281 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -755,9 +755,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.146" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libcryptsetup-rs" @@ -882,6 +882,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -921,11 +930,23 @@ dependencies = [ "bitflags 1.3.2", "cfg-if 1.0.0", "libc", - "memoffset", + "memoffset 0.7.1", "pin-utils", "static_assertions", ] +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.4.0", + "cfg-if 1.0.0", + "libc", + "memoffset 0.9.0", +] + [[package]] name = "nom" version = "7.1.3" @@ -1321,7 +1342,7 @@ dependencies = [ "libudev", "log", "loopdev", - "nix 0.26.2", + "nix 0.27.1", "pkg-config", "predicates", "pretty-hex", diff --git a/Cargo.toml b/Cargo.toml index be5b7d5e8a9..d7c918930e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -154,7 +154,8 @@ version = "0.4.14" optional = true [dependencies.nix] -version = "0.26.0" +version = "0.27.1" +features = ["fs", "ioctl", "mount", "poll", "process", "sched", "socket"] optional = true [dependencies.pretty-hex] diff --git a/src/engine/shared.rs b/src/engine/shared.rs index 10be45abfaa..b26b2ffcf2e 100644 --- a/src/engine/shared.rs +++ b/src/engine/shared.rs @@ -6,7 +6,8 @@ use std::{ collections::{hash_map::RandomState, HashMap, HashSet}, fs::File, io::Read, - os::unix::io::{AsRawFd, FromRawFd, RawFd}, + os::fd::AsFd, + os::unix::io::{FromRawFd, RawFd}, path::{Path, PathBuf}, }; @@ -118,7 +119,7 @@ pub fn set_key_shared(key_fd: RawFd, memory: &mut [u8]) -> StratisResult let bytes_read = key_file.read(memory)?; if bytes_read == MAX_STRATIS_PASS_SIZE { - let mut pollers = [PollFd::new(key_file.as_raw_fd(), PollFlags::POLLIN)]; + let mut pollers = [PollFd::new(&key_file.as_fd(), PollFlags::POLLIN)]; let num_events = poll(&mut pollers, 0)?; if num_events > 0 { return Err(StratisError::Msg(format!( diff --git a/src/engine/strat_engine/tests/loopbacked.rs b/src/engine/strat_engine/tests/loopbacked.rs index 60701348463..67eb55d102e 100644 --- a/src/engine/strat_engine/tests/loopbacked.rs +++ b/src/engine/strat_engine/tests/loopbacked.rs @@ -6,7 +6,7 @@ use std::{ env, fs::{File, OpenOptions}, mem::forget, - os::unix::io::AsRawFd, + os::fd::AsFd, panic, path::{Path, PathBuf}, sync::Once, @@ -59,7 +59,7 @@ impl LoopTestDev { .unwrap(); nix::unistd::ftruncate( - f.as_raw_fd(), + f.as_fd(), convert_test!(*size.bytes(), u128, nix::libc::off_t), ) .unwrap(); diff --git a/src/jsonrpc/server/server.rs b/src/jsonrpc/server/server.rs index c0f4c89085b..b9658cde3e9 100644 --- a/src/jsonrpc/server/server.rs +++ b/src/jsonrpc/server/server.rs @@ -438,10 +438,11 @@ impl StratisUnixListener { SockFlag::empty(), None, )?; - let flags = OFlag::from_bits(fcntl(fd, FcntlArg::F_GETFL)?).ok_or_else(|| { - StratisError::Msg("Unrecognized flag types returned from fcntl".to_string()) - })?; - fcntl(fd, FcntlArg::F_SETFL(flags | OFlag::O_NONBLOCK))?; + let flags = + OFlag::from_bits(fcntl(fd.as_raw_fd(), FcntlArg::F_GETFL)?).ok_or_else(|| { + StratisError::Msg("Unrecognized flag types returned from fcntl".to_string()) + })?; + fcntl(fd.as_raw_fd(), FcntlArg::F_SETFL(flags | OFlag::O_NONBLOCK))?; bind(fd, &UnixAddr::new(path.as_ref())?)?; listen(fd, 0)?; Ok(StratisUnixListener {