-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
53 changed files
with
840 additions
and
891 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseFunctions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.cryptomator.jfuse.linux.aarch64; | ||
|
||
import java.lang.foreign.Addressable; | ||
import java.lang.foreign.FunctionDescriptor; | ||
import java.lang.foreign.Linker; | ||
import java.lang.foreign.SymbolLookup; | ||
import java.lang.invoke.MethodHandle; | ||
|
||
import static java.lang.foreign.ValueLayout.ADDRESS; | ||
import static java.lang.foreign.ValueLayout.JAVA_INT; | ||
|
||
/** | ||
* These method references can not be jextract'ed, partly due to jextract not being able to understand {@code #define}, | ||
* partly due to slight differences in the FUSE API, which applies a versioning scheme via dlvsym, that Panama's default | ||
* {@link java.lang.foreign.SymbolLookup} doesn't support. | ||
*/ | ||
class FuseFunctions { | ||
|
||
// see https://github.com/libfuse/libfuse/blob/fuse-3.12.0/include/fuse_lowlevel.h#L1892-L1923 | ||
private static final FunctionDescriptor FUSE_PARSE_CMDLINE = FunctionDescriptor.of(JAVA_INT, ADDRESS, ADDRESS); | ||
|
||
private final MethodHandle fuse_parse_cmdline; | ||
|
||
private FuseFunctions() { | ||
var lookup = SymbolLookup.loaderLookup(); | ||
var linker = Linker.nativeLinker(); | ||
this.fuse_parse_cmdline = lookup.lookup("fuse_parse_cmdline") | ||
.map(symbol -> linker.downcallHandle(symbol, FUSE_PARSE_CMDLINE)) | ||
.orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol fuse_parse_cmdline")); | ||
} | ||
|
||
private static class Holder { | ||
private static final FuseFunctions INSTANCE = new FuseFunctions(); | ||
} | ||
|
||
public static int fuse_parse_cmdline(Addressable args, Addressable opts) { | ||
try { | ||
return (int) Holder.INSTANCE.fuse_parse_cmdline.invokeExact(args, opts); | ||
} catch (Throwable e) { | ||
throw new AssertionError("should not reach here", e); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.