diff --git a/pom.xml b/pom.xml index bdb4953..35043ed 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 org.cryptomator fuse-nio-adapter - 2.0.4 + 2.0.5 FUSE-NIO-Adapter Access resources at a given NIO path via FUSE. https://github.com/cryptomator/fuse-nio-adapter @@ -21,7 +21,7 @@ 1.2.0 - 0.4.1 + 0.4.2 31.1-jre 2.0.3 3.1.4 diff --git a/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspNetworkMountProvider.java b/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspNetworkMountProvider.java index 447d107..1bec80d 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspNetworkMountProvider.java +++ b/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspNetworkMountProvider.java @@ -11,11 +11,13 @@ import java.util.UUID; import java.util.regex.Pattern; +import static org.cryptomator.integrations.mount.MountCapability.FILE_SYSTEM_NAME; import static org.cryptomator.integrations.mount.MountCapability.LOOPBACK_HOST_NAME; import static org.cryptomator.integrations.mount.MountCapability.MOUNT_AS_DRIVE_LETTER; import static org.cryptomator.integrations.mount.MountCapability.MOUNT_FLAGS; import static org.cryptomator.integrations.mount.MountCapability.READ_ONLY; import static org.cryptomator.integrations.mount.MountCapability.UNMOUNT_FORCED; +import static org.cryptomator.integrations.mount.MountCapability.VOLUME_ID; import static org.cryptomator.integrations.mount.MountCapability.VOLUME_NAME; @Priority(100) @@ -31,8 +33,7 @@ public String displayName() { @Override public Set capabilities() { - // no MOUNT_WITHIN_EXISTING_PARENT support here - return EnumSet.of(MOUNT_FLAGS, MOUNT_AS_DRIVE_LETTER, UNMOUNT_FORCED, READ_ONLY, VOLUME_NAME, LOOPBACK_HOST_NAME); + return EnumSet.of(FILE_SYSTEM_NAME, LOOPBACK_HOST_NAME, MOUNT_AS_DRIVE_LETTER, MOUNT_FLAGS, READ_ONLY, UNMOUNT_FORCED, VOLUME_ID, VOLUME_NAME); } @Override @@ -44,11 +45,18 @@ public MountBuilder forFileSystem(Path vfsRoot) { private static class WinFspNetworkMountBuilder extends WinFspMountBuilder { private String loopbackHostName = "localhost"; + private String volumeId = UUID.randomUUID().toString(); public WinFspNetworkMountBuilder(Path vfsRoot) { super(vfsRoot); } + @Override + public MountBuilder setVolumeId(String id) { + this.volumeId = id; + return this; + } + @Override public MountBuilder setMountpoint(Path mountPoint) { if (mountPoint.getRoot().equals(mountPoint)) { // MOUNT_AS_DRIVE_LETTER @@ -71,11 +79,9 @@ public MountBuilder setLoopbackHostName(String hostName) { @Override protected Set combinedMountFlags() { var combined = super.combinedMountFlags(); - if (volumeName != null && !volumeName.isBlank()) { - combined.add("-oVolumePrefix=/" + loopbackHostName + "/" + volumeName); - } else { - combined.add("-oVolumePrefix=/" + loopbackHostName + "/" + UUID.randomUUID()); - } + combined.removeIf(flag -> flag.startsWith("-oVolumePrefix=")); + combined.removeIf(flag -> flag.startsWith("-oUNC=")); + combined.add("-oUNC=/" + loopbackHostName + "/" + volumeId + "/" + volumeName); return combined; } } diff --git a/src/test/java/org/cryptomator/frontend/fuse/mount/MirroringFuseMountTest.java b/src/test/java/org/cryptomator/frontend/fuse/mount/MirroringFuseMountTest.java index 2fb2873..5311b65 100644 --- a/src/test/java/org/cryptomator/frontend/fuse/mount/MirroringFuseMountTest.java +++ b/src/test/java/org/cryptomator/frontend/fuse/mount/MirroringFuseMountTest.java @@ -97,6 +97,9 @@ private static void mount(MountService mountProvider, Path pathToMirror, Scanner if (mountProvider.hasCapability(MountCapability.LOOPBACK_HOST_NAME)) { mountBuilder.setLoopbackHostName("mirrorHost"); } + if (mountProvider.hasCapability(MountCapability.FILE_SYSTEM_NAME)) { + mountBuilder.setFileSystemName("MirrorFS"); + } if (mountProvider.hasCapability(MountCapability.MOUNT_TO_SYSTEM_CHOSEN_PATH)) { // don't set a mount point } else {