Skip to content

Commit

Permalink
chore: bump deps and remove deprecated keys in deny.toml
Browse files Browse the repository at this point in the history
Signed-off-by: Yang Kaiyong <yangkaiyong.yky@antgroup.com>
  • Loading branch information
Yang Kaiyong committed Jan 21, 2025
1 parent 36cd288 commit 387521d
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
- uses: EmbarkStudios/cargo-deny-action@v2
14 changes: 9 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ nix = "0.24"
radix_trie = "0.2.1"
tokio = { version = "1", optional = true }
tokio-uring = { version = "0.4.0", optional = true }
vmm-sys-util = { version = "0.11", optional = true }
vm-memory = { version = "0.10", features = ["backend-mmap"] }
virtio-queue = { version = "0.7", optional = true }
vmm-sys-util = { version = "0.12.1", optional = true }
vm-memory = { version = "0.16.1", features = ["backend-mmap"] }
virtio-queue = { version = "0.14.0", optional = true }
vhost = { version = "0.6", features = ["vhost-user-slave"], optional = true }
versionize_derive = { version = "0.1.6", optional = true }
versionize = { version = "0.1.10", optional = true }
Expand All @@ -46,8 +46,8 @@ tokio-uring = { version = "0.4.0", optional = true }

[dev-dependencies]
tokio-test = "0.4.2"
vmm-sys-util = "0.11"
vm-memory = { version = "0.10", features = ["backend-mmap", "backend-bitmap"] }
vmm-sys-util = "0.12.0"
vm-memory = { version = "0.16.1", features = ["backend-mmap", "backend-bitmap"] }

[features]
default = ["fusedev"]
Expand All @@ -66,6 +66,7 @@ virtiofs = ["virtio-queue", "caps", "vmm-sys-util"]
vhost-user-fs = ["virtiofs", "vhost", "caps"]
persist = ["dbs-snapshot", "versionize", "versionize_derive"]
fuse-t = []
async_io = []

