Open PhilLehmann opened 6 years ago
Hi, @philrykoff!
I believe it is better to ask that question on the winfsp
repo. As far as I understand, it is all about mapping unix-style fuse permission to windows permissions through winfsp
. If it is possible on the fuse layer of winfsp
then there should be no problem to do the same via jnr-fuse
.
I was unsure whom to ask myself 😄
The creator of WinFSP commented on my request here https://github.com/billziss-gh/winfsp/issues/114#issuecomment-338517398
Basically, he is saying that osxfuse has extensions called chflags
for similar requirements. Do you know about this feature of might it already be implemented in jnr-fuse? Please feel free to comment over there 😁
Here is some info I found about chflags
:
This indeed looks like it could be helpful. If we would have a somewhat similar API for OSX and Win, would that be something you would consider as an addition?
@SerCeMan: billziss-gh implemented the changes needed in WinFSP (https://github.com/billziss-gh/winfsp/issues/114).
It seems osxfuse has a similar implementation already done using chflags
:
Usage in osxfuse: https://github.com/osxfuse/fuse/blob/master/example/fusexmp_fh.c#L299-L426
Apple man file: https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/chflags.1.html
For Linux, my only find was chattr
, but that only works for ext2/3/4 file systems.
A proper solution would probably implement Windows and MacOS, optionally Linux. Based on the jnr-fuse code I already saw, I feel comfortable to implement the Windows part. I would have time in about two weeks to pick this up, if no one feels eager to do so beforehand. 😉
@philrykoff ping me when you have such a PR ready. I may have suggestions on how to ensure that jnr-fuse remains backwards/forwards compatible with different versions of WinFsp. [Caveat: I am very rusty on Java.]
BTW, I am implementing these changes in cgofuse. Related issue is billziss-gh/cgofuse#20. You may want to keep an eye as I have to face similar compatibility issues. [E.g. what happens when the latest cgofuse is used with a version of WinFsp that does not have the FSP_FUSE_CAP_STAT_EX
capability.]
Based on the jnr-fuse code I already saw, I feel comfortable to implement the Windows part. I would have time in about two weeks to pick this up, if no one feels eager to do so beforehand.
That sounds great to me 👍 . Feel free to reach out if you need any help!
The billziss-gh/cgofuse#20 issue is now closed. Most of it is not relevant to this discussion, except that it solves the problem of using a version of cgofuse with flags capability with a version of WinFsp that does not have this capability (e.g. latest cgofuse with WinFsp v1.1 which does not have BSD flags support).
Here is the relevant code from cgofuse:
// during FUSE init
conn->want |= conn->capable & FSP_FUSE_CAP_STAT_EX;
cgofuse_stat_ex = 0 != (conn->want & FSP_FUSE_CAP_STAT_EX);
And:
// during copy of Go struct stat to C struct stat
if (cgofuse_stat_ex)
((struct fuse_stat_ex *)stbuf)->st_flags = flags;
Here is how this works. A newer version of WinFsp will pass FSP_FUSE_CAP_STAT_EX
during init
signifying that it supports BSD flags. So we respond that we want this capability. We also remember that the capability is supported so that we can copy the flags
whenever we need to pass a struct stat
from Go to C.
An older version of WinFsp will not pass FSP_FUSE_CAP_STAT_EX
and no flags
copying will happen.
Apologies if all this is too obvious.
Documentation is never bad. Thanks for the helpful insights 👍
Please note that WinFsp v1.2B3 has been released. It has support for BSD flags, chflags, setcrtime and setchgtime.
Was this eventually implemented in jnr-fuse ? I do not see whether it is actually done.
Edited: Would be appreciated if someone could show me how to get round this issue to be able to set the Windows extra-attibutes 'SYSTEM'/'READONLY'.
Is it possible with winfsp (fuse) to set a file as hidden and system?
The reason I am asking is that I would like to add a desktop.ini to the virtual drive, but that file is only being evaluated by windows, if it is a system file. In addition to that, hiding it from the user would be great.
https://superuser.com/questions/882442/self-created-desktop-ini-does-not-work
I searched your and libfuse API docs and although they are great, maybe I lack the experience to search for the right needle in the haystack.