Skip to content

Commit

Permalink
Merge branch 'release/0.7.0'
Browse files Browse the repository at this point in the history
overheadhunter committed Mar 21, 2024
2 parents 325b4c3 + 79aedba commit 8e5a31d
Showing 328 changed files with 31,997 additions and 23,032 deletions.
9 changes: 9 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json
language: "en"
reviews:
path_filters:
- "!**/extr/**"
auto_review:
enabled: true
chat:
auto_reply: true
23 changes: 21 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -6,11 +6,30 @@ updates:
interval: "weekly"
day: "monday"
time: "06:00"
timezone: "UTC"
timezone: "Etc/UTC"
groups:
maven-dependencies:
java-test-dependencies:
patterns:
- "org.junit.jupiter:*"
- "org.mockito:*"
maven-build-plugins:
patterns:
- "org.apache.maven.plugins:*"
- "org.jacoco:jacoco-maven-plugin"
- "io.github.coffeelibs:jextract-maven-plugin"
- "org.sonatype.plugins:nexus-staging-maven-plugin"
- "org.codehaus.mojo:exec-maven-plugin"
java-production-dependencies:
patterns:
- "*"
exclude-patterns:
- "org.junit.jupiter:*"
- "org.mockito:*"
- "org.apache.maven.plugins:*"
- "org.jacoco:jacoco-maven-plugin"
- "io.github.coffeelibs:jextract-maven-plugin"
- "org.sonatype.plugins:nexus-staging-maven-plugin"
- "org.codehaus.mojo:exec-maven-plugin"

- package-ecosystem: "github-actions"
directory: "/" # even for `.github/workflows`
30 changes: 15 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -10,9 +10,9 @@ jobs:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'zulu'
cache: 'maven'
- name: Setup fuse
@@ -21,7 +21,7 @@ jobs:
sudo apt-get install fuse3 libfuse3-dev
- name: Maven build
run: mvn -B verify -Dfuse.lib.path="/lib/x86_64-linux-gnu/libfuse3.so.3"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: coverage-linux-amd64
path: jfuse-tests/target/site/jacoco-aggregate/jacoco.xml
@@ -33,9 +33,9 @@ jobs:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'zulu'
cache: 'maven'
- name: Setup fuse
@@ -45,7 +45,7 @@ jobs:
brew install fuse-t
- name: Maven build
run: mvn -B verify -Dfuse.lib.path="/usr/local/lib/libfuse-t.dylib"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: coverage-mac
path: jfuse-tests/target/site/jacoco-aggregate/jacoco.xml
@@ -57,17 +57,17 @@ jobs:
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'zulu'
cache: 'maven'
- name: Setup fuse
run: choco install winfsp --version 1.12.22339 -y
- name: Maven build
shell: bash # surprise, running maven in pwsh is crappy, see https://stackoverflow.com/q/6347985/4014509
run: mvn -B verify -Dfuse.lib.path="C:\Program Files (x86)\WinFsp\bin\winfsp-x64.dll"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: coverage-win
path: jfuse-tests/target/site/jacoco-aggregate/jacoco.xml
@@ -81,26 +81,26 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'zulu'
cache: 'maven'
- name: Cache SonarCloud packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: coverage-linux-amd64
path: coverage/linux-amd64
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: coverage-mac
path: coverage/mac
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: coverage-win
path: coverage/win
4 changes: 2 additions & 2 deletions .github/workflows/publish-central.yml
Original file line number Diff line number Diff line change
@@ -13,9 +13,9 @@ jobs:
- uses: actions/checkout@v4
with:
ref: "refs/tags/${{ github.event.inputs.tag }}"
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'zulu'
cache: 'maven'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
4 changes: 2 additions & 2 deletions .github/workflows/publish-github.yml
Original file line number Diff line number Diff line change
@@ -8,9 +8,9 @@ jobs:
if: startsWith(github.ref, 'refs/tags/') # only allow publishing tagged versions
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 21
java-version: 22
distribution: 'zulu'
cache: 'maven'
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/HelloWorldFileSystem.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/HelloWorldFileSystem__Windows_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/PosixMirrorFileSystem__Linux_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/PosixMirrorFileSystem__fuse_t_.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/RandomFileSystem.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/WindowsMirrorFileSystem.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@

# jFUSE

