Open ncw opened 7 years ago
It is possible to mark a file system as read-only on WinFsp-FUSE by passing the (WinFsp specific) flag FSP_FUSE_CAP_READ_ONLY
during fuse_operations::init
. However I did not implement this flag on cgofuse. There are two reasons for this:
Read-only file systems on Windows and Linux behave differently. For example, Windows may still send a Write request on a file system that is marked read-only. [Please note that I am not 100% certain of this. I note however that the Windows CDROM file system driver, which is open-sourced, marks itself as read-only but also handles writes!]
I do not have good tests for read-only file systems. I did not want to have a situation along the lines of: "you said it's read-only so why am I getting writes".
Clearly this is an area where the WinFsp core could be improved (e.g. by rejecting write requests at the kernel level if the file system is marked read-only). Until that happens I recommend treating every file system as read-write and explicitly rejecting the requests that you do not want to handle with -EROFS
.
[NOTE: The WinFsp-FUSE supported options are here and a few additional ones here].
If I pass
-o ro
to WinFsp then doesn't mark the file system as read only as it does on linux. I think libfuse passes unknown options on tomount.fuse
which says in its man pageThis brings to mind 3 options
-EROFS
in any methods which do writing?What is your preferred option?
Thanks