Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update project to JDK 21 and JEP 442 #32

Merged
merged 20 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 20
java-version: 21-ea
distribution: 'zulu'
cache: 'maven'
- name: Setup fuse
Expand All @@ -35,7 +35,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 20
java-version: 21-ea
distribution: 'zulu'
cache: 'maven'
- name: Setup fuse
Expand All @@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 20
java-version: 21-ea
distribution: 'zulu'
cache: 'maven'
- name: Setup fuse
Expand Down
10 changes: 4 additions & 6 deletions jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public abstract class Fuse implements AutoCloseable {
/**
* The memory session associated with the lifecycle of this Fuse instance.
*/
protected final Arena fuseArena = Arena.openShared();
protected final Arena fuseArena = Arena.ofShared();

/**
* The file system operations invoked by this FUSE file system.
Expand Down Expand Up @@ -156,11 +156,9 @@ void waitForMountingToComplete(Path mountPoint, Future<Integer> fuseLoop) throws
@Blocking
private int fuseLoop(FuseMount mount) {
AtomicInteger result = new AtomicInteger();
fuseArena.scope().whileAlive(() -> {
int r = mount.loop();
result.set(r);
});
return result.get();
int r = mount.loop();
result.set(r);
return r;
infeo marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down
11 changes: 7 additions & 4 deletions jfuse-linux-aarch64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
<executable>/Users/sebastian/Documents/Cryptomator/jextract/build/jextract/bin/jextract</executable>
<headerSearchPaths>${linux.headerSearchPath}</headerSearchPaths>
<outputDirectory>${project.build.sourceDirectory}</outputDirectory>
<targetPackage>org.cryptomator.jfuse.linux.aarch64.extr</targetPackage>
</configuration>
<executions>
<execution>
Expand All @@ -84,6 +83,7 @@
</goals>
<configuration>
<headerFile>${project.parent.basedir}/libfuse3/include/fuse.h</headerFile>
<targetPackage>org.cryptomator.jfuse.linux.aarch64.extr.fuse3</targetPackage>
<headerClassName>fuse_h</headerClassName>
<cPreprocessorMacros>
<cPreprocessorMacro>_FILE_OFFSET_BITS=64</cPreprocessorMacro>
Expand Down Expand Up @@ -128,7 +128,7 @@
</goals>
<configuration>
<headerFile>${project.parent.basedir}/libfuse3/include/fuse_lowlevel.h</headerFile>
<targetPackage>org.cryptomator.jfuse.linux.aarch64.extr</targetPackage>
<targetPackage>org.cryptomator.jfuse.linux.aarch64.extr.fuse3_lowlevel</targetPackage>
<headerClassName>fuse_lowlevel_h</headerClassName>
<cPreprocessorMacros>
<cPreprocessorMacro>_FILE_OFFSET_BITS=64</cPreprocessorMacro>
Expand All @@ -146,6 +146,7 @@
</goals>
<configuration>
<headerFile>${linux.headerSearchPath}/errno.h</headerFile>
<targetPackage>org.cryptomator.jfuse.linux.aarch64.extr.errno</targetPackage>
<headerClassName>errno_h</headerClassName>
<includeConstants>
<includeConstant>ENOENT</includeConstant>
Expand Down Expand Up @@ -174,6 +175,7 @@
</goals>
<configuration>
<headerFile>${linux.headerSearchPath}/sys/stat.h</headerFile>
<targetPackage>org.cryptomator.jfuse.linux.aarch64.extr.stat</targetPackage>
<headerClassName>stat_h</headerClassName>
<includeConstants>
<includeConstant>UTIME_NOW</includeConstant>
Expand All @@ -188,6 +190,7 @@
</goals>
<configuration>
<headerFile>${linux.headerSearchPath}/fcntl.h</headerFile>
<targetPackage>org.cryptomator.jfuse.linux.aarch64.extr.fcntl</targetPackage>
<headerClassName>fcntl_h</headerClassName>
<includeConstants>
<includeConstant>O_RDONLY</includeConstant>
Expand All @@ -209,6 +212,7 @@
</goals>
<configuration>
<headerFile>${linux.headerSearchPath}/stdio.h</headerFile>
<targetPackage>org.cryptomator.jfuse.linux.aarch64.extr.stdio</targetPackage>
<headerClassName>stdio_h</headerClassName>
<cPreprocessorMacros>
<cPreprocessorMacro>_GNU_SOURCE=1</cPreprocessorMacro>
Expand All @@ -227,5 +231,4 @@
</build>
</profile>
</profiles>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

import org.cryptomator.jfuse.api.DirFiller;
import org.cryptomator.jfuse.api.Stat;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse_fill_dir_t;
import org.cryptomator.jfuse.linux.aarch64.extr.stat;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse3.fuse_fill_dir_t;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse3.stat;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.util.function.Consumer;

record DirFillerImpl(MemorySegment buf, fuse_fill_dir_t callback, Arena arena) implements DirFiller {

DirFillerImpl(MemorySegment buf, MemorySegment callback, Arena arena) {
this(buf, fuse_fill_dir_t.ofAddress(callback, arena.scope()), arena);
this(buf, fuse_fill_dir_t.ofAddress(callback, arena), arena);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.cryptomator.jfuse.linux.aarch64;

import org.cryptomator.jfuse.api.FileInfo;
import org.cryptomator.jfuse.linux.aarch64.extr.fcntl_h;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse_file_info;
import org.cryptomator.jfuse.linux.aarch64.extr.fcntl.fcntl_h;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse3.fuse_file_info;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.nio.file.StandardOpenOption;
import java.util.EnumSet;
import java.util.Set;
Expand All @@ -22,7 +22,7 @@ record FileInfoImpl(MemorySegment segment) implements FileInfo {
private static final int O_SYNC = fcntl_h.O_SYNC();
private static final int O_DSYNC = fcntl_h.O_DSYNC();

public FileInfoImpl(MemorySegment address, SegmentScope scope) {
public FileInfoImpl(MemorySegment address, Arena scope) {
this(fuse_file_info.ofAddress(address, scope));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.cryptomator.jfuse.linux.aarch64;

import org.cryptomator.jfuse.linux.aarch64.extr.fuse_args;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse_cmdline_opts;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse3.fuse_args;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse3_lowlevel.fuse_cmdline_opts;

import java.lang.foreign.MemorySegment;
import java.lang.foreign.ValueLayout;
Expand All @@ -14,7 +14,7 @@ public String toString() {
var argc = fuse_args.argc$get(args);
var argv = fuse_args.argv$get(args);
for (int i = 0; i < argc; i++) {
var cString = argv.getAtIndex(ValueLayout.ADDRESS.asUnbounded(), i);
var cString = argv.getAtIndex(ValueLayout.ADDRESS.withoutTargetLayout().withName("arg[%d]".formatted(i)), i).reinterpret(Long.MAX_VALUE);
overheadhunter marked this conversation as resolved.
Show resolved Hide resolved
sb.append("arg[").append(i).append("] = ").append(cString.getUtf8String(0)).append(", ");
}
sb.append("mountPoint = ").append(mountPoint().getUtf8String(0));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.cryptomator.jfuse.linux.aarch64;

import org.cryptomator.jfuse.api.FuseConfig;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse_config;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse3.fuse_config;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;

record FuseConfigImpl(MemorySegment segment) implements FuseConfig {

public FuseConfigImpl(MemorySegment address, SegmentScope scope) {
public FuseConfigImpl(MemorySegment address, Arena scope) {
this(fuse_config.ofAddress(address, scope));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.cryptomator.jfuse.linux.aarch64;

import org.cryptomator.jfuse.api.FuseConnInfo;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse_conn_info;
import org.cryptomator.jfuse.linux.aarch64.extr.fuse3.fuse_conn_info;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;

record FuseConnInfoImpl(MemorySegment segment) implements FuseConnInfo {

public FuseConnInfoImpl(MemorySegment address, SegmentScope scope) {
public FuseConnInfoImpl(MemorySegment address, Arena scope) {
this(fuse_conn_info.ofAddress(address, scope));
}

Expand Down
Loading
Loading