[package.metadata.docs.rs]
all-features = true
Expand All @@ -74,3 +75,6 @@ targets = [
"aarch64-unknown-linux-gnu",
"aarch64-apple-darwin",
]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(testff)'] }
51 changes: 7 additions & 44 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# this list would mean the nix crate, as well as any of its exclusive
# dependencies not shared by any other crates, would be ignored, as the target
# list here is effectively saying which targets you are building for.
[graph]
targets = [
# The triple can be any string, but only the target triples built in to
# rustc (as of 1.40) can be checked against actual config expressions
Expand All @@ -35,26 +36,12 @@ targets = [
db-path = "~/.cargo/advisory-db"
# The url(s) of the advisory databases to use
db-urls = ["https://github.com/rustsec/advisory-db"]
# The lint level for security vulnerabilities
vulnerability = "deny"
# The lint level for unmaintained crates
unmaintained = "warn"
version = 2
# The lint level for crates that have been yanked from their source registry
yanked = "warn"
# The lint level for crates with security notices. Note that as of
# 2019-12-17 there are no security notice advisories in
# https://github.com/rustsec/advisory-db
notice = "warn"
# A list of advisory IDs to ignore. Note that ignored advisories will still
# output a note when they are encountered.
ignore = [
# stderrlog needs to fix it
"RUSTSEC-2020-0071",
# stderrlog needs to fix it
"RUSTSEC-2020-0159",
# stderrlog needs to fix it
"RUSTSEC-2022-0006",
]
ignore = []
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
# lower than the range specified will be ignored. Note that ignored advisories
# will still output a note when they are encountered.
Expand All @@ -63,45 +50,21 @@ ignore = [
# * Medium - CVSS Score 4.0 - 6.9
# * High - CVSS Score 7.0 - 8.9
# * Critical - CVSS Score 9.0 - 10.0
#severity-threshold =
#severity-threshold =

# This section is considered when running `cargo deny check licenses`
# More documentation for the licenses section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
[licenses]
# The lint level for crates which do not have a detectable license
unlicensed = "deny"
# List of explictly allowed licenses
# See https://spdx.org/licenses/ for list of possible licenses
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
allow = [
"MIT",
"Apache-2.0",
"BSD-3-Clause",
"Unicode-DFS-2016",
]
# List of explictly disallowed licenses
# See https://spdx.org/licenses/ for list of possible licenses
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
deny = [
"GPL-2.0",
"GPL-3.0",
#"Nokia",
"Unicode-3.0",
]
# Lint level for licenses considered copyleft
copyleft = "deny"
# Blanket approval or denial for OSI-approved or FSF Free/Libre licenses
# * both - The license will be approved if it is both OSI-approved *AND* FSF
# * either - The license will be approved if it is either OSI-approved *OR* FSF
# * osi-only - The license will be approved if is OSI-approved *AND NOT* FSF
# * fsf-only - The license will be approved if is FSF *AND NOT* OSI-approved
# * neither - This predicate is ignored and the default lint level is used
allow-osi-fsf-free = "neither"
# Lint level used when no other predicates are matched
# 1. License isn't in the allow or deny lists
# 2. License isn't copyleft
# 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither"
default = "deny"
# The confidence threshold for detecting a license from license text.
# The higher the value, the more closely the license text must be to the
# canonical license text of a valid SPDX license file.
Expand Down Expand Up @@ -178,8 +141,8 @@ deny = [
skip = [
#{ name = "ansi_term", version = "=0.11.0" },
]
# Similarly to `skip` allows you to skip certain crates during duplicate
# detection. Unlike skip, it also includes the entire tree of transitive
# Similarly to `skip` allows you to skip certain crates during duplicate
# detection. Unlike skip, it also includes the entire tree of transitive
# dependencies starting at the specified crate, up to a certain depth, which is
# by default infinite
skip-tree = [
Expand Down
4 changes: 2 additions & 2 deletions src/api/filesystem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ pub trait ZeroCopyReader: io::Read {
) -> io::Result<usize> {
let mut out = 0;
loop {
match self.read_to(f, ::std::usize::MAX, off) {
match self.read_to(f, usize::MAX, off) {
Ok(0) => return Ok(out),
Ok(n) => {
off = off.saturating_add(n as u64);
Expand Down Expand Up @@ -364,7 +364,7 @@ pub trait ZeroCopyWriter: io::Write {
) -> io::Result<usize> {
let mut out = 0;
loop {
match self.write_from(f, ::std::usize::MAX, off) {
match self.write_from(f, usize::MAX, off) {
Ok(0) => return Ok(out),
Ok(n) => {
off = off.saturating_add(n as u64);
Expand Down
2 changes: 1 addition & 1 deletion src/api/filesystem/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub trait Layer: FileSystem {
Ok(v) => {
// xattr name exists and we get value.
if let GetxattrReply::Value(buf) = v {
if buf.len() == 1 && buf[0].to_ascii_lowercase() == b'y' {
if buf.len() == 1 && buf[0].eq_ignore_ascii_case(&b'y') {
return Ok(true);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/api/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<F: FileSystem + Sync> Server<F> {

struct ZcReader<'a, S: BitmapSlice = ()>(Reader<'a, S>);

impl<'a, S: BitmapSlice> ZeroCopyReader for ZcReader<'a, S> {
impl<S: BitmapSlice> ZeroCopyReader for ZcReader<'_, S> {
fn read_to(
&mut self,
f: &mut dyn FileReadWriteVolatile,
Expand All @@ -79,15 +79,15 @@ impl<'a, S: BitmapSlice> ZeroCopyReader for ZcReader<'a, S> {
}
}

impl<'a, S: BitmapSlice> io::Read for ZcReader<'a, S> {
impl<S: BitmapSlice> io::Read for ZcReader<'_, S> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
self.0.read(buf)
}
}

struct ZcWriter<'a, S: BitmapSlice = ()>(Writer<'a, S>);

impl<'a, S: BitmapSlice> ZeroCopyWriter for ZcWriter<'a, S> {
impl<S: BitmapSlice> ZeroCopyWriter for ZcWriter<'_, S> {
fn write_from(
&mut self,
f: &mut dyn FileReadWriteVolatile,
Expand All @@ -102,7 +102,7 @@ impl<'a, S: BitmapSlice> ZeroCopyWriter for ZcWriter<'a, S> {
}
}

impl<'a, S: BitmapSlice> io::Write for ZcWriter<'a, S> {
impl<S: BitmapSlice> io::Write for ZcWriter<'_, S> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.0.write(buf)
}
Expand Down
8 changes: 4 additions & 4 deletions src/api/server/sync_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,8 @@ impl<F: FileSystem + Sync> Server<F> {
minor: KERNEL_MINOR_VERSION,
max_readahead: readahead,
flags: enabled_flags as u32,
max_background: ::std::u16::MAX,
congestion_threshold: (::std::u16::MAX / 4) * 3,
max_background: u16::MAX,
congestion_threshold: (u16::MAX / 4) * 3,
max_write: MIN_READ_BUFFER - BUFFER_HEADER_SIZE,
time_gran: 1, // nanoseconds
flags2: (enabled_flags >> 32) as u32,
Expand Down Expand Up @@ -1251,7 +1251,7 @@ impl<F: FileSystem + Sync> Server<F> {
}
}

impl<'a, F: FileSystem, S: BitmapSlice> SrvContext<'a, F, S> {
impl<F: FileSystem, S: BitmapSlice> SrvContext<'_, F, S> {
fn reply_ok<T: ByteValued>(&mut self, out: Option<T>, data: Option<&[u8]>) -> Result<usize> {
let data2 = out.as_ref().map(|v| v.as_slice()).unwrap_or(&[]);
let data3 = data.unwrap_or(&[]);
Expand Down Expand Up @@ -1350,7 +1350,7 @@ fn add_dirent<S: BitmapSlice>(
d: DirEntry,
entry: Option<Entry>,
) -> io::Result<usize> {
if d.name.len() > ::std::u32::MAX as usize {
if d.name.len() > u32::MAX as usize {
return Err(io::Error::from_raw_os_error(libc::EOVERFLOW));
}

Expand Down
7 changes: 6 additions & 1 deletion src/common/file_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ impl<'a> FileVolatileSlice<'a> {
/// [`vm_memory::BitmapSlice`]: https://docs.rs/vm-memory/latest/vm_memory/bitmap/trait.BitmapSlice.html
/// [`vm_memory::VolatileSlice`]: https://docs.rs/vm-memory/latest/vm_memory/volatile_memory/struct.VolatileSlice.html
pub fn from_volatile_slice<S: BitmapSlice>(s: &VolatileSlice<'a, S>) -> Self {
#[allow(deprecated)]
Self::new(s.as_ptr(), s.len())
}

Expand Down Expand Up @@ -179,7 +180,7 @@ impl<'a> FileVolatileSlice<'a> {
}
}

impl<'a> Bytes<usize> for FileVolatileSlice<'a> {
impl Bytes<usize> for FileVolatileSlice<'_> {
type E = VError;

fn write(&self, buf: &[u8], addr: usize) -> Result<usize, Self::E> {
Expand All @@ -202,27 +203,31 @@ impl<'a> Bytes<usize> for FileVolatileSlice<'a> {
where
F: Read,
{
#[allow(deprecated)]
VolatileSlice::read_from(&self.as_volatile_slice(), addr, src, count)
}

fn read_exact_from<F>(&self, addr: usize, src: &mut F, count: usize) -> Result<(), Self::E>
where
F: Read,
{
#[allow(deprecated)]
VolatileSlice::read_exact_from(&self.as_volatile_slice(), addr, src, count)
}

fn write_to<F>(&self, addr: usize, dst: &mut F, count: usize) -> Result<usize, Self::E>
where
F: Write,
{
#[allow(deprecated)]
VolatileSlice::write_to(&self.as_volatile_slice(), addr, dst, count)
}

fn write_all_to<F>(&self, addr: usize, dst: &mut F, count: usize) -> Result<(), Self::E>
where
F: Write,
{
#[allow(deprecated)]
VolatileSlice::write_all_to(&self.as_volatile_slice(), addr, dst, count)
}

Expand Down
9 changes: 3 additions & 6 deletions src/overlayfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,7 @@ impl RealInode {
// Open the directory and load each entry.
let opendir_res = self.layer.opendir(ctx, self.inode, libc::O_RDONLY as u32);
let handle = match opendir_res {
Ok((handle, _)) => match handle {
Some(h) => h,
_ => 0,
},
Ok((handle, _)) => handle.unwrap_or_default(),
// opendir may not be supported if no_opendir is set, so we can ignore this error.
Err(e) => {
match e.raw_os_error() {
Expand Down Expand Up @@ -970,9 +967,9 @@ impl OverlayFs {
}

// Current file or dir.
if name.eq(".")
if name.eq(".")
// Root directory has no parent.
|| (parent == FUSE_ROOT_ID && name.eq(".."))
|| (parent == FUSE_ROOT_ID && name.eq(".."))
// Special convention: empty name indicates current dir.
|| name.is_empty()
{
Expand Down
2 changes: 1 addition & 1 deletion src/passthrough/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pub struct Config {
/// * If dax_file_size == None, DAX will disable to all files.
/// * If dax_file_size == 0, DAX will enable all files.
/// * If dax_file_size == N, DAX will enable only when the file size is greater than or equal
/// to N Bytes.
/// to N Bytes.
pub dax_file_size: Option<u64>,

/// Reduce memory consumption by directly use host inode when possible.
Expand Down
12 changes: 5 additions & 7 deletions src/passthrough/sync_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,20 @@ impl<S: BitmapSlice + Send + Sync> PassthroughFs<S> {
inode: Inode,
handle: Option<Handle>,
) -> io::Result<(libc::stat64, Duration)> {
let st;
let data = self.inode_map.get(inode).map_err(|e| {
error!("fuse: do_getattr ino {} Not find err {:?}", inode, e);
e
})?;

// kernel sends 0 as handle in case of no_open, and it depends on fuse server to handle
// this case correctly.
if !self.no_open.load(Ordering::Relaxed) && handle.is_some() {
let st = if !self.no_open.load(Ordering::Relaxed) && handle.is_some() {
// Safe as we just checked handle
let hd = self.handle_map.get(handle.unwrap(), inode)?;
st = stat_fd(hd.get_file(), None);
stat_fd(hd.get_file(), None)
} else {
st = data.handle.stat();
}
data.handle.stat()
};

let st = st.map_err(|e| {
error!("fuse: do_getattr stat failed ino {} err {:?}", inode, e);
Expand Down Expand Up @@ -507,14 +506,13 @@ impl<S: BitmapSlice + Send + Sync> FileSystem for PassthroughFs<S> {
let ino = entry.inode;
dir_entry.ino = entry.attr.st_ino;

add_entry(dir_entry, entry).map(|r| {
add_entry(dir_entry, entry).inspect(|&r| {
// true when size is not large enough to hold entry.
if r == 0 {
// Release the refcount acquired by self.do_lookup().
let mut inodes = self.inode_map.get_map_mut();
self.forget_one(&mut inodes, ino, 1);
}
r
})
})
}
Expand Down
Loading

0 comments on commit 387521d

Please sign in to comment.