Skip to content

Commit

Permalink
feat: add overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
akitaSummer committed Feb 22, 2024
1 parent c54c446 commit f62cd2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/passthrough/sync_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ impl<S: BitmapSlice + Send + Sync> FileSystem for PassthroughFs<S> {
let data = self.inode_map.get(parent)?;

let res = {
#[cfg(target_os = "linux")]
let (_uid, _gid) = set_creds(ctx.uid, ctx.gid)?;

let file = data.get_file()?;
Expand Down Expand Up @@ -509,6 +510,7 @@ impl<S: BitmapSlice + Send + Sync> FileSystem for PassthroughFs<S> {
let dir_file = dir.get_file()?;

let new_file = {
#[cfg(target_os = "linux")]
let (_uid, _gid) = set_creds(ctx.uid, ctx.gid)?;

let flags = self.get_writeback_open_flags(args.flags as i32);
Expand All @@ -532,6 +534,7 @@ impl<S: BitmapSlice + Send + Sync> FileSystem for PassthroughFs<S> {
None
};

#[cfg(target_os = "linux")]
let (_uid, _gid) = set_creds(ctx.uid, ctx.gid)?;
self.open_inode(entry.inode, args.flags as i32)?
}
Expand Down Expand Up @@ -946,6 +949,7 @@ impl<S: BitmapSlice + Send + Sync> FileSystem for PassthroughFs<S> {
let pathname = data.get_path()?;

let res = {
#[cfg(target_os = "linux")]
let (_uid, _gid) = set_creds(ctx.uid, ctx.gid)?;

// Safe because this doesn't modify any memory and we check the return value.
Expand Down Expand Up @@ -1031,6 +1035,7 @@ impl<S: BitmapSlice + Send + Sync> FileSystem for PassthroughFs<S> {
let data = self.inode_map.get(parent)?;

let res = {
#[cfg(target_os = "linux")]
let (_uid, _gid) = set_creds(ctx.uid, ctx.gid)?;

let file = data.get_file()?;
Expand Down
3 changes: 2 additions & 1 deletion src/transport/fusedev/fuse_t_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,10 @@ impl FuseChannel {
}

fn read(&mut self, len: usize, offset: usize) -> Result<()> {
let read_buf = &mut self.buf[offset..offset + len];
let mut total: usize = 0;
let fd = self.file.as_raw_fd();
while total < len {
let read_buf = &mut self.buf[offset + total..offset + len];
match read(fd, read_buf) {
Ok(size) => {
total += size;
Expand Down Expand Up @@ -409,6 +409,7 @@ fn fuse_kern_mount(
let mut cmd = Command::new(FUSE_NFSSRV_PATH);
cmd.arg("--noatime=true")
.arg("--dontbrowse=true")
.arg("--rwsize=262144")
// .arg("-d")
// .arg("-c")
.args(["--volname", &format!("{}-{}", fsname, subtype)]);
Expand Down

0 comments on commit f62cd2c

Please sign in to comment.