Thanks to visit codestin.com
Credit goes to github.com

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
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ nursery = { level = "deny", priority = -1 }
unwrap_used = "deny"
significant_drop_tightening = "allow" # it's too buggy
missing_errors_doc = "allow"
future_not_send = "allow"
2 changes: 1 addition & 1 deletion crates/nfs3_client/src/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ where
async fn connect_from_privileged_port<C, S>(connector: &C, addr: SocketAddr) -> std::io::Result<S>
where
C: crate::net::Connector<Connection = S>,
S: AsyncRead + AsyncWrite,
S: AsyncRead + AsyncWrite + Send,
{
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
const MIN_PORT: u16 = 300;
Expand Down
2 changes: 1 addition & 1 deletion crates/nfs3_client/src/mount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ where
async fn call<C, R>(&mut self, proc: MOUNT_PROGRAM, args: C) -> Result<R, crate::error::Error>
where
R: Unpack,
C: Pack,
C: Pack + Send + Sync,
{
self.rpc
.call::<C, R>(PROGRAM, VERSION, proc as u32, &args)
Expand Down
2 changes: 1 addition & 1 deletion crates/nfs3_client/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::net::SocketAddr;
use crate::io::{AsyncRead, AsyncWrite};

/// Trait for connecting to an endpoint.
pub trait Connector: Send {
pub trait Connector: Send + Sync {
type Connection: AsyncRead + AsyncWrite + Send;

/// Connect to a remote address.
Expand Down
2 changes: 1 addition & 1 deletion crates/nfs3_client/src/nfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ where
async fn call<C, R>(&mut self, proc: NFS_PROGRAM, args: &C) -> Result<R, crate::error::Error>
where
R: Unpack,
C: Pack,
C: Pack + Send + Sync,
{
self.rpc
.call::<C, R>(PROGRAM, VERSION, proc as u32, args)
Expand Down
2 changes: 1 addition & 1 deletion crates/nfs3_client/src/portmapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ where
async fn call<C, R>(&mut self, proc: PMAP_PROG, args: C) -> Result<R, crate::error::Error>
where
R: Unpack,
C: Pack,
C: Pack + Send + Sync,
{
self.rpc
.call::<C, R>(PROGRAM, VERSION, proc as u32, &args)
Expand Down
4 changes: 2 additions & 2 deletions crates/nfs3_client/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ where
) -> Result<R, Error>
where
R: Unpack,
C: Pack,
C: Pack + Send + Sync,
{
let call = call_body {
rpcvers: RPC_VERSION_2,
Expand All @@ -84,7 +84,7 @@ where

async fn send_call<T>(io: &mut IO, msg: &rpc_msg<'_, '_>, args: &T) -> Result<(), Error>
where
T: Pack,
T: Pack + Send + Sync,
{
let total_len = msg.packed_size() + args.packed_size();
if total_len % 4 != 0 {
Expand Down
12 changes: 9 additions & 3 deletions crates/nfs3_server/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use tokio::sync::mpsc;
use crate::transaction_tracker::TransactionTracker;
use crate::vfs::handle::FileHandleConverter;

pub struct RPCContext<T> {
pub struct RPCContext<T: crate::vfs::NfsFileSystem> {
pub local_port: u16,
pub client_addr: String,
pub auth: auth_unix,
Expand All @@ -19,7 +19,10 @@ pub struct RPCContext<T> {
}

#[allow(clippy::missing_fields_in_debug)]
impl<T> fmt::Debug for RPCContext<T> {
impl<T> fmt::Debug for RPCContext<T>
where
T: crate::vfs::NfsFileSystem,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("RPCContext")
.field("local_port", &self.local_port)
Expand All @@ -32,7 +35,10 @@ impl<T> fmt::Debug for RPCContext<T> {
}
}

impl<T> Clone for RPCContext<T> {
impl<T> Clone for RPCContext<T>
where
T: crate::vfs::NfsFileSystem,
{
fn clone(&self) -> Self {
Self {
local_port: self.local_port,
Expand Down
28 changes: 18 additions & 10 deletions crates/nfs3_server/src/mount_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::vfs::NfsFileSystem;

#[allow(clippy::enum_glob_use)]
pub async fn handle_mount<T>(
context: &RPCContext<T>,
context: RPCContext<T>,
message: IncomingRpcMessage,
) -> anyhow::Result<HandleResult>
where
Expand Down Expand Up @@ -52,12 +52,15 @@ where
}
}

async fn mountproc3_null<T>(_: &RPCContext<T>, _: u32, _: Void) -> Void {
async fn mountproc3_null<T>(_: RPCContext<T>, _: u32, _: Void) -> Void
where
T: crate::vfs::NfsFileSystem,
{
Void
}

async fn mountproc3_mnt<T>(
context: &RPCContext<T>,
context: RPCContext<T>,
xid: u32,
path: dirpath<'_>,
) -> mountres3<'static>
Expand Down Expand Up @@ -133,19 +136,21 @@ where
/// shared or exported file systems. These are the file
/// systems which are made available to NFS version 3 protocol
/// clients.
async fn mountproc3_export<T>(
context: &RPCContext<T>,
_: u32,
_: Void,
) -> exports<'static, 'static> {
async fn mountproc3_export<T>(context: RPCContext<T>, _: u32, _: Void) -> exports<'static, 'static>
where
T: crate::vfs::NfsFileSystem,
{
let export_name = context.export_name.as_bytes().to_vec();
List(vec![export_node {
ex_dir: dirpath(Opaque::owned(export_name)),
ex_groups: List::default(),
}])
}

async fn mountproc3_umnt<T>(context: &RPCContext<T>, xid: u32, path: dirpath<'_>) -> Void {
async fn mountproc3_umnt<T>(context: RPCContext<T>, xid: u32, path: dirpath<'_>) -> Void
where
T: crate::vfs::NfsFileSystem,
{
let utf8path = match std::str::from_utf8(&path.0) {
Ok(path) => path,
Err(e) => {
Expand All @@ -161,7 +166,10 @@ async fn mountproc3_umnt<T>(context: &RPCContext<T>, xid: u32, path: dirpath<'_>
Void
}

pub async fn mountproc3_umnt_all<T>(context: &RPCContext<T>, xid: u32, _: Void) -> Void {
pub async fn mountproc3_umnt_all<T>(context: RPCContext<T>, xid: u32, _: Void) -> Void
where
T: crate::vfs::NfsFileSystem,
{
debug!("mountproc3_umnt_all({xid})");
if let Some(ref chan) = context.mount_signal {
let _ = chan.send(false).await;
Expand Down
Loading
Loading