Zero-Dependency Java bindings for FUSE using [JEP 442](https://openjdk.org/jeps/442).
Zero-Dependency Java bindings for FUSE using [JEP 454](https://openjdk.org/jeps/454).

## Status

This is currently an experimental library requiring JDK 21. As long as the [Foreign Function & Memory API](https://openjdk.org/jeps/442) is incubating, the required JDK will increase.
Older JDK versions are *not supported*. Please refer to an older version of this lib, if you are interested in using it with an older JDK. Older versions will not receive patches or any kind of support, though!
This lib makes use of the [Foreign Function & Memory API](https://openjdk.org/jeps/454), requiring at least JDK 22.
Older JDK versions are *not supported*. Please refer to an older version of this lib, if you are interested in using it with an older JDK (with `--enable-preview`). Older versions will not receive patches or any kind of support, though!

We attempt to support libfuse 3.x on Linux and Windows while also remaining compatible with libfuse 2.x on macOS, leading to some compromises in the API.

@@ -97,7 +97,6 @@ During runtime, you will need to add allow native access from platform-specific
java -p path/to/mods \
-m com.example.mymodule/com.example.mymodule \
--enable-native-access=org.cryptomator.jfuse.mac \
--enable-preview
```

## Supported Platforms
2 changes: 1 addition & 1 deletion jfuse-api/pom.xml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<parent>
<groupId>org.cryptomator</groupId>
<artifactId>jfuse-parent</artifactId>
<version>0.6.3</version>
<version>0.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jfuse-api</artifactId>
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ public class MemoryUtils {

@Nullable
public static String toUtf8StringOrNull(MemorySegment string, long offset) {
return MemorySegment.NULL.equals(string) ? null : string.getUtf8String(offset);
return MemorySegment.NULL.equals(string) ? null : string.getString(offset);
}

@Nullable
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ public class MemoryUtilsTest {
void testValidSegmentReturnsString() {
try (var arena = Arena.ofConfined()) {
var address = arena.allocate(4);
address.setUtf8String(0, "abc");
address.setString(0, "abc");
String result = MemoryUtils.toUtf8StringOrNull(address);
Assertions.assertEquals("abc", result);
}
@@ -26,7 +26,7 @@ void testValidSegmentReturnsString() {
void testValidSegmentReturnsStringAtOffset() {
try (var arena = Arena.ofConfined()) {
var address = arena.allocate(10);
address.setUtf8String(5, "abc");
address.setString(5, "abc");
String result = MemoryUtils.toUtf8StringOrNull(address, 5);
Assertions.assertEquals("abc", result);
}
2 changes: 1 addition & 1 deletion jfuse-examples/README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

Assuming you have built the parent project (`mvn package`), you can run these examples directly from the shell.

These examples require JDK 19 or newer. You may want to adjust paths, such as the `java.library.path`.
These examples require JDK 22 or newer. You may want to adjust paths, such as the `java.library.path`.

### Running the hello world example:

4 changes: 2 additions & 2 deletions jfuse-examples/pom.xml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<parent>
<groupId>org.cryptomator</groupId>
<artifactId>jfuse-parent</artifactId>
<version>0.6.3</version>
<version>0.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jfuse-examples</artifactId>
@@ -24,7 +24,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.9</version>
<version>2.0.12</version>
</dependency>
</dependencies>

16 changes: 14 additions & 2 deletions jfuse-linux-aarch64/pom.xml
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
<parent>
<artifactId>jfuse-parent</artifactId>
<groupId>org.cryptomator</groupId>
<version>0.6.3</version>
<version>0.7.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jfuse-linux-aarch64</artifactId>
@@ -25,6 +25,18 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>@{surefire.jacoco.args} -javaagent:${net.bytebuddy:byte-buddy-agent:jar} --enable-native-access=org.cryptomator.jfuse.linux.aarch64</argLine>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jextract-linux-aarch64</id>
@@ -69,7 +81,7 @@
<plugin>
<groupId>io.github.coffeelibs</groupId>
<artifactId>jextract-maven-plugin</artifactId>
<version>0.3.0</version>
<version>0.4.0</version>
<configuration>
<executable>/Users/sebastian/git/github.com/openjdk/jextract/build/jextract/bin/jextract</executable>
<headerSearchPaths>${linux.headerSearchPath}</headerSearchPaths>
Original file line number Diff line number Diff line change
@@ -9,17 +9,13 @@
import java.lang.foreign.MemorySegment;
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), arena);
}
record DirFillerImpl(MemorySegment buf, MemorySegment callback, Arena arena) implements DirFiller {

@Override
public int fill(String name, Consumer<Stat> statFiller, long offset, int flags) {
var statSegment = stat.allocate(arena);
statFiller.accept(new StatImpl(statSegment));
return callback.apply(buf, arena.allocateUtf8String(name), statSegment, offset, flags);
return fuse_fill_dir_t.invoke(callback, buf, arena.allocateFrom(name), statSegment, offset, flags);
}

}
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
import org.cryptomator.jfuse.linux.aarch64.extr.fuse3.fuse_file_info;
import org.jetbrains.annotations.Nullable;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;
import java.nio.file.StandardOpenOption;
import java.util.EnumSet;
@@ -24,34 +23,29 @@ record FileInfoImpl(MemorySegment segment) implements FileInfo {
private static final int O_DSYNC = fcntl_h.O_DSYNC();

/**
* Factory method to map native memory to an {@link FileInfo} object
* Null-safe factory method to map native memory to an {@link FileInfo} object
*
* @param address the {@link MemorySegment} representing the starting address
* @param scope the {@link Arena} in which this object will be alive
* @return an {@link FileInfo} object or {@code null} if {@code address} is a NULL pointer
*/
@Nullable
public static FileInfoImpl of(MemorySegment address, Arena scope) {
return MemorySegment.NULL.equals(address) ? null : new FileInfoImpl(address, scope);
}

public FileInfoImpl(MemorySegment address, Arena scope) {
this(fuse_file_info.ofAddress(address, scope));
public static FileInfoImpl ofNullable(MemorySegment address) {
return MemorySegment.NULL.equals(address) ? null : new FileInfoImpl(address);
}

@Override
public long getFh() {
return fuse_file_info.fh$get(segment);
return fuse_file_info.fh(segment);
}

@Override
public void setFh(long fh) {
fuse_file_info.fh$set(segment, fh);
fuse_file_info.fh(segment, fh);
}

@Override
public int getFlags() {
return fuse_file_info.flags$get(segment);
return fuse_file_info.flags(segment);
}

@Override
@@ -91,7 +85,7 @@ public Set<StandardOpenOption> getOpenFlags() {

@Override
public long getLockOwner() {
return fuse_file_info.lock_owner$get(segment);
return fuse_file_info.lock_owner(segment);
}

}
Original file line number Diff line number Diff line change
@@ -11,35 +11,35 @@ record FuseArgs(MemorySegment args, MemorySegment cmdLineOpts) {
@Override
public String toString() {
var sb = new StringBuilder();
var argc = fuse_args.argc$get(args);
var argv = fuse_args.argv$get(args);
var argc = fuse_args.argc(args);
var argv = fuse_args.argv(args);
for (int i = 0; i < argc; i++) {
var cString = argv.getAtIndex(ValueLayout.ADDRESS, i).reinterpret(Long.MAX_VALUE);
sb.append("arg[").append(i).append("] = ").append(cString.getUtf8String(0)).append(", ");
sb.append("arg[").append(i).append("] = ").append(cString.getString(0)).append(", ");
}
sb.append("mountPoint = ").append(mountPoint().getUtf8String(0));
sb.append("debug = ").append(fuse_cmdline_opts.debug$get(cmdLineOpts));
sb.append("mountPoint = ").append(mountPoint().getString(0));
sb.append("debug = ").append(fuse_cmdline_opts.debug(cmdLineOpts));
sb.append("singlethreaded = ").append(!multithreaded());
return sb.toString();
}

public MemorySegment mountPoint() {
return fuse_cmdline_opts.mountpoint$get(cmdLineOpts);
return fuse_cmdline_opts.mountpoint(cmdLineOpts);
}

public boolean multithreaded() {
return fuse_cmdline_opts.singlethread$get(cmdLineOpts) == 0;
return fuse_cmdline_opts.singlethread(cmdLineOpts) == 0;
}

public int cloneFd() {
return fuse_cmdline_opts.clone_fd$get(cmdLineOpts);
return fuse_cmdline_opts.clone_fd(cmdLineOpts);
}

public int maxIdleThreads() {
return fuse_cmdline_opts.max_idle_threads$get(cmdLineOpts);
return fuse_cmdline_opts.max_idle_threads(cmdLineOpts);
}

public int maxThreads() {
return fuse_cmdline_opts.max_threads$get(cmdLineOpts);
return fuse_cmdline_opts.max_threads(cmdLineOpts);
}
}
Original file line number Diff line number Diff line change
@@ -8,118 +8,114 @@

record FuseConfigImpl(MemorySegment segment) implements FuseConfig {

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

@Override
public int setGid() {
return fuse_config.set_gid$get(segment);
return fuse_config.set_gid(segment);
}

@Override
public int gid() {
return fuse_config.gid$get(segment);
return fuse_config.gid(segment);
}

@Override
public int setUid() {
return fuse_config.set_uid$get(segment);
return fuse_config.set_uid(segment);
}

@Override
public int uid() {
return fuse_config.uid$get(segment);
return fuse_config.uid(segment);
}

@Override
public int setMode() {
return fuse_config.set_mode$get(segment);
return fuse_config.set_mode(segment);
}

@Override
public int umask() {
return fuse_config.umask$get(segment);
return fuse_config.umask(segment);
}

@Override
public double entryTimeout() {
return fuse_config.entry_timeout$get(segment);
return fuse_config.entry_timeout(segment);
}

@Override
public double negativeTimeout() {
return fuse_config.negative_timeout$get(segment);
return fuse_config.negative_timeout(segment);
}

@Override
public double attrTimeout() {
return fuse_config.attr_timeout$get(segment);
return fuse_config.attr_timeout(segment);
}

@Override
public int intr() {
return fuse_config.intr$get(segment);
return fuse_config.intr(segment);
}

@Override
public int intrSignal() {
return fuse_config.intr_signal$get(segment);
return fuse_config.intr_signal(segment);
}

@Override
public int remember() {
return fuse_config.remember$get(segment);
return fuse_config.remember(segment);
}

@Override
public int hardRemove() {
return fuse_config.hard_remove$get(segment);
return fuse_config.hard_remove(segment);
}

@Override
public int useIno() {
return fuse_config.use_ino$get(segment);
return fuse_config.use_ino(segment);
}

@Override
public int readdirIno() {
return fuse_config.readdir_ino$get(segment);
return fuse_config.readdir_ino(segment);
}

@Override
public int directIo() {
return fuse_config.direct_io$get(segment);
return fuse_config.direct_io(segment);
}

@Override
public int kernelCache() {
return fuse_config.kernel_cache$get(segment);
return fuse_config.kernel_cache(segment);
}

@Override
public int autoCache() {
return fuse_config.auto_cache$get(segment);
return fuse_config.auto_cache(segment);
}

@Override
public int acAttrTimeoutSet() {
return fuse_config.ac_attr_timeout_set$get(segment);
return fuse_config.ac_attr_timeout_set(segment);
}

@Override
public double acAttrTimeout() {
return fuse_config.ac_attr_timeout$get(segment);
return fuse_config.ac_attr_timeout(segment);
}

@Override
public int nullpathOk() {
return fuse_config.nullpath_ok$get(segment);
return fuse_config.nullpath_ok(segment);
}

@Override
public int noRofdFlush() {
return fuse_config.no_rofd_flush$get(segment);
return fuse_config.no_rofd_flush(segment);
}

}
Original file line number Diff line number Diff line change
@@ -8,93 +8,89 @@

record FuseConnInfoImpl(MemorySegment segment) implements FuseConnInfo {

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

@Override
public int protoMajor() {
return fuse_conn_info.proto_major$get(segment);
return fuse_conn_info.proto_major(segment);
}

@Override
public int protoMinor() {
return fuse_conn_info.proto_minor$get(segment);
return fuse_conn_info.proto_minor(segment);
}

@Override
public int capable() {
return fuse_conn_info.capable$get(segment);
return fuse_conn_info.capable(segment);
}

@Override
public int want() {
return fuse_conn_info.want$get(segment);
return fuse_conn_info.want(segment);
}

@Override
public void setWant(int wanted) {
fuse_conn_info.want$set(segment, wanted);
fuse_conn_info.want(segment, wanted);
}

@Override
public int maxWrite() {
return fuse_conn_info.max_write$get(segment);
return fuse_conn_info.max_write(segment);
}

@Override
public void setMaxWrite(int maxWrite) {
fuse_conn_info.max_write$set(segment, maxWrite);
fuse_conn_info.max_write(segment, maxWrite);
}

@Override
public int maxRead() {
return fuse_conn_info.max_read$get(segment);
return fuse_conn_info.max_read(segment);
}

@Override
public void setMaxRead(int maxRead) {
fuse_conn_info.max_read$set(segment, maxRead);
fuse_conn_info.max_read(segment, maxRead);
}

@Override
public int maxReadahead() {
return fuse_conn_info.max_readahead$get(segment);
return fuse_conn_info.max_readahead(segment);
}

@Override
public void setMaxReadahead(int maxReadahead) {
fuse_conn_info.max_readahead$set(segment, maxReadahead);
fuse_conn_info.max_readahead(segment, maxReadahead);
}

@Override
public int maxBackground() {
return fuse_conn_info.max_background$get(segment);
return fuse_conn_info.max_background(segment);
}

@Override
public void setMaxBackground(int maxBackground) {
fuse_conn_info.max_background$set(segment, maxBackground);
fuse_conn_info.max_background(segment, maxBackground);
}

@Override
public int congestionThreshold() {
return fuse_conn_info.congestion_threshold$get(segment);
return fuse_conn_info.congestion_threshold(segment);
}

@Override
public void setCongestionThreshold(int congestionThreshold) {
fuse_conn_info.congestion_threshold$set(segment, congestionThreshold);
fuse_conn_info.congestion_threshold(segment, congestionThreshold);
}

@Override
public int timeGran() {
return fuse_conn_info.time_gran$get(segment);
return fuse_conn_info.time_gran(segment);
}

@Override
public void setTimeGran(int timeGran) {
fuse_conn_info.time_gran$set(segment, timeGran);
fuse_conn_info.time_gran(segment, timeGran);
}

}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -22,8 +22,8 @@ public int loop() {
// FUSE 3.2
try (var arena = Arena.ofConfined()) {
var loopCfg = fuse_loop_config_v1.allocate(arena);
fuse_loop_config_v1.clone_fd$set(loopCfg, fuseArgs.cloneFd());
fuse_loop_config_v1.max_idle_threads$set(loopCfg, fuseArgs.maxIdleThreads());
fuse_loop_config_v1.clone_fd(loopCfg, fuseArgs.cloneFd());
fuse_loop_config_v1.max_idle_threads(loopCfg, fuseArgs.maxIdleThreads());
return fuse_h.fuse_loop_mt(fuse, loopCfg);
}
} else {
Original file line number Diff line number Diff line change
@@ -9,79 +9,74 @@
import java.lang.foreign.MemorySegment;

record StatImpl(MemorySegment segment) implements Stat {

public StatImpl(MemorySegment address, Arena scope) {
this(stat.ofAddress(address, scope));
}

@Override
public TimeSpec aTime() {
return new TimeSpecImpl(stat.st_atim$slice(segment));
return new TimeSpecImpl(stat.st_atim(segment));
}

@Override
public TimeSpec cTime() {
return new TimeSpecImpl(stat.st_ctim$slice(segment));
return new TimeSpecImpl(stat.st_ctim(segment));
}

@Override
public TimeSpec mTime() {
return new TimeSpecImpl(stat.st_mtim$slice(segment));
return new TimeSpecImpl(stat.st_mtim(segment));
}

@Override
public TimeSpec birthTime() {
return new TimeSpecImpl(stat.st_ctim$slice(segment));
return new TimeSpecImpl(stat.st_ctim(segment));
}

@Override
public void setMode(int mode) {
stat.st_mode$set(segment, mode);
stat.st_mode(segment, mode);
}

@Override
public int getMode() {
return stat.st_mode$get(segment);
return stat.st_mode(segment);
}

@Override
public void setUid(int uid) {
stat.st_uid$set(segment, uid);
stat.st_uid(segment, uid);
}

@Override
public int getUid() {
return stat.st_uid$get(segment);
return stat.st_uid(segment);
}

@Override
public void setGid(int gid) {
stat.st_gid$set(segment, gid);
stat.st_gid(segment, gid);
}

@Override
public int getGid() {
return stat.st_gid$get(segment);
return stat.st_gid(segment);
}

@Override
public void setNLink(short count) {
stat.st_nlink$set(segment, count);
stat.st_nlink(segment, count);
}

@Override
public long getNLink() {
return stat.st_nlink$get(segment);
return stat.st_nlink(segment);
}

@Override
public void setSize(long size) {
stat.st_size$set(segment, size);
stat.st_size(segment, size);
}

@Override
public long getSize() {
return stat.st_size$get(segment);
return stat.st_size(segment);
}

}
Original file line number Diff line number Diff line change
@@ -8,68 +8,64 @@

record StatvfsImpl(MemorySegment segment) implements Statvfs {

public StatvfsImpl(MemorySegment address, Arena scope) {
this(statvfs.ofAddress(address, scope));
}

@Override
public long getBsize() {
return statvfs.f_bsize$get(segment);
return statvfs.f_bsize(segment);
}

@Override
public void setBsize(long bsize) {
statvfs.f_bsize$set(segment, bsize);
statvfs.f_bsize(segment, bsize);
}

@Override
public long getFrsize() {
return statvfs.f_frsize$get(segment);
return statvfs.f_frsize(segment);
}

@Override
public void setFrsize(long frsize) {
statvfs.f_frsize$set(segment, frsize);
statvfs.f_frsize(segment, frsize);
}

@Override
public long getBlocks() {
return statvfs.f_blocks$get(segment);
return statvfs.f_blocks(segment);
}

@Override
public void setBlocks(long blocks) {
statvfs.f_blocks$set(segment, blocks);
statvfs.f_blocks(segment, blocks);
}

@Override
public long getBfree() {
return statvfs.f_bfree$get(segment);
return statvfs.f_bfree(segment);
}

@Override
public void setBfree(long bfree) {
statvfs.f_bfree$set(segment, bfree);
statvfs.f_bfree(segment, bfree);
}

@Override
public long getBavail() {
return statvfs.f_bavail$get(segment);
return statvfs.f_bavail(segment);
}

@Override
public void setBavail(long bavail) {
statvfs.f_bavail$set(segment, bavail);
statvfs.f_bavail(segment, bavail);
}

@Override
public long getNameMax() {
return statvfs.f_namemax$get(segment);
return statvfs.f_namemax(segment);
}

@Override
public void setNameMax(long namemax) {
statvfs.f_namemax$set(segment, namemax);
statvfs.f_namemax(segment, namemax);
}

}
Original file line number Diff line number Diff line change
@@ -11,26 +11,26 @@ record TimeSpecImpl(MemorySegment segment) implements TimeSpec {

@Override
public boolean isUtimeOmit() {
var nanos = timespec.tv_nsec$get(segment);
var nanos = timespec.tv_nsec(segment);
return stat_h.UTIME_OMIT() == nanos;
}

@Override
public boolean isUtimeNow() {
var nanos = timespec.tv_nsec$get(segment);
var nanos = timespec.tv_nsec(segment);
return stat_h.UTIME_NOW() == nanos;
}

@Override
public void set(Instant newValue) {
timespec.tv_sec$set(segment, newValue.getEpochSecond());
timespec.tv_nsec$set(segment, newValue.getNano());
timespec.tv_sec(segment, newValue.getEpochSecond());
timespec.tv_nsec(segment, newValue.getNano());
}

@Override
public Instant get() {
var seconds = timespec.tv_sec$get(segment);
var nanos = timespec.tv_nsec$get(segment);
var seconds = timespec.tv_sec(segment);
var nanos = timespec.tv_nsec(segment);
return Instant.ofEpochSecond(seconds, nanos);
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -2,165 +2,233 @@

package org.cryptomator.jfuse.linux.aarch64.extr.errno;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.VarHandle;
import java.nio.ByteOrder;
import java.lang.invoke.*;
import java.lang.foreign.*;
import java.nio.ByteOrder;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

import static java.lang.foreign.ValueLayout.*;
public class errno_h {
import static java.lang.foreign.MemoryLayout.PathElement.*;

public class errno_h {

errno_h() {
// Should not be called directly
}

static final Arena LIBRARY_ARENA = Arena.ofAuto();
static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls");

static void traceDowncall(String name, Object... args) {
String traceArgs = Arrays.stream(args)
.map(Object::toString)
.collect(Collectors.joining(", "));
System.out.printf("%s(%s)\n", name, traceArgs);
}

public static final OfByte C_CHAR = JAVA_BYTE;
public static final OfShort C_SHORT = JAVA_SHORT;
public static final OfInt C_INT = JAVA_INT;
public static final OfLong C_LONG = JAVA_LONG;
public static final OfLong C_LONG_LONG = JAVA_LONG;
public static final OfFloat C_FLOAT = JAVA_FLOAT;
public static final OfDouble C_DOUBLE = JAVA_DOUBLE;
public static final AddressLayout C_POINTER = RuntimeHelper.POINTER;
/**
* {@snippet :
static MemorySegment findOrThrow(String symbol) {
return SYMBOL_LOOKUP.find(symbol)
.orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol));
}

static MethodHandle upcallHandle(Class<?> fi, String name, FunctionDescriptor fdesc) {
try {
return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType());
} catch (ReflectiveOperationException ex) {
throw new AssertionError(ex);
}
}

static MemoryLayout align(MemoryLayout layout, long align) {
return switch (layout) {
case PaddingLayout p -> p;
case ValueLayout v -> v.withByteAlignment(align);
case GroupLayout g -> {
MemoryLayout[] alignedMembers = g.memberLayouts().stream()
.map(m -> align(m, align)).toArray(MemoryLayout[]::new);
yield g instanceof StructLayout ?
MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers);
}
case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align));
};
}

static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup()
.or(Linker.nativeLinker().defaultLookup());

public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN;
public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE;
public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT;
public static final ValueLayout.OfInt C_INT = ValueLayout.JAVA_INT;
public static final ValueLayout.OfLong C_LONG_LONG = ValueLayout.JAVA_LONG;
public static final ValueLayout.OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT;
public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE;
public static final AddressLayout C_POINTER = ValueLayout.ADDRESS
.withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, JAVA_BYTE));
public static final ValueLayout.OfLong C_LONG = ValueLayout.JAVA_LONG;
private static final int ENOENT = (int)2L;
/**
* {@snippet lang=c :
* #define ENOENT 2
* }
*/
public static int ENOENT() {
return (int)2L;
return ENOENT;
}
private static final int EIO = (int)5L;
/**
* {@snippet :
* {@snippet lang=c :
* #define EIO 5
* }
*/
public static int EIO() {
return (int)5L;
return EIO;
}
private static final int E2BIG = (int)7L;
/**
* {@snippet :
* {@snippet lang=c :
* #define E2BIG 7
* }
*/
public static int E2BIG() {
return (int)7L;
return E2BIG;
}
private static final int EBADF = (int)9L;
/**
* {@snippet :
* {@snippet lang=c :
* #define EBADF 9
* }
*/
public static int EBADF() {
return (int)9L;
return EBADF;
}
private static final int ENOMEM = (int)12L;
/**
* {@snippet :
* {@snippet lang=c :
* #define ENOMEM 12
* }
*/
public static int ENOMEM() {
return (int)12L;
return ENOMEM;
}
private static final int EACCES = (int)13L;
/**
* {@snippet :
* {@snippet lang=c :
* #define EACCES 13
* }
*/
public static int EACCES() {
return (int)13L;
return EACCES;
}
private static final int EEXIST = (int)17L;
/**
* {@snippet :
* {@snippet lang=c :
* #define EEXIST 17
* }
*/
public static int EEXIST() {
return (int)17L;
return EEXIST;
}
private static final int ENOTDIR = (int)20L;
/**
* {@snippet :
* {@snippet lang=c :
* #define ENOTDIR 20
* }
*/
public static int ENOTDIR() {
return (int)20L;
return ENOTDIR;
}
private static final int EISDIR = (int)21L;
/**
* {@snippet :
* {@snippet lang=c :
* #define EISDIR 21
* }
*/
public static int EISDIR() {
return (int)21L;
return EISDIR;
}
private static final int EINVAL = (int)22L;
/**
* {@snippet :
* {@snippet lang=c :
* #define EINVAL 22
* }
*/
public static int EINVAL() {
return (int)22L;
return EINVAL;
}
private static final int EROFS = (int)30L;
/**
* {@snippet :
* {@snippet lang=c :
* #define EROFS 30
* }
*/
public static int EROFS() {
return (int)30L;
return EROFS;
}
private static final int ERANGE = (int)34L;
/**
* {@snippet :
* {@snippet lang=c :
* #define ERANGE 34
* }
*/
public static int ERANGE() {
return (int)34L;
return ERANGE;
}
private static final int ENAMETOOLONG = (int)36L;
/**
* {@snippet :
* {@snippet lang=c :
* #define ENAMETOOLONG 36
* }
*/
public static int ENAMETOOLONG() {
return (int)36L;
return ENAMETOOLONG;
}
private static final int ENOLCK = (int)37L;
/**
* {@snippet :
* {@snippet lang=c :
* #define ENOLCK 37
* }
*/
public static int ENOLCK() {
return (int)37L;
return ENOLCK;
}
private static final int ENOSYS = (int)38L;
/**
* {@snippet :
* {@snippet lang=c :
* #define ENOSYS 38
* }
*/
public static int ENOSYS() {
return (int)38L;
return ENOSYS;
}
private static final int ENOTEMPTY = (int)39L;
/**
* {@snippet :
* {@snippet lang=c :
* #define ENOTEMPTY 39
* }
*/
public static int ENOTEMPTY() {
return (int)39L;
return ENOTEMPTY;
}
private static final int ENODATA = (int)61L;
/**
* {@snippet :
* {@snippet lang=c :
* #define ENODATA 61
* }
*/
public static int ENODATA() {
return (int)61L;
return ENODATA;
}
private static final int ENOTSUP = (int)95L;
/**
* {@snippet :
* {@snippet lang=c :
* #define ENOTSUP 95
* }
*/
public static int ENOTSUP() {
return (int)95L;
return ENOTSUP;
}
}


This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -2,93 +2,152 @@

package org.cryptomator.jfuse.linux.aarch64.extr.fcntl;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.VarHandle;
import java.nio.ByteOrder;
import java.lang.invoke.*;
import java.lang.foreign.*;
import java.nio.ByteOrder;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

import static java.lang.foreign.ValueLayout.*;
public class fcntl_h {
import static java.lang.foreign.MemoryLayout.PathElement.*;

public class fcntl_h {

fcntl_h() {
// Should not be called directly
}

static final Arena LIBRARY_ARENA = Arena.ofAuto();
static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls");

static void traceDowncall(String name, Object... args) {
String traceArgs = Arrays.stream(args)
.map(Object::toString)
.collect(Collectors.joining(", "));
System.out.printf("%s(%s)\n", name, traceArgs);
}

public static final OfByte C_CHAR = JAVA_BYTE;
public static final OfShort C_SHORT = JAVA_SHORT;
public static final OfInt C_INT = JAVA_INT;
public static final OfLong C_LONG = JAVA_LONG;
public static final OfLong C_LONG_LONG = JAVA_LONG;
public static final OfFloat C_FLOAT = JAVA_FLOAT;
public static final OfDouble C_DOUBLE = JAVA_DOUBLE;
public static final AddressLayout C_POINTER = RuntimeHelper.POINTER;
static MemorySegment findOrThrow(String symbol) {
return SYMBOL_LOOKUP.find(symbol)
.orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol));
}

static MethodHandle upcallHandle(Class<?> fi, String name, FunctionDescriptor fdesc) {
try {
return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType());
} catch (ReflectiveOperationException ex) {
throw new AssertionError(ex);
}
}

static MemoryLayout align(MemoryLayout layout, long align) {
return switch (layout) {
case PaddingLayout p -> p;
case ValueLayout v -> v.withByteAlignment(align);
case GroupLayout g -> {
MemoryLayout[] alignedMembers = g.memberLayouts().stream()
.map(m -> align(m, align)).toArray(MemoryLayout[]::new);
yield g instanceof StructLayout ?
MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers);
}
case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align));
};
}

static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup()
.or(Linker.nativeLinker().defaultLookup());

public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN;
public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE;
public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT;
public static final ValueLayout.OfInt C_INT = ValueLayout.JAVA_INT;
public static final ValueLayout.OfLong C_LONG_LONG = ValueLayout.JAVA_LONG;
public static final ValueLayout.OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT;
public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE;
public static final AddressLayout C_POINTER = ValueLayout.ADDRESS
.withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, JAVA_BYTE));
public static final ValueLayout.OfLong C_LONG = ValueLayout.JAVA_LONG;
private static final int O_RDONLY = (int)0L;
/**
* {@snippet :
* {@snippet lang=c :
* #define O_RDONLY 0
* }
*/
public static int O_RDONLY() {
return (int)0L;
return O_RDONLY;
}
private static final int O_WRONLY = (int)1L;
/**
* {@snippet :
* {@snippet lang=c :
* #define O_WRONLY 1
* }
*/
public static int O_WRONLY() {
return (int)1L;
return O_WRONLY;
}
private static final int O_RDWR = (int)2L;
/**
* {@snippet :
* {@snippet lang=c :
* #define O_RDWR 2
* }
*/
public static int O_RDWR() {
return (int)2L;
return O_RDWR;
}
private static final int O_CREAT = (int)64L;
/**
* {@snippet :
* {@snippet lang=c :
* #define O_CREAT 64
* }
*/
public static int O_CREAT() {
return (int)64L;
return O_CREAT;
}
private static final int O_EXCL = (int)128L;
/**
* {@snippet :
* {@snippet lang=c :
* #define O_EXCL 128
* }
*/
public static int O_EXCL() {
return (int)128L;
return O_EXCL;
}
private static final int O_TRUNC = (int)512L;
/**
* {@snippet :
* {@snippet lang=c :
* #define O_TRUNC 512
* }
*/
public static int O_TRUNC() {
return (int)512L;
return O_TRUNC;
}
private static final int O_APPEND = (int)1024L;
/**
* {@snippet :
* {@snippet lang=c :
* #define O_APPEND 1024
* }
*/
public static int O_APPEND() {
return (int)1024L;
return O_APPEND;
}
private static final int O_SYNC = (int)1052672L;
/**
* {@snippet :
* {@snippet lang=c :
* #define O_SYNC 1052672
* }
*/
public static int O_SYNC() {
return (int)1052672L;
return O_SYNC;
}
private static final int O_DSYNC = (int)4096L;
/**
* {@snippet :
* {@snippet lang=c :
* #define O_DSYNC 4096
* }
*/
public static int O_DSYNC() {
return (int)4096L;
return O_DSYNC;
}
}


This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8e5a31d

Please sign in to comment.