Skip to content

Commit

Permalink
add set_version
Browse files Browse the repository at this point in the history
  • Loading branch information
cwedgwood committed Mar 29, 2024
1 parent ef31736 commit bfaa24a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
//! version=4 or programatically calling nfs_set_version(nfs, NFS_V4) before
//! connecting to the server/share.
//!

#![allow(non_upper_case_globals)]

use libnfs_sys::*;
use nix::fcntl::OFlag;
use nix::sys::stat::Mode;
Expand Down Expand Up @@ -164,6 +167,16 @@ impl Nfs {
}
}

pub fn set_version(&self, version: i32) -> Result<()> {
unsafe {
check_retcode(
self.context.0,
nfs_set_version(self.context.0, version),
)?;
Ok(())
}
}

pub fn access(&self, path: &Path, mode: i32) -> Result<()> {
let path = CString::new(path.as_os_str().as_bytes())?;
unsafe {
Expand Down

0 comments on commit bfaa24a

Please sign in to comment.