Skip to content

Commit

Permalink
Merge branch 'feature/xattr' into release/4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Nov 24, 2023
2 parents 6f86d67 + e53e100 commit 2cb7a28
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/main/java/org/cryptomator/frontend/fuse/ReadOnlyAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@
import java.util.EnumSet;
import java.util.Set;

import static org.cryptomator.jfuse.api.FuseOperations.Operation.GET_XATTR;
import static org.cryptomator.jfuse.api.FuseOperations.Operation.LIST_XATTR;

public sealed class ReadOnlyAdapter implements FuseNioAdapter permits ReadWriteAdapter {

private static final Logger LOG = LoggerFactory.getLogger(ReadOnlyAdapter.class);
private static final int BLOCKSIZE = 4096;

protected final Errno errno;
protected final Path root;
private final int maxFileNameLength;
Expand Down Expand Up @@ -85,15 +89,14 @@ public Errno errno() {

@Override
public Set<Operation> supportedOperations() {
// FIXME: respect enableXattr
return Set.of(Operation.ACCESS,
var supportedOps = EnumSet.of(Operation.ACCESS,
Operation.CHMOD,
Operation.CREATE,
Operation.DESTROY,
Operation.GET_ATTR,
Operation.GET_XATTR,
GET_XATTR,
Operation.INIT,
Operation.LIST_XATTR,
LIST_XATTR,
Operation.OPEN,
Operation.OPEN_DIR,
Operation.READ,
Expand All @@ -102,6 +105,11 @@ public Set<Operation> supportedOperations() {
Operation.RELEASE,
Operation.RELEASE_DIR,
Operation.STATFS);
if (!enableXattr) {
supportedOps.remove(GET_XATTR);
supportedOps.remove(LIST_XATTR);
}
return supportedOps;
}

private String stripLeadingFrom(String string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ public Mount mount() throws MountFailedException {
var builder = Fuse.builder();
var libPath = WinfspUtil.getWinFspInstallDir() + "bin\\" + (OS_ARCH.contains("aarch64") ? "winfsp-a64.dll" : "winfsp-x64.dll");
builder.setLibraryPath(libPath);
var fuseAdapter = ReadWriteAdapter.create(builder.errno(), vfsRoot, FuseNioAdapter.DEFAULT_MAX_FILENAMELENGTH, FileNameTranscoder.transcoder(), true);
//xattr disabled due to https://github.com/cryptomator/fuse-nio-adapter/issues/86
var fuseAdapter = ReadWriteAdapter.create(builder.errno(), vfsRoot, FuseNioAdapter.DEFAULT_MAX_FILENAMELENGTH, FileNameTranscoder.transcoder(), false);
try {
var fuse = builder.build(fuseAdapter);
fuse.mount("fuse-nio-adapter", mountPoint, combinedMountFlags().toArray(String[]::new));
Expand Down

0 comments on commit 2cb7a28

Please sign in to comment.