-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fuse Java Binding #60
Comments
@Mitch49, thanks for your interest in WinFsp. I will be glad to help as best as I can. A couple of questions first:
The The full prototype for
Question: are you properly initializing
The
Do you have the full log mentioned above? |
@tstordyallison I think you may be right. Ok, I am now pretty convinced that we need to have I will look into this after publishing the final WinFsp 2017 (coming this week). |
jnr is an open source library that help to invoke native function without code generation. Annotations are used to map functions and struct. There is also fuse-j which use JNI but its outdated. You can build and test jnr-fuse without IDE. git clone https://github.com/Mitch49/jnr-fuse
cd jnr-fuse
gradlew.bat init
gradlew.bat build -x test
java -cp build\libs\jnr-fuse-0.3.1-all.jar ru.serce.jnrfuse.examples.HelloFuse Here is the full error log: https://gist.github.com/Mitch49/ae5ce5f9061d7a6716ad24d70b65dd79 |
@tstordyallison just normal Java process without cygwin |
@Mitch49 thank you. I will try it and see what I come up with. |
I changed the exports on the main winfsp.dll and rebuilt the user space dll and manually used it for my testing. Seemed OK - but I now need to take a proper look at #44 and do some more testing/evangelising to get people behind my use case before doing too much more development... I think the general plan was create a 'winfuse.dll' that did this rather than the main one (like cygfuse) - but I never got around to looking into it properly. |
@Mitch49 I can confirm that this is a problem because
Here are the values of some of the parameters passed to
The fix is to properly pass the @tstordyallison wrote:
Agreed. I will work on producing a special |
As I am looking more into jnr-fuse this may not be as simple as I originally thought. To see why let's see the definition of
The fields are:
In a nutshell what we need to do is create an
|
As I am looking more into this, I am thinking that perhaps the best solution is to produce that One of the main reasons I have been resisting this is the So we have multiple options here:
I am leaning towards (4). Thoughts? |
I would happy with 4). For those who want something more exotic for debugging etc, they can build the userspace dll from source (we might want to make that easier so it doesn't need the DDK etc, but it isn't all that bad in honesty). If a genuine need comes up for a different build, we can address it then. |
The fourth solution seems to be the best. If someone wants more customization he can write modified version of |
In the end I chose the path of least resistance and added the These new symbols are not supposed to be used by native C/C++ programs. Such programs are supposed to include the The symbols are currently added to the import libraries ( These symbols are for use with programs that use FFI technology such as jnr-fuse and fusepy ONLY. Commit db05667 includes these changes and is currently being tested although it passed my local smoke testing. With this commit and the patch below I am able to start jnr-fuse without access violations.
However the file system does not currently work as it keeps returning
The |
This is great. Now It will be easier to integrate fuse libraries with winfsp. It seems that jnr-fuse will require additional improvement and bugfixes. I will debug the HelloFuse after the stable version is released. Thanks |
You are welcome! BTW, I added some simple logging in the HelloFuse
|
WinFsp 2017 is out 🎉 Get it here: https://github.com/billziss-gh/winfsp/releases/tag/v1.0 It has the new |
This issue seems really great! 👍 I'm not quite familiar with I think garbled paths is a consequence of inconsistency between alignments/field offsets in structs and actual platform implementation. I would expect some differences there. Using JNR requires defining all the offsets for each field because from Java's point of view it has only some pointer and you need to know the offset for each field in order to access it. It's not a problem for most cases, but even one wrong offset for a field in the beginning, can lead to corruption of the whole structure. The first step might be to run this test The second step might be a bit trickier, it contains a few steps:
|
@SerCeMan thanks for stopping by!
Your comments make a lot of sense. I list here some general ideas as well as issues that came up when I was porting FUSEPY to native Windows and Cygwin (fusepy fork). I suspect that some of these may apply to a jnr-fuse port:
|
I could mount winfsp from Java with fuse-jna with these commits. Both HelloFS and MemoryFS run without error. Somehow Linux x86-64 alignments work for Windows environment without modification. When i am trying to test HelloFS, winfsp allow me to use seperator character Test environment: Win10, 32-bit Java 8 |
@ui4j fanastic work! Trying it now. EDIT: any quick instructions to build / run this? Will save me the googling :) |
git clone https://github.com/ui4j/fuse-jna.git
cd fuse-jna
gradlew.bat build -x test
gradlew.bat uberJar
copy "c:\Program Files (x86)\WinFsp\bin\*.dll" .
java -cp build\libs\fuse-jna-1.0.3-uber.jar net.fusejna.examples.HelloFS
cd X: java -cp build\libs\fuse-jna-1.0.3-uber.jar net.fusejna.examples.MemoryFS
cd X: |
@ui4j this works very well. Thank you!
I am not sure I completely understand what you mean. Can you give me an example? I tried using the |
BTW, you can get information about the WinFsp installation directory from the registry ( Here is how this is done in C code (notice the https://github.com/billziss-gh/winfsp/blob/master/inc/winfsp/winfsp.h#L1639 |
I'm a little confused. Do we have a working version that uses fuse-jnr instead of fuse-jna? (From what I understand, the jna version will be much much slower, but I could be wrong.) If we do have a working version of fuse-jnr that talks to winfsp, is there a simple example code (eg passthrough or memFS) that uses Java (and specifically fuse-jnr) you could point us to so that we could use as a starting point? That would be super super super cool..... |
@billziss-gh Just FYI: I requested the owner of jnr-fuse, @SerCeMan , to help and he made (huge?) progress towards getting jnr-fuse to work with winfsp. Please see the last few comments here: SerCeMan/jnr-fuse#16 (comment) So, jnr-fuse's helloWorld program works with winfsp now. However, the MemoryFS does not....I tried to take a look, but it's beyond my ability to understand where the problem may be, and @SerCeMan thinks it might require more expertise with Windows or WinFSP....any chance you might be able to take a look now that the HelloWolrd jnr-fuse program is working with winfsp (but the MemoryFS is not)? |
@gsaxena888 I will have a look. Thanks for the pointer. |
@billziss-gh I think this question is for the same thread - we are testing jnr-fuse and having problem with writing files on mounted disk. Seems like problem is in calls to Winfsp (see last two comments here: SerCeMan/jnr-fuse#16 (comment)) Could you please take a look if possible? I will try to provide more detailed stacktrace as soon as possible. |
Closing this issue as jnr-fuse now has support for Windows and WinFsp. |
Hi,
I am trying to integrate jnr-fuse with winfsp. jnr-fuse supports linux but not Windows. I add the fsp_ prefix to all fuse methods and could not run the HelloFuse example. jnr-fuse execute the fuse_main_real method to mount drive. Is there a missing step that needs to be done?
Thanks
Here is the error message:
The text was updated successfully, but these errors were encountered: