Skip to content

Commit

Permalink
Merge branch 'release/2.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Mar 29, 2023
2 parents fa5338d + 75cea92 commit ef216c2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.cryptomator</groupId>
<artifactId>fuse-nio-adapter</artifactId>
<version>2.0.4</version>
<version>2.0.5</version>
<name>FUSE-NIO-Adapter</name>
<description>Access resources at a given NIO path via FUSE.</description>
<url>https://github.com/cryptomator/fuse-nio-adapter</url>
Expand All @@ -21,7 +21,7 @@

<!-- dependencies -->
<integrations-api.version>1.2.0</integrations-api.version>
<jfuse.version>0.4.1</jfuse.version>
<jfuse.version>0.4.2</jfuse.version>
<guava.version>31.1-jre</guava.version>
<slf4j.version>2.0.3</slf4j.version>
<caffeine.version>3.1.4</caffeine.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -31,8 +33,7 @@ public String displayName() {

@Override
public Set<MountCapability> 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
Expand All @@ -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
Expand All @@ -71,11 +79,9 @@ public MountBuilder setLoopbackHostName(String hostName) {
@Override
protected Set<String> 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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ef216c2

Please sign in to comment.