SerCeMan / jnr-fuse

FUSE implementation in Java using Java Native Runtime (JNR)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple folders created by FUSE cannot be monitored at the same time

Heachy opened this issue · comments

commented

When I used FUSE to create a J:/ directory and created the J:/1 and J:/2 folders, and used java.nio.file.watchService to monitor these two folders, I found that I could only monitor the first one, the second watchkey cannot be monitored, and then when I use cancel on the second watchkey, the first watchkey stops detecting, why is this, and how to solve it.

It feels like they are monitoring different folders on the surface, but they seem to be monitoring the same one, which is very strange.

Hope to get help!

commented

Or does jnr-fuse have a ready-made functional interface for monitoring file changes? I have seen that when debugging is turned on, there will be log output even when opening a file, but I don't know much about jnr-fuse.

Now there is a project that uses this. I need to determine whether the files in the mounted file directory have changed. What should I do?

Hi, @Heachy! I haven't explored the nuances of event notifications in the context of Windows, so unfortunately, I won't be able to help you with this. However, I do suggest understanding the problem layer by layer—first, understand which implementation of java.nio.file.WatchService is used, and which FS operations it delegates to. Then, understand how this translates to WinFsp and how those are connected to FUSE, and then finally, implement those operations in your file system.

commented

Hi, @Heachy! I haven't explored the nuances of event notifications in the context of Windows, so unfortunately, I won't be able to help you with this. However, I do suggest understanding the problem layer by layer—first, understand which implementation of java.nio.file.WatchService is used, and which FS operations it delegates to. Then, understand how this translates to WinFsp and how those are connected to FUSE, and then finally, implement those operations in your file system.

Thank you for your suggestion!

I have found through testing that file operations created by FS will go through the "create, write, truncate" and other methods under FuseStubFS. I only need to add a message push or the like when overriding these methods to achieve it.