Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions crates/cargo_nfs3_server/src/mirror.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use nfs3_server::fs_util::{
exists_no_traverse, fattr3_differ, file_setattr, metadata_to_fattr3, path_setattr,
};
use nfs3_server::nfs3_types::nfs3::{
cookie3, createverf3, fattr3, fileid3, filename3, ftype3, nfspath3, nfsstat3, post_op_attr,
sattr3,
cookie3, createverf3, fattr3, fileid3, filename3, ftype3, nfspath3, nfsstat3, sattr3,
};
use nfs3_server::vfs::{
DirEntry, DirEntryPlus, FileHandleU64, NextResult, NfsFileSystem, NfsReadFileSystem,
Expand Down Expand Up @@ -782,8 +781,8 @@ impl ReadDirPlusIterator<FileHandleU64> for MirrorFsIterator {
fileid,
name,
cookie: fileid,
name_attributes: post_op_attr::Some(fs_entry.fsmeta.clone()),
handle: Some(FileHandleU64::new(fileid)),
name_attributes: Some(fs_entry.fsmeta.clone()),
name_handle: Some(FileHandleU64::new(fileid)),
})
.await
}
Expand Down
7 changes: 3 additions & 4 deletions crates/nfs3_server/examples/mirrorfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ use nfs3_server::fs_util::{
exists_no_traverse, fattr3_differ, file_setattr, metadata_to_fattr3, path_setattr,
};
use nfs3_server::nfs3_types::nfs3::{
cookie3, createverf3, fattr3, fileid3, filename3, ftype3, nfspath3, nfsstat3, post_op_attr,
sattr3,
cookie3, createverf3, fattr3, fileid3, filename3, ftype3, nfspath3, nfsstat3, sattr3,
};
use nfs3_server::tcp::{NFSTcp, NFSTcpListener};
use nfs3_server::vfs::{
Expand Down Expand Up @@ -792,8 +791,8 @@ impl ReadDirPlusIterator<FileHandleU64> for MirrorFsIterator {
fileid,
name: filename3::from_os_string(name),
cookie: fileid,
name_attributes: post_op_attr::Some(attr),
handle: Some(FileHandleU64::new(fileid)),
name_attributes: Some(attr),
name_handle: Some(FileHandleU64::new(fileid)),
};

return NextResult::Ok(entry_plus);
Expand Down
4 changes: 2 additions & 2 deletions crates/nfs3_server/src/memfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -886,8 +886,8 @@ impl ReadDirPlusIterator<FileHandleU64> for MemFsIterator {
fileid: id.into(),
name: entry.name().clone_to_owned(),
cookie: id.into(),
name_attributes: nfs::post_op_attr::Some(attr),
handle: Some(id),
name_attributes: Some(attr),
name_handle: Some(id),
}
})
}
Expand Down
10 changes: 5 additions & 5 deletions crates/nfs3_server/src/vfs/adapters/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl<I: ReadDirPlusIterator<H>, H: FileHandle> ReadDirIterator for ReadDirPlusTo

#[cfg(test)]
mod tests {
use nfs3_types::nfs3::{filename3, post_op_attr};
use nfs3_types::nfs3::filename3;

use super::*;
use crate::vfs::{DirEntryPlus, FileHandleU64};
Expand Down Expand Up @@ -74,15 +74,15 @@ mod tests {
fileid: 1,
name: filename3::from(b"file1.txt".to_vec()),
cookie: 100,
name_attributes: post_op_attr::None,
handle: Some(42u64.into()),
name_attributes: None,
name_handle: Some(42u64.into()),
},
DirEntryPlus {
fileid: 2,
name: filename3::from(b"file2.txt".to_vec()),
cookie: 200,
name_attributes: post_op_attr::None,
handle: None,
name_attributes: None,
name_handle: None,
},
];

Expand Down
4 changes: 2 additions & 2 deletions crates/nfs3_server/src/vfs/adapters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
mod iterator;

pub use iterator::ReadDirPlusToReadDir;
use nfs3_types::nfs3::{Nfs3Option, fattr3, filename3, nfsstat3, sattr3};
use nfs3_types::nfs3::{fattr3, filename3, nfsstat3, sattr3};

use super::{
DirEntryPlus, NextResult, NfsFileSystem, NfsReadFileSystem, ReadDirIterator,
Expand Down Expand Up @@ -177,7 +177,7 @@ where
async fn next(&mut self) -> NextResult<DirEntryPlus<H>> {
let mut result = self.0.next().await;
if let NextResult::Ok(entry) = &mut result {
if let Nfs3Option::Some(attr) = &mut entry.name_attributes {
if let Some(attr) = &mut entry.name_attributes {
remove_write_permissions(attr);
}
}
Expand Down
16 changes: 8 additions & 8 deletions crates/nfs3_server/src/vfs/iterator.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
pub use crate::nfs3_types::nfs3::{
cookie3, fileid3, filename3, nfsstat3, post_op_attr, post_op_fh3,
};
pub use crate::nfs3_types::nfs3::{cookie3, fattr3, fileid3, filename3, nfsstat3};

/// Same as `entry3`
pub type DirEntry = entry3<'static>;

use crate::nfs3_types::nfs3::{entry3, entryplus3};
use crate::nfs3_types::nfs3::{entry3, entryplus3, post_op_attr, post_op_fh3};
use crate::vfs::FileHandle;
use crate::vfs::handle::FileHandleConverter;

Expand All @@ -15,8 +13,8 @@ pub struct DirEntryPlus<H: FileHandle> {
pub fileid: fileid3,
pub name: filename3<'static>,
pub cookie: cookie3,
pub name_attributes: post_op_attr,
pub handle: Option<H>,
pub name_attributes: Option<fattr3>,
pub name_handle: Option<H>,
}

impl<H: FileHandle> DirEntryPlus<H> {
Expand All @@ -25,8 +23,10 @@ impl<H: FileHandle> DirEntryPlus<H> {
fileid: self.fileid,
name: self.name,
cookie: self.cookie,
name_attributes: self.name_attributes,
name_handle: self.handle.map_or(post_op_fh3::None, |h| {
name_attributes: self
.name_attributes
.map_or(post_op_attr::None, post_op_attr::Some),
name_handle: self.name_handle.map_or(post_op_fh3::None, |h| {
post_op_fh3::Some(converter.fh_to_nfs(&h))
}),
}
Expand Down
4 changes: 2 additions & 2 deletions crates/nfs3_server/src/vfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ mod iterator;
pub use handle::{FileHandle, FileHandleU64};
pub use iterator::*;
use nfs3_types::nfs3::{
FSF3_CANSETTIME, FSF3_HOMOGENEOUS, FSF3_SYMLINK, FSINFO3resok as fsinfo3, createverf3, fattr3,
nfspath3, nfstime3, sattr3,
FSF3_CANSETTIME, FSF3_HOMOGENEOUS, FSF3_SYMLINK, FSINFO3resok as fsinfo3, createverf3,
nfspath3, nfstime3, post_op_attr, sattr3,
Comment thread
Vaiz marked this conversation as resolved.
};

use crate::units::{GIBIBYTE, MEBIBYTE};
Expand Down
Loading