use async_trait::async_trait;
use fernfs::vfs::{self, Capabilities, ReadDirResult};
use fernfs::xdr::nfs3;
use fernfs::xdr::nfs3::{
fattr3, fileid3, filename3, ftype3, nfspath3, nfsstat3, sattr3, specdata3,
};
#[derive(Default)]
pub struct DemoFS;
#[async_trait]
impl vfs::NFSFileSystem for DemoFS {
fn generation(&self) -> u64 {
1
}
fn capabilities(&self) -> Capabilities {
Capabilities::ReadOnly
}
fn root_dir(&self) -> fileid3 {
1
}
async fn lookup(&self, _dirid: fileid3, _filename: &filename3) -> Result<fileid3, nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn getattr(&self, _id: fileid3) -> Result<fattr3, nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn setattr(&self, _id: fileid3, _setattr: sattr3) -> Result<fattr3, nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn read(
&self,
_id: fileid3,
_offset: u64,
_count: u32,
) -> Result<(Vec<u8>, bool), nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn write(
&self,
_id: fileid3,
_offset: u64,
_data: &[u8],
_stable: nfs3::file::stable_how,
) -> Result<(fattr3, nfs3::file::stable_how, nfs3::count3), nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn create(
&self,
_dirid: fileid3,
_filename: &filename3,
_attr: sattr3,
) -> Result<(fileid3, fattr3), nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn create_exclusive(
&self,
_dirid: fileid3,
_filename: &filename3,
_verifier: nfs3::createverf3,
) -> Result<fileid3, nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn mkdir(
&self,
_dirid: fileid3,
_dirname: &filename3,
) -> Result<(fileid3, fattr3), nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn remove(&self, _dirid: fileid3, _filename: &filename3) -> Result<(), nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn rename(
&self,
_from_dirid: fileid3,
_from_filename: &filename3,
_to_dirid: fileid3,
_to_filename: &filename3,
) -> Result<(), nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn readdir(
&self,
_dirid: fileid3,
_start_after: fileid3,
_max_entries: usize,
) -> Result<ReadDirResult, nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn symlink(
&self,
_dirid: fileid3,
_linkname: &filename3,
_symlink: &nfspath3,
_attr: &sattr3,
) -> Result<(fileid3, fattr3), nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn readlink(&self, _id: fileid3) -> Result<nfspath3, nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn link(
&self,
_file_id: fileid3,
_link_dir_id: fileid3,
_link_name: &filename3,
) -> Result<fattr3, nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn mknod(
&self,
_dir_id: fileid3,
_name: &filename3,
_ftype: ftype3,
_specdata: specdata3,
_attrs: &sattr3,
) -> Result<(fileid3, fattr3), nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
async fn commit(
&self,
_file_id: fileid3,
_offset: u64,
_count: u32,
) -> Result<fattr3, nfsstat3> {
Err(nfsstat3::NFS3ERR_NOTSUPP)
}
}