From b6477a97cd68e03e59421837e91441523d771a5b Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 15 Mar 2023 17:34:57 +0100 Subject: [PATCH 1/5] add FILE_SYSTEM_NAME capability to winfspNetworkMountService --- .../frontend/fuse/mount/WinFspNetworkMountProvider.java | 3 ++- .../frontend/fuse/mount/MirroringFuseMountTest.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) 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..84b04bb 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspNetworkMountProvider.java +++ b/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspNetworkMountProvider.java @@ -11,6 +11,7 @@ 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; @@ -32,7 +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(MOUNT_FLAGS, MOUNT_AS_DRIVE_LETTER, UNMOUNT_FORCED, READ_ONLY, VOLUME_NAME, LOOPBACK_HOST_NAME, FILE_SYSTEM_NAME); } @Override 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 { From 64b0b87fef6a584c1612f22ef88361b86d05e288 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 17 Mar 2023 16:31:50 +0100 Subject: [PATCH 2/5] WinFspNetworkMountService: replace volumeName capability with volume id --- .../mount/WinFspNetworkMountProvider.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) 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 84b04bb..b0a6bcf 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspNetworkMountProvider.java +++ b/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspNetworkMountProvider.java @@ -17,6 +17,7 @@ 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) @@ -32,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, FILE_SYSTEM_NAME); + return EnumSet.of(MOUNT_FLAGS, MOUNT_AS_DRIVE_LETTER, UNMOUNT_FORCED, READ_ONLY, VOLUME_ID, LOOPBACK_HOST_NAME, FILE_SYSTEM_NAME); } @Override @@ -45,11 +45,23 @@ 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 setVolumeName(String name) { + throw new UnsupportedOperationException(); + } + + @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 @@ -72,11 +84,7 @@ 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.add("-oVolumePrefix=/" + loopbackHostName + "/" + volumeId); return combined; } } From 666850d175327ea8ee39ff86a983faa131c83231 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 29 Mar 2023 13:45:01 +0200 Subject: [PATCH 3/5] closes #75 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e493ab0..93aac53 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.2.0 - 0.4.1 + 0.4.2 31.1-jre 2.0.3 3.1.4 From 595b7128504ea4d7a97ee2dde1000c5b400246e8 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 29 Mar 2023 13:45:39 +0200 Subject: [PATCH 4/5] fixes #74 --- .../fuse/mount/WinFspNetworkMountProvider.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) 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 b0a6bcf..1bec80d 100644 --- a/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspNetworkMountProvider.java +++ b/src/main/java/org/cryptomator/frontend/fuse/mount/WinFspNetworkMountProvider.java @@ -33,7 +33,7 @@ public String displayName() { @Override public Set capabilities() { - return EnumSet.of(MOUNT_FLAGS, MOUNT_AS_DRIVE_LETTER, UNMOUNT_FORCED, READ_ONLY, VOLUME_ID, LOOPBACK_HOST_NAME, FILE_SYSTEM_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 @@ -51,11 +51,6 @@ public WinFspNetworkMountBuilder(Path vfsRoot) { super(vfsRoot); } - @Override - public MountBuilder setVolumeName(String name) { - throw new UnsupportedOperationException(); - } - @Override public MountBuilder setVolumeId(String id) { this.volumeId = id; @@ -84,7 +79,9 @@ public MountBuilder setLoopbackHostName(String hostName) { @Override protected Set combinedMountFlags() { var combined = super.combinedMountFlags(); - combined.add("-oVolumePrefix=/" + loopbackHostName + "/" + volumeId); + combined.removeIf(flag -> flag.startsWith("-oVolumePrefix=")); + combined.removeIf(flag -> flag.startsWith("-oUNC=")); + combined.add("-oUNC=/" + loopbackHostName + "/" + volumeId + "/" + volumeName); return combined; } } From 75cea9284f3f3f569c8cd7277488d596af5a18a9 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 29 Mar 2023 13:51:10 +0200 Subject: [PATCH 5/5] prepare 2.0.5 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 93aac53..35043ed 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 org.cryptomator fuse-nio-adapter - 2.1.0-SNAPSHOT + 2.0.5 FUSE-NIO-Adapter Access resources at a given NIO path via FUSE. https://github.com/cryptomator/fuse-nio-adapter