Skip to content

Commit

Permalink
[mountpoint] Add trace for returned values
Browse files Browse the repository at this point in the history
  • Loading branch information
FirelightFlagboy committed Jan 21, 2025
1 parent f3ed3c3 commit c0904c5
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions libparsec/crates/platform_mountpoint/src/unix/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ impl fuser::Filesystem for Filesystem {
let inodes_guard = inodes.lock().expect("mutex is poisoned");
inodes_guard.get_path_or_panic(parent)
};
let path = parent_path.into_child(name);
let path = parent_path.into_child(name.clone());

let options = {
let mut options = OpenOptions {
Expand Down Expand Up @@ -925,14 +925,12 @@ impl fuser::Filesystem for Filesystem {
};
}
};
let stat = file_stat_to_file_attr(stat, inode, uid, gid);

reply.manual().created(
&TTL,
&file_stat_to_file_attr(stat, inode, uid, gid),
GENERATION,
fd.0.into(),
open_flags,
);
log::trace!("create({parent}, {name:?}) => {stat:?}");
reply
.manual()
.created(&TTL, &stat, GENERATION, fd.0.into(), open_flags);
});
}

Expand Down Expand Up @@ -1082,9 +1080,9 @@ impl fuser::Filesystem for Filesystem {
}
}

reply
.manual()
.attr(&TTL, &file_stat_to_file_attr(stat, ino, uid, gid));
let stat = file_stat_to_file_attr(stat, ino, uid, gid);
log::trace!("setattr({ino:#x?}, ..) => {stat:?}");
reply.manual().attr(&TTL, &stat);
});

return;
Expand Down Expand Up @@ -1145,6 +1143,10 @@ impl fuser::Filesystem for Filesystem {
let offset = u64::try_from(offset).expect("Offset is negative");
match ops.fd_read(fd, offset, size as u64, &mut buf).await {
Ok(_) => {
log::trace!(
"read({ino}, offset: {offset}, size: {size}): Read {rsize} bytes",
rsize = buf.len()
);
reply.manual().data(&buf);
}
Err(err) => match err {
Expand Down Expand Up @@ -1193,6 +1195,10 @@ impl fuser::Filesystem for Filesystem {
let offset = u64::try_from(offset).expect("Offset is negative");
match ops.fd_write(fd, offset, &data).await {
Ok(written) => {
log::trace!(
"write({ino}, offset: {offset}, size: {size}): Written {written} bytes",
size = data.len()
);
reply.manual().written(written as u32);
}
Err(err) => match err {
Expand Down

0 comments on commit c0904c5

Please sign in to comment.