containers / libkrun

A dynamic library providing Virtualization-based process isolation capabilities
Apache License 2.0
901 stars 74 forks source link

devices/fs: Drop mutability from FileReadWriteAtVolatile #75

Closed slp closed 2 years ago

slp commented 2 years ago

Internally, the FileReadWriteAtVolatile methods are going to use pread/pwrite family of syscalls, which implies the file descriptor offset is not altered. With this in mind, drop the mutability requirement on the File argument.

This change allows us to drop the "try_clone()" on PassthroughFs::[read()|write()], saving a "dup()" syscall on both of those critical paths.

This is a backport of virtiofsd:595126fe.

Signed-off-by: Sergio Lopez slp@redhat.com