cberner / fuser

Filesystem in Userspace (FUSE) for Rust
MIT License
835 stars 114 forks source link

extra memory copy? #222

Closed luanshaotong closed 2 years ago

luanshaotong commented 2 years ago

I am confused why there is no data buffer in parameters of read(). Does this mean that there is an extra memory copy when reading?

https://github.com/cberner/fuser/blob/e01307c9414189304c3288e1ad029e06e9c6dc5d/src/lib.rs#L494 https://github.com/cberner/fuser/blob/e01307c9414189304c3288e1ad029e06e9c6dc5d/examples/simple.rs#L1397

cberner commented 2 years ago

I didn't write that code (it was there before I forked fuse into fuser), so I'm not entirely sure. However, no I don't think there is an unnecessary copy, if you trace the reply method you'll find that it bottoms out in a write to the file descriptor that goes back to the kernel

luanshaotong commented 2 years ago

@cberner Thank you for your answer, I didn't figure it out before, this is indeed a feature(or shortcoming?) of fuse.