Skip to content

Commit 656c89f

Browse files
committed
Merge branch 'release/0.7.2'
2 parents fc5cbb2 + 2314fbe commit 656c89f

File tree

41 files changed

+2352
-778
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2352
-778
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,16 @@ on:
66

77
jobs:
88

9-
linux-amd64:
10-
name: Test jfuse-linux-amd64
11-
runs-on: ubuntu-latest
9+
linux:
10+
name: Test jfuse-linux packages
11+
strategy:
12+
matrix:
13+
include:
14+
- os: ubuntu-latest
15+
arch: x86_64
16+
- os: ubuntu-24.04-arm
17+
arch: aarch64
18+
runs-on: ${{ matrix.os }}
1219
steps:
1320
- uses: actions/checkout@v4
1421
- uses: actions/setup-java@v4
@@ -21,10 +28,10 @@ jobs:
2128
sudo apt-get update
2229
sudo apt-get install fuse3 libfuse3-dev
2330
- name: Maven build
24-
run: mvn -B verify -Dfuse.lib.path="/lib/x86_64-linux-gnu/libfuse3.so.3" --no-transfer-progress
31+
run: mvn -B verify -Dfuse.lib.path="/lib/${{ matrix.arch }}-linux-gnu/libfuse3.so.3" --no-transfer-progress
2532
- uses: actions/upload-artifact@v4
2633
with:
27-
name: coverage-linux-amd64
34+
name: coverage-linux-${{ matrix.arch }}
2835
path: jfuse-tests/target/site/jacoco-aggregate/jacoco.xml
2936
retention-days: 3
3037

@@ -74,7 +81,7 @@ jobs:
7481

7582
sonarcloud:
7683
name: Run SonarCloud Analysis
77-
needs: [linux-amd64, mac, win]
84+
needs: [linux, mac, win]
7885
runs-on: ubuntu-latest
7986
steps:
8087
- uses: actions/checkout@v4
@@ -93,8 +100,12 @@ jobs:
93100
restore-keys: ${{ runner.os }}-sonar
94101
- uses: actions/download-artifact@v4
95102
with:
96-
name: coverage-linux-amd64
97-
path: coverage/linux-amd64
103+
name: coverage-linux-x86_64
104+
path: coverage/linux-x86_64
105+
- uses: actions/download-artifact@v4
106+
with:
107+
name: coverage-linux-aarch64
108+
path: coverage/linux-aarch64
98109
- uses: actions/download-artifact@v4
99110
with:
100111
name: coverage-mac

jfuse-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.cryptomator</groupId>
77
<artifactId>jfuse-parent</artifactId>
8-
<version>0.7.1</version>
8+
<version>0.7.2</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<artifactId>jfuse-api</artifactId>

jfuse-examples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.cryptomator</groupId>
77
<artifactId>jfuse-parent</artifactId>
8-
<version>0.7.1</version>
8+
<version>0.7.2</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<artifactId>jfuse-examples</artifactId>

jfuse-linux-aarch64/pom.xml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>jfuse-parent</artifactId>
77
<groupId>org.cryptomator</groupId>
8-
<version>0.7.1</version>
8+
<version>0.7.2</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<artifactId>jfuse-linux-aarch64</artifactId>
@@ -99,12 +99,11 @@
9999
<headerClassName>fuse_h</headerClassName>
100100
<cPreprocessorMacros>
101101
<cPreprocessorMacro>_FILE_OFFSET_BITS=64</cPreprocessorMacro>
102-
<cPreprocessorMacro>FUSE_USE_VERSION=312</cPreprocessorMacro>
102+
<cPreprocessorMacro>FUSE_USE_VERSION=317</cPreprocessorMacro>
103103
</cPreprocessorMacros>
104104
<includeFunctions>
105105
<includeFunction>fuse_version</includeFunction>
106106
<includeFunction>fuse_lib_help</includeFunction>
107-
<includeFunction>fuse_new</includeFunction>
108107
<includeFunction>fuse_mount</includeFunction>
109108
<includeFunction>fuse_get_session</includeFunction>
110109
<includeFunction>fuse_loop</includeFunction>
@@ -144,7 +143,7 @@
144143
<headerClassName>fuse_lowlevel_h</headerClassName>
145144
<cPreprocessorMacros>
146145
<cPreprocessorMacro>_FILE_OFFSET_BITS=64</cPreprocessorMacro>
147-
<cPreprocessorMacro>FUSE_USE_VERSION=312</cPreprocessorMacro>
146+
<cPreprocessorMacro>FUSE_USE_VERSION=317</cPreprocessorMacro>
148147
</cPreprocessorMacros>
149148
<includeStructs>
150149
<includeStruct>fuse_cmdline_opts</includeStruct>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package org.cryptomator.jfuse.linux.aarch64;
2+
3+
import org.cryptomator.jfuse.linux.aarch64.extr.fuse3.fuse_h;
4+
5+
import java.lang.foreign.FunctionDescriptor;
6+
import java.lang.foreign.Linker;
7+
import java.lang.foreign.MemorySegment;
8+
import java.lang.foreign.SymbolLookup;
9+
import java.lang.invoke.MethodHandle;
10+
11+
/**
12+
* Class for not jextract'able symbols, e.g. fuse_new_31
13+
*/
14+
public class FuseFFIHelper {
15+
16+
17+
static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup()
18+
.or(Linker.nativeLinker().defaultLookup());
19+
20+
static MemorySegment findOrThrow(String symbol) {
21+
return SYMBOL_LOOKUP.find(symbol)
22+
.orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol));
23+
}
24+
25+
private static class fuse_new_31 {
26+
public static final FunctionDescriptor DESC = FunctionDescriptor.of(
27+
fuse_h.C_POINTER,
28+
fuse_h.C_POINTER,
29+
fuse_h.C_POINTER,
30+
fuse_h.C_LONG,
31+
fuse_h.C_POINTER
32+
);
33+
34+
public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(
35+
findOrThrow("fuse_new_31"),
36+
DESC);
37+
}
38+
39+
/**
40+
* Function descriptor for:
41+
* {@snippet lang = c:
42+
* struct fuse *fuse_new(struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *private_data)
43+
*}
44+
*/
45+
public static FunctionDescriptor fuse_new_31$descriptor() {
46+
return fuse_new_31.DESC;
47+
}
48+
49+
50+
/**
51+
* Downcall method handle for:
52+
* {@snippet lang = c:
53+
* struct fuse *fuse_new(struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *private_data)
54+
*}
55+
*/
56+
public static MethodHandle fuse_new_31$handle() {
57+
return fuse_new_31.HANDLE;
58+
}
59+
60+
/**
61+
* {@snippet lang = c:
62+
* struct fuse *fuse_new(struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *private_data)
63+
*}
64+
*/
65+
public static MemorySegment fuse_new_31(MemorySegment args, MemorySegment op, long op_size, MemorySegment private_data) {
66+
var mh$ = fuse_new_31.HANDLE;
67+
try {
68+
return (MemorySegment) mh$.invokeExact(args, op, op_size, private_data);
69+
} catch (Throwable ex$) {
70+
throw new AssertionError("should not reach here", ex$);
71+
}
72+
}
73+
}

jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,22 @@ public FuseImpl(FuseOperations fuseOperations) {
2828
@Override
2929
protected FuseMount mount(List<String> args) throws FuseMountFailedException {
3030
var fuseArgs = parseArgs(args);
31-
var fuse = fuse_h.fuse_new(fuseArgs.args(), fuseOperationsStruct, fuseOperationsStruct.byteSize(), MemorySegment.NULL);
32-
if (MemorySegment.NULL.equals(fuse)) {
33-
throw new FuseMountFailedException("fuse_new failed");
34-
}
31+
var fuse = createFuseFS(fuseArgs);
3532
if (fuse_h.fuse_mount(fuse, fuseArgs.mountPoint()) != 0) {
3633
throw new FuseMountFailedException("fuse_mount failed");
3734
}
3835
return new FuseMountImpl(fuse, fuseArgs);
3936
}
4037

38+
@VisibleForTesting
39+
MemorySegment createFuseFS(FuseArgs fuseArgs) throws FuseMountFailedException {
40+
var fuse = FuseFFIHelper.fuse_new_31(fuseArgs.args(), fuseOperationsStruct, fuseOperationsStruct.byteSize(), MemorySegment.NULL);
41+
if (MemorySegment.NULL.equals(fuse)) {
42+
throw new FuseMountFailedException("fuse_new failed");
43+
}
44+
return fuse;
45+
}
46+
4147
@VisibleForTesting
4248
FuseArgs parseArgs(List<String> cmdLineArgs) throws IllegalArgumentException {
4349
var args = fuse_args.allocate(fuseArena);

jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/extr/fuse3/fuse_args.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,15 @@ public static MemorySegment allocateArray(long elementCount, SegmentAllocator al
203203
}
204204

205205
/**
206-
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any).
206+
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
207207
* The returned segment has size {@code layout().byteSize()}
208208
*/
209209
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
210210
return reinterpret(addr, 1, arena, cleanup);
211211
}
212212

213213
/**
214-
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any).
214+
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
215215
* The returned segment has size {@code elementCount * layout().byteSize()}
216216
*/
217217
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {

0 commit comments

Comments
 (0)