From e19dfe8e97f762898a36aef0f4313c681207d24a Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 21 Sep 2022 17:01:45 +0200 Subject: [PATCH 01/41] WinFuseBuilder supports ARM64 as well --- .../cryptomator/jfuse/win/amd64/WinFuseBuilder.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/WinFuseBuilder.java b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/WinFuseBuilder.java index 2b6ea164..9ba16a71 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/WinFuseBuilder.java +++ b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/WinFuseBuilder.java @@ -9,9 +9,11 @@ import org.cryptomator.jfuse.api.SupportedPlatform; @SupportedPlatform(os = OperatingSystem.WINDOWS, arch = Architecture.AMD64) +@SupportedPlatform(os = OperatingSystem.WINDOWS, arch = Architecture.ARM64) public class WinFuseBuilder implements FuseBuilder { - private static final String DEFAULT_LIB_PATH = "C:\\Program Files (x86)\\WinFsp\\bin\\winfsp-x64.dll"; + private static final String DEFAULT_LIB_PATH_AMD64 = "C:\\Program Files (x86)\\WinFsp\\bin\\winfsp-x64.dll"; + private static final String DEFAULT_LIB_PATH_ARM64 = "C:\\Program Files (x86)\\WinFsp\\bin\\winfsp-a64.dll"; private static final Errno ERRNO = new WinErrno(); private String libraryPath; @@ -29,8 +31,10 @@ public void setLibraryPath(String libraryPath) { public Fuse build(FuseOperations fuseOperations) throws UnsatisfiedLinkError { if (libraryPath != null) { System.load(libraryPath); - } else { - System.load(DEFAULT_LIB_PATH); + } else if (Architecture.CURRENT == Architecture.AMD64) { + System.load(DEFAULT_LIB_PATH_AMD64); + } else if (Architecture.CURRENT == Architecture.ARM64) { + System.load(DEFAULT_LIB_PATH_ARM64); } return new FuseImpl(fuseOperations); } From 0341f2d52512711fc2baf93e2de950e396bfd0e1 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 21 Sep 2022 17:14:12 +0200 Subject: [PATCH 02/41] renamed `jfuse-win-amd64` to `jfuse-win` --- .github/workflows/build.yml | 16 ++++++++-------- .github/workflows/publish-central.yml | 2 +- .github/workflows/publish-github.yml | 2 +- README.md | 8 ++++---- jfuse-examples/pom.xml | 6 ++---- jfuse-tests/pom.xml | 6 ++---- jfuse-win-amd64/src/main/java/module-info.java | 11 ----------- .../org.cryptomator.jfuse.api.FuseBuilder | 1 - {jfuse-win-amd64 => jfuse-win}/README.md | 0 {jfuse-win-amd64 => jfuse-win}/pom.xml | 14 +++++++------- jfuse-win/src/main/java/module-info.java | 10 ++++++++++ .../cryptomator/jfuse/win}/DirFillerImpl.java | 8 +++----- .../cryptomator/jfuse/win}/FileInfoImpl.java | 6 +++--- .../org/cryptomator/jfuse/win}/FuseArgs.java | 4 ++-- .../jfuse/win}/FuseConnInfoImpl.java | 4 ++-- .../org/cryptomator/jfuse/win}/FuseImpl.java | 12 ++++++------ .../cryptomator/jfuse/win}/FuseMountImpl.java | 4 ++-- .../org/cryptomator/jfuse/win}/StatImpl.java | 4 ++-- .../org/cryptomator/jfuse/win}/StatvfsImpl.java | 4 ++-- .../cryptomator/jfuse/win}/TimeSpecImpl.java | 4 ++-- .../org/cryptomator/jfuse/win}/WinErrno.java | 4 ++-- .../cryptomator/jfuse/win}/WinFuseBuilder.java | 2 +- .../jfuse/win}/extr/Constants$root.java | 2 +- .../jfuse/win}/extr/RuntimeHelper.java | 11 ++--------- .../jfuse/win}/extr/constants$0.java | 6 ++---- .../jfuse/win}/extr/constants$1.java | 6 ++---- .../cryptomator/jfuse/win}/extr/errno_h.java | 6 +----- .../cryptomator/jfuse/win}/extr/fcntl_h.java | 6 +----- .../jfuse/win}/extr/fuse2/Constants$root.java | 2 +- .../jfuse/win}/extr/fuse2/RuntimeHelper.java | 11 ++--------- .../jfuse/win}/extr/fuse2/constants$0.java | 6 ++---- .../jfuse/win}/extr/fuse2/fuse2_h.java | 4 +--- .../jfuse/win}/extr/fuse2/fuse_args.java | 6 ++---- .../jfuse/win}/extr/fuse3_conn_info.java | 6 ++---- .../jfuse/win}/extr/fuse3_file_info.java | 6 ++---- .../jfuse/win}/extr/fuse3_fill_dir_t.java | 7 ++----- .../jfuse/win}/extr/fuse3_operations.java | 5 ++--- .../org/cryptomator/jfuse/win}/extr/fuse_h.java | 4 +--- .../cryptomator/jfuse/win}/extr/fuse_stat.java | 6 ++---- .../jfuse/win}/extr/fuse_statvfs.java | 6 ++---- .../jfuse/win}/extr/fuse_timespec.java | 6 ++---- .../org.cryptomator.jfuse.api.FuseBuilder | 1 + .../jfuse/win}/FileInfoImplTest.java | 7 ++++--- .../jfuse/win}/FuseConnInfoImplTest.java | 5 +++-- .../cryptomator/jfuse/win}/FuseImplTest.java | 17 ++++++++++------- .../jfuse/win}/TimeSpecImplTest.java | 5 +++-- .../cryptomator/jfuse/win}/WinErrnoTest.java | 3 ++- pom.xml | 5 ++--- 48 files changed, 119 insertions(+), 168 deletions(-) delete mode 100644 jfuse-win-amd64/src/main/java/module-info.java delete mode 100644 jfuse-win-amd64/src/main/resources/META-INF/services/org.cryptomator.jfuse.api.FuseBuilder rename {jfuse-win-amd64 => jfuse-win}/README.md (100%) rename {jfuse-win-amd64 => jfuse-win}/pom.xml (94%) create mode 100644 jfuse-win/src/main/java/module-info.java rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/DirFillerImpl.java (76%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/FileInfoImpl.java (93%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/FuseArgs.java (87%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/FuseConnInfoImpl.java (95%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/FuseImpl.java (97%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/FuseMountImpl.java (84%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/StatImpl.java (93%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/StatvfsImpl.java (93%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/TimeSpecImpl.java (88%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/WinErrno.java (90%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/WinFuseBuilder.java (97%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/Constants$root.java (95%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/RuntimeHelper.java (97%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/constants$0.java (92%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/constants$1.java (91%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/errno_h.java (89%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fcntl_h.java (86%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse2/Constants$root.java (94%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse2/RuntimeHelper.java (97%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse2/constants$0.java (77%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse2/fuse2_h.java (92%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse2/fuse_args.java (95%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse3_conn_info.java (98%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse3_file_info.java (96%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse3_fill_dir_t.java (85%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse3_operations.java (99%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse_h.java (97%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse_stat.java (98%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse_statvfs.java (98%) rename {jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/main/java/org/cryptomator/jfuse/win}/extr/fuse_timespec.java (93%) create mode 100644 jfuse-win/src/main/resources/META-INF/services/org.cryptomator.jfuse.api.FuseBuilder rename {jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/test/java/org/cryptomator/jfuse/win}/FileInfoImplTest.java (91%) rename {jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/test/java/org/cryptomator/jfuse/win}/FuseConnInfoImplTest.java (96%) rename {jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/test/java/org/cryptomator/jfuse/win}/FuseImplTest.java (95%) rename {jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/test/java/org/cryptomator/jfuse/win}/TimeSpecImplTest.java (92%) rename {jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64 => jfuse-win/src/test/java/org/cryptomator/jfuse/win}/WinErrnoTest.java (90%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1544709f..8e06d2a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,8 +48,8 @@ jobs: path: jfuse-tests/target/site/jacoco-aggregate/jacoco.xml retention-days: 3 - win-amd64: - name: Test jfuse-win-amd64 + win: + name: Test jfuse-win runs-on: windows-latest if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" steps: @@ -62,16 +62,16 @@ jobs: - name: Setup fuse run: choco install winfsp --version 1.10.22006 -y - name: Maven build - run: mvn -B verify -Pwin-amd64 + run: mvn -B verify -Pwin - uses: actions/upload-artifact@v2 with: - name: coverage-win-amd64 + name: coverage-win path: jfuse-tests/target/site/jacoco-aggregate/jacoco.xml retention-days: 3 sonarcloud: name: Run SonarCloud Analysis - needs: [linux-amd64, mac, win-amd64] + needs: [linux-amd64, mac, win] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -98,13 +98,13 @@ jobs: path: coverage/mac - uses: actions/download-artifact@v2 with: - name: coverage-win-amd64 - path: coverage/win-amd64 + name: coverage-win + path: coverage/win - name: Analyze run: > mvn -B compile -DskipTests org.sonarsource.scanner.maven:sonar-maven-plugin:sonar - -Plinux-amd64,linux-aarch64,mac,win-amd64 + -Plinux-amd64,linux-aarch64,mac,win -Dsonar.projectKey=cryptomator_jfuse -Dsonar.coverage.jacoco.xmlReportPaths=${GITHUB_WORKSPACE}/coverage/**/jacoco.xml -Dsonar.organization=cryptomator diff --git a/.github/workflows/publish-central.yml b/.github/workflows/publish-central.yml index 23fc7808..006c5258 100644 --- a/.github/workflows/publish-central.yml +++ b/.github/workflows/publish-central.yml @@ -26,7 +26,7 @@ jobs: - name: Enforce project version ${{ github.event.inputs.tag }} run: mvn versions:set -B -DnewVersion=${{ github.event.inputs.tag }} - name: Deploy - run: mvn deploy -B -DskipTests -Psign,deploy-central,linux-amd64,linux-aarch64,mac,win-amd64 --no-transfer-progress + run: mvn deploy -B -DskipTests -Psign,deploy-central,linux-amd64,linux-aarch64,mac,win --no-transfer-progress env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} diff --git a/.github/workflows/publish-github.yml b/.github/workflows/publish-github.yml index 55fc586c..2ada729a 100644 --- a/.github/workflows/publish-github.yml +++ b/.github/workflows/publish-github.yml @@ -18,7 +18,7 @@ jobs: - name: Enforce project version ${{ github.event.release.tag_name }} run: mvn versions:set -B -DnewVersion=${{ github.event.release.tag_name }} - name: Deploy - run: mvn deploy -B -DskipTests -Psign,deploy-github,linux-amd64,linux-aarch64,mac,win-amd64 --no-transfer-progress + run: mvn deploy -B -DskipTests -Psign,deploy-github,linux-amd64,linux-aarch64,mac,win --no-transfer-progress env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }} diff --git a/README.md b/README.md index 8ac882a3..2405876e 100644 --- a/README.md +++ b/README.md @@ -92,10 +92,10 @@ java -p path/to/mods \ Due to slight differences in memory layout, each platform needs its own implementation. Currently, the following operating systems and architectures are supported: -| | Linux | Mac (macFUSE) | Windows (WinFSP) | -|--------|--------------------------------------------|--------------------------|--------------------------------------| -| x86_64 | [jfuse-linux-amd64](jfuse-linux-amd64) | [jfuse-mac](jfuse-mac) | [jfuse-win-amd64](jfuse-win-amd64) | -| arm64 | [jfuse-linux-aarch64](jfuse-linux-aarch64) | [jfuse-mac](jfuse-mac) | | +| | Linux | Mac (macFUSE) | Windows (WinFSP) | +|--------|--------------------------------------------|--------------------------|------------------------| +| x86_64 | [jfuse-linux-amd64](jfuse-linux-amd64) | [jfuse-mac](jfuse-mac) | [jfuse-win](jfuse-win) | +| arm64 | [jfuse-linux-aarch64](jfuse-linux-aarch64) | [jfuse-mac](jfuse-mac) | [jfuse-win](jfuse-win) | ## Building diff --git a/jfuse-examples/pom.xml b/jfuse-examples/pom.xml index 8da63546..fdc5c86f 100644 --- a/jfuse-examples/pom.xml +++ b/jfuse-examples/pom.xml @@ -34,7 +34,6 @@ mac - x86_64 @@ -83,17 +82,16 @@ - win-amd64 + win windows - amd64 org.cryptomator - jfuse-win-amd64 + jfuse-win ${project.version} diff --git a/jfuse-tests/pom.xml b/jfuse-tests/pom.xml index 78c3ab9c..2a5eda9f 100644 --- a/jfuse-tests/pom.xml +++ b/jfuse-tests/pom.xml @@ -126,7 +126,6 @@ mac - x86_64 @@ -178,17 +177,16 @@ - win-amd64 + win windows - amd64 org.cryptomator - jfuse-win-amd64 + jfuse-win ${project.version} diff --git a/jfuse-win-amd64/src/main/java/module-info.java b/jfuse-win-amd64/src/main/java/module-info.java deleted file mode 100644 index 0067f1cd..00000000 --- a/jfuse-win-amd64/src/main/java/module-info.java +++ /dev/null @@ -1,11 +0,0 @@ -import org.cryptomator.jfuse.api.FuseBuilder; -import org.cryptomator.jfuse.win.amd64.WinFuseBuilder; - -@SuppressWarnings("JavaModuleNaming") // 64 is not a "version", see https://bugs.openjdk.java.net/browse/JDK-8264488 -module org.cryptomator.jfuse.win.amd64 { - requires static org.jetbrains.annotations; - - requires org.cryptomator.jfuse.api; - - provides FuseBuilder with WinFuseBuilder; -} \ No newline at end of file diff --git a/jfuse-win-amd64/src/main/resources/META-INF/services/org.cryptomator.jfuse.api.FuseBuilder b/jfuse-win-amd64/src/main/resources/META-INF/services/org.cryptomator.jfuse.api.FuseBuilder deleted file mode 100644 index d91dc54b..00000000 --- a/jfuse-win-amd64/src/main/resources/META-INF/services/org.cryptomator.jfuse.api.FuseBuilder +++ /dev/null @@ -1 +0,0 @@ -org.cryptomator.jfuse.win.amd64.WinFuseBuilder \ No newline at end of file diff --git a/jfuse-win-amd64/README.md b/jfuse-win/README.md similarity index 100% rename from jfuse-win-amd64/README.md rename to jfuse-win/README.md diff --git a/jfuse-win-amd64/pom.xml b/jfuse-win/pom.xml similarity index 94% rename from jfuse-win-amd64/pom.xml rename to jfuse-win/pom.xml index 3cd9b02a..b18bdbc1 100644 --- a/jfuse-win-amd64/pom.xml +++ b/jfuse-win/pom.xml @@ -8,10 +8,10 @@ 0.3.0-SNAPSHOT 4.0.0 - jfuse-win-amd64 - jFUSE Windows x86_64 - Java FUSE bindings for Windows x86_64 - https://github.com/cryptomator/jfuse/tree/develop/jfuse-win-amd64 + jfuse-win + jFUSE Windows + Java FUSE bindings for Windows x86_64 and arm64 + https://github.com/cryptomator/jfuse/tree/develop/jfuse-win C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt @@ -61,7 +61,7 @@ - ${project.build.sourceDirectory}/org/cryptomator/jfuse/win/amd64/extr + ${project.build.sourceDirectory}/org/cryptomator/jfuse/win/extr *.java @@ -79,7 +79,7 @@ C:\Users\Arbeit\Programs\jextract-19\bin\jextract.bat ${win.ucrtHeaderPath} ${project.build.sourceDirectory} - org.cryptomator.jfuse.win.amd64.extr + org.cryptomator.jfuse.win.extr @@ -125,7 +125,7 @@ sources - org.cryptomator.jfuse.win.amd64.extr.fuse2 + org.cryptomator.jfuse.win.extr.fuse2 ${project.parent.basedir}/winfsp/inc/fuse/fuse_common.h fuse2_h diff --git a/jfuse-win/src/main/java/module-info.java b/jfuse-win/src/main/java/module-info.java new file mode 100644 index 00000000..41282e04 --- /dev/null +++ b/jfuse-win/src/main/java/module-info.java @@ -0,0 +1,10 @@ +import org.cryptomator.jfuse.api.FuseBuilder; +import org.cryptomator.jfuse.win.WinFuseBuilder; + +module org.cryptomator.jfuse.win { + requires static org.jetbrains.annotations; + + requires org.cryptomator.jfuse.api; + + provides FuseBuilder with WinFuseBuilder; +} \ No newline at end of file diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/DirFillerImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/DirFillerImpl.java similarity index 76% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/DirFillerImpl.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/DirFillerImpl.java index 8a1fec8c..6ef37a44 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/DirFillerImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/DirFillerImpl.java @@ -1,14 +1,12 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.DirFiller; import org.cryptomator.jfuse.api.Stat; -import org.cryptomator.jfuse.win.amd64.extr.fuse3_fill_dir_t; -import org.cryptomator.jfuse.win.amd64.extr.fuse_h; -import org.cryptomator.jfuse.win.amd64.extr.fuse_stat; +import org.cryptomator.jfuse.win.extr.fuse3_fill_dir_t; +import org.cryptomator.jfuse.win.extr.fuse_stat; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySession; -import java.util.Set; import java.util.function.Consumer; record DirFillerImpl(MemoryAddress buf, fuse3_fill_dir_t callback, MemorySession scope) implements DirFiller { diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FileInfoImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FileInfoImpl.java similarity index 93% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FileInfoImpl.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/FileInfoImpl.java index b4615ee5..a7c2832d 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FileInfoImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FileInfoImpl.java @@ -1,8 +1,8 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.FileInfo; -import org.cryptomator.jfuse.win.amd64.extr.fcntl_h; -import org.cryptomator.jfuse.win.amd64.extr.fuse3_file_info; +import org.cryptomator.jfuse.win.extr.fcntl_h; +import org.cryptomator.jfuse.win.extr.fuse3_file_info; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySegment; diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseArgs.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseArgs.java similarity index 87% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseArgs.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseArgs.java index 0ee5474b..915d7f12 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseArgs.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseArgs.java @@ -1,6 +1,6 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; -import org.cryptomator.jfuse.win.amd64.extr.fuse2.fuse_args; +import org.cryptomator.jfuse.win.extr.fuse2.fuse_args; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySegment; diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseConnInfoImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseConnInfoImpl.java similarity index 95% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseConnInfoImpl.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseConnInfoImpl.java index 5bd40b83..0eb1b8e2 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseConnInfoImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseConnInfoImpl.java @@ -1,7 +1,7 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.FuseConnInfo; -import org.cryptomator.jfuse.win.amd64.extr.fuse3_conn_info; +import org.cryptomator.jfuse.win.extr.fuse3_conn_info; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySegment; diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseImpl.java similarity index 97% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseImpl.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseImpl.java index f84a891b..ab9e3d78 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseImpl.java @@ -1,15 +1,15 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.Fuse; import org.cryptomator.jfuse.api.FuseConnInfo; import org.cryptomator.jfuse.api.FuseMount; import org.cryptomator.jfuse.api.FuseOperations; import org.cryptomator.jfuse.api.MountFailedException; -import org.cryptomator.jfuse.win.amd64.extr.fuse2.fuse2_h; -import org.cryptomator.jfuse.win.amd64.extr.fuse2.fuse_args; -import org.cryptomator.jfuse.win.amd64.extr.fuse3_operations; -import org.cryptomator.jfuse.win.amd64.extr.fuse_h; -import org.cryptomator.jfuse.win.amd64.extr.fuse_timespec; +import org.cryptomator.jfuse.win.extr.fuse2.fuse2_h; +import org.cryptomator.jfuse.win.extr.fuse2.fuse_args; +import org.cryptomator.jfuse.win.extr.fuse3_operations; +import org.cryptomator.jfuse.win.extr.fuse_h; +import org.cryptomator.jfuse.win.extr.fuse_timespec; import org.jetbrains.annotations.VisibleForTesting; import java.io.IOException; diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseMountImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseMountImpl.java similarity index 84% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseMountImpl.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseMountImpl.java index 755adefd..e65e3377 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseMountImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseMountImpl.java @@ -1,7 +1,7 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.FuseMount; -import org.cryptomator.jfuse.win.amd64.extr.fuse_h; +import org.cryptomator.jfuse.win.extr.fuse_h; import java.lang.foreign.MemoryAddress; diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/StatImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/StatImpl.java similarity index 93% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/StatImpl.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/StatImpl.java index a120555d..38221522 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/StatImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/StatImpl.java @@ -1,8 +1,8 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.Stat; import org.cryptomator.jfuse.api.TimeSpec; -import org.cryptomator.jfuse.win.amd64.extr.fuse_stat; +import org.cryptomator.jfuse.win.extr.fuse_stat; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySegment; diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/StatvfsImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/StatvfsImpl.java similarity index 93% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/StatvfsImpl.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/StatvfsImpl.java index 6f5f5d2b..c7c09928 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/StatvfsImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/StatvfsImpl.java @@ -1,7 +1,7 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.Statvfs; -import org.cryptomator.jfuse.win.amd64.extr.fuse_statvfs; +import org.cryptomator.jfuse.win.extr.fuse_statvfs; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySegment; diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/TimeSpecImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/TimeSpecImpl.java similarity index 88% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/TimeSpecImpl.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/TimeSpecImpl.java index 7ab2da26..99d16e57 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/TimeSpecImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/TimeSpecImpl.java @@ -1,7 +1,7 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.TimeSpec; -import org.cryptomator.jfuse.win.amd64.extr.fuse_timespec; +import org.cryptomator.jfuse.win.extr.fuse_timespec; import java.lang.foreign.MemorySegment; import java.time.Instant; diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/WinErrno.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/WinErrno.java similarity index 90% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/WinErrno.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/WinErrno.java index 8c3a8479..10fc63f3 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/WinErrno.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/WinErrno.java @@ -1,7 +1,7 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.Errno; -import org.cryptomator.jfuse.win.amd64.extr.errno_h; +import org.cryptomator.jfuse.win.extr.errno_h; public record WinErrno() implements Errno { diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/WinFuseBuilder.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/WinFuseBuilder.java similarity index 97% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/WinFuseBuilder.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/WinFuseBuilder.java index 9ba16a71..3acd2830 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/WinFuseBuilder.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/WinFuseBuilder.java @@ -1,4 +1,4 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.Architecture; import org.cryptomator.jfuse.api.Errno; diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/Constants$root.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/Constants$root.java similarity index 95% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/Constants$root.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/Constants$root.java index 22aaae17..dcd55543 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/Constants$root.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/Constants$root.java @@ -1,6 +1,6 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; import java.lang.invoke.MethodHandle; import java.lang.invoke.VarHandle; diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/RuntimeHelper.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/RuntimeHelper.java similarity index 97% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/RuntimeHelper.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/RuntimeHelper.java index 66c9aa05..767bd78a 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/RuntimeHelper.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/RuntimeHelper.java @@ -1,4 +1,4 @@ -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; // Generated by jextract import java.lang.foreign.Addressable; @@ -15,14 +15,7 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; -import java.io.File; -import java.nio.file.Path; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.Optional; -import java.util.stream.Stream; - -import static java.lang.foreign.Linker.*; + import static java.lang.foreign.ValueLayout.*; final class RuntimeHelper { diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/constants$0.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/constants$0.java similarity index 92% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/constants$0.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/constants$0.java index 6f64cd87..545ec48e 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/constants$0.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/constants$0.java @@ -1,12 +1,10 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; import java.lang.invoke.MethodHandle; -import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; -import static java.lang.foreign.ValueLayout.*; + class constants$0 { static final FunctionDescriptor fuse3_fill_dir_t$FUNC = FunctionDescriptor.of(Constants$root.C_LONG$LAYOUT, diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/constants$1.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/constants$1.java similarity index 91% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/constants$1.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/constants$1.java index 318db787..c69826d9 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/constants$1.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/constants$1.java @@ -1,12 +1,10 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; import java.lang.invoke.MethodHandle; -import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; -import static java.lang.foreign.ValueLayout.*; + class constants$1 { static final FunctionDescriptor fuse3_unmount$FUNC = FunctionDescriptor.ofVoid( diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/errno_h.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/errno_h.java similarity index 89% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/errno_h.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/errno_h.java index 110123c9..e2d57a3b 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/errno_h.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/errno_h.java @@ -1,11 +1,7 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; -import java.lang.foreign.*; import static java.lang.foreign.ValueLayout.*; public class errno_h { diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fcntl_h.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fcntl_h.java similarity index 86% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fcntl_h.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fcntl_h.java index bc2abfac..e8134901 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fcntl_h.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fcntl_h.java @@ -1,11 +1,7 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; -import java.lang.foreign.*; import static java.lang.foreign.ValueLayout.*; public class fcntl_h { diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/Constants$root.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/Constants$root.java similarity index 94% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/Constants$root.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/Constants$root.java index 85fa7c32..ea519756 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/Constants$root.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/Constants$root.java @@ -1,6 +1,6 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr.fuse2; +package org.cryptomator.jfuse.win.extr.fuse2; import java.lang.invoke.MethodHandle; import java.lang.invoke.VarHandle; diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/RuntimeHelper.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/RuntimeHelper.java similarity index 97% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/RuntimeHelper.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/RuntimeHelper.java index 69422f9c..6802595a 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/RuntimeHelper.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/RuntimeHelper.java @@ -1,4 +1,4 @@ -package org.cryptomator.jfuse.win.amd64.extr.fuse2; +package org.cryptomator.jfuse.win.extr.fuse2; // Generated by jextract import java.lang.foreign.Addressable; @@ -15,14 +15,7 @@ import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; -import java.io.File; -import java.nio.file.Path; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.Optional; -import java.util.stream.Stream; - -import static java.lang.foreign.Linker.*; + import static java.lang.foreign.ValueLayout.*; final class RuntimeHelper { diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/constants$0.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/constants$0.java similarity index 77% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/constants$0.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/constants$0.java index c13c8dd4..7761303c 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/constants$0.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/constants$0.java @@ -1,12 +1,10 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr.fuse2; +package org.cryptomator.jfuse.win.extr.fuse2; import java.lang.invoke.MethodHandle; -import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; -import static java.lang.foreign.ValueLayout.*; + class constants$0 { static final FunctionDescriptor fuse_parse_cmdline$FUNC = FunctionDescriptor.of(Constants$root.C_LONG$LAYOUT, diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/fuse2_h.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/fuse2_h.java similarity index 92% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/fuse2_h.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/fuse2_h.java index d06c6cbc..16fa84fc 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/fuse2_h.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/fuse2_h.java @@ -1,10 +1,8 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr.fuse2; +package org.cryptomator.jfuse.win.extr.fuse2; import java.lang.invoke.MethodHandle; -import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; import static java.lang.foreign.ValueLayout.*; public class fuse2_h { diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/fuse_args.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/fuse_args.java similarity index 95% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/fuse_args.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/fuse_args.java index ab0abb67..c115580c 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse2/fuse_args.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse2/fuse_args.java @@ -1,12 +1,10 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr.fuse2; +package org.cryptomator.jfuse.win.extr.fuse2; -import java.lang.invoke.MethodHandle; import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; -import static java.lang.foreign.ValueLayout.*; + public class fuse_args { static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_conn_info.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_conn_info.java similarity index 98% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_conn_info.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_conn_info.java index f10ddfeb..6e605dee 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_conn_info.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_conn_info.java @@ -1,12 +1,10 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; -import java.lang.invoke.MethodHandle; import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; -import static java.lang.foreign.ValueLayout.*; + public class fuse3_conn_info { static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_file_info.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_file_info.java similarity index 96% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_file_info.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_file_info.java index 2a86fd2b..520e0112 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_file_info.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_file_info.java @@ -1,12 +1,10 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; -import java.lang.invoke.MethodHandle; import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; -import static java.lang.foreign.ValueLayout.*; + public class fuse3_file_info { static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_fill_dir_t.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_fill_dir_t.java similarity index 85% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_fill_dir_t.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_fill_dir_t.java index 45a0540b..a645b3a4 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_fill_dir_t.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_fill_dir_t.java @@ -1,12 +1,9 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; -import static java.lang.foreign.ValueLayout.*; + public interface fuse3_fill_dir_t { int apply(java.lang.foreign.MemoryAddress buf, java.lang.foreign.MemoryAddress name, java.lang.foreign.MemoryAddress stbuf, long off, int flags); diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_operations.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_operations.java similarity index 99% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_operations.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_operations.java index 67910ecb..43330c74 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_operations.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse3_operations.java @@ -1,12 +1,11 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; import java.lang.invoke.MethodHandle; import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; -import static java.lang.foreign.ValueLayout.*; + public class fuse3_operations { static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_h.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_h.java similarity index 97% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_h.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_h.java index a55dfb51..e56948a4 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_h.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_h.java @@ -1,10 +1,8 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; import java.lang.invoke.MethodHandle; -import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; import static java.lang.foreign.ValueLayout.*; public class fuse_h { diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_stat.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_stat.java similarity index 98% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_stat.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_stat.java index 1d86bd65..a9b84b90 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_stat.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_stat.java @@ -1,12 +1,10 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; -import java.lang.invoke.MethodHandle; import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; -import static java.lang.foreign.ValueLayout.*; + public class fuse_stat { static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_statvfs.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_statvfs.java similarity index 98% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_statvfs.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_statvfs.java index d88af616..4e8463c3 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_statvfs.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_statvfs.java @@ -1,12 +1,10 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; -import java.lang.invoke.MethodHandle; import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; -import static java.lang.foreign.ValueLayout.*; + public class fuse_statvfs { static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_timespec.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_timespec.java similarity index 93% rename from jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_timespec.java rename to jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_timespec.java index 23ad5ca6..041d1be1 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse_timespec.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/extr/fuse_timespec.java @@ -1,12 +1,10 @@ // Generated by jextract -package org.cryptomator.jfuse.win.amd64.extr; +package org.cryptomator.jfuse.win.extr; -import java.lang.invoke.MethodHandle; import java.lang.invoke.VarHandle; -import java.nio.ByteOrder; import java.lang.foreign.*; -import static java.lang.foreign.ValueLayout.*; + public class fuse_timespec { static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( diff --git a/jfuse-win/src/main/resources/META-INF/services/org.cryptomator.jfuse.api.FuseBuilder b/jfuse-win/src/main/resources/META-INF/services/org.cryptomator.jfuse.api.FuseBuilder new file mode 100644 index 00000000..916435dc --- /dev/null +++ b/jfuse-win/src/main/resources/META-INF/services/org.cryptomator.jfuse.api.FuseBuilder @@ -0,0 +1 @@ +org.cryptomator.jfuse.win.WinFuseBuilder \ No newline at end of file diff --git a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FileInfoImplTest.java b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FileInfoImplTest.java similarity index 91% rename from jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FileInfoImplTest.java rename to jfuse-win/src/test/java/org/cryptomator/jfuse/win/FileInfoImplTest.java index 547bc92d..2701c120 100644 --- a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FileInfoImplTest.java +++ b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FileInfoImplTest.java @@ -1,7 +1,8 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; -import org.cryptomator.jfuse.win.amd64.extr.fcntl_h; -import org.cryptomator.jfuse.win.amd64.extr.fuse3_file_info; +import org.cryptomator.jfuse.win.FileInfoImpl; +import org.cryptomator.jfuse.win.extr.fcntl_h; +import org.cryptomator.jfuse.win.extr.fuse3_file_info; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; diff --git a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseConnInfoImplTest.java b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseConnInfoImplTest.java similarity index 96% rename from jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseConnInfoImplTest.java rename to jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseConnInfoImplTest.java index d37be619..b87efacd 100644 --- a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseConnInfoImplTest.java +++ b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseConnInfoImplTest.java @@ -1,7 +1,8 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.FuseConnInfo; -import org.cryptomator.jfuse.win.amd64.extr.fuse3_conn_info; +import org.cryptomator.jfuse.win.FuseConnInfoImpl; +import org.cryptomator.jfuse.win.extr.fuse3_conn_info; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Named; diff --git a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseImplTest.java b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseImplTest.java similarity index 95% rename from jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseImplTest.java rename to jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseImplTest.java index 8942bfd3..8c2485a3 100644 --- a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseImplTest.java +++ b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseImplTest.java @@ -1,16 +1,19 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; import org.cryptomator.jfuse.api.FileInfo; import org.cryptomator.jfuse.api.FuseConnInfo; import org.cryptomator.jfuse.api.FuseMount; import org.cryptomator.jfuse.api.FuseOperations; import org.cryptomator.jfuse.api.MountFailedException; -import org.cryptomator.jfuse.win.amd64.extr.fuse2.fuse2_h; -import org.cryptomator.jfuse.win.amd64.extr.fuse3_conn_info; -import org.cryptomator.jfuse.win.amd64.extr.fuse3_file_info; -import org.cryptomator.jfuse.win.amd64.extr.fuse_h; -import org.cryptomator.jfuse.win.amd64.extr.fuse_stat; -import org.cryptomator.jfuse.win.amd64.extr.fuse_timespec; +import org.cryptomator.jfuse.win.FileInfoImpl; +import org.cryptomator.jfuse.win.FuseArgs; +import org.cryptomator.jfuse.win.FuseImpl; +import org.cryptomator.jfuse.win.extr.fuse2.fuse2_h; +import org.cryptomator.jfuse.win.extr.fuse3_conn_info; +import org.cryptomator.jfuse.win.extr.fuse3_file_info; +import org.cryptomator.jfuse.win.extr.fuse_h; +import org.cryptomator.jfuse.win.extr.fuse_stat; +import org.cryptomator.jfuse.win.extr.fuse_timespec; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; diff --git a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/TimeSpecImplTest.java b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/TimeSpecImplTest.java similarity index 92% rename from jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/TimeSpecImplTest.java rename to jfuse-win/src/test/java/org/cryptomator/jfuse/win/TimeSpecImplTest.java index 26dc603b..51c686f1 100644 --- a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/TimeSpecImplTest.java +++ b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/TimeSpecImplTest.java @@ -1,6 +1,7 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; -import org.cryptomator.jfuse.win.amd64.extr.fuse_timespec; +import org.cryptomator.jfuse.win.TimeSpecImpl; +import org.cryptomator.jfuse.win.extr.fuse_timespec; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; diff --git a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/WinErrnoTest.java b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/WinErrnoTest.java similarity index 90% rename from jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/WinErrnoTest.java rename to jfuse-win/src/test/java/org/cryptomator/jfuse/win/WinErrnoTest.java index 1f2a6771..24dfa1b9 100644 --- a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/WinErrnoTest.java +++ b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/WinErrnoTest.java @@ -1,5 +1,6 @@ -package org.cryptomator.jfuse.win.amd64; +package org.cryptomator.jfuse.win; +import org.cryptomator.jfuse.win.WinErrno; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; diff --git a/pom.xml b/pom.xml index 4f02c398..5ab6e09d 100644 --- a/pom.xml +++ b/pom.xml @@ -233,15 +233,14 @@ - win-amd64 + win windows - amd64 - jfuse-win-amd64 + jfuse-win From 9ffd0ee76ef78a40a6f75335dc0e1f5323b201da Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 27 Sep 2022 11:01:04 +0200 Subject: [PATCH 03/41] add FuseConfig interface and add it to inti() method as parameter --- .../java/org/cryptomator/jfuse/api/Fuse.java | 2 +- .../org/cryptomator/jfuse/api/FuseConfig.java | 40 +++++++++++++++++++ .../cryptomator/jfuse/api/FuseConnInfo.java | 2 +- .../cryptomator/jfuse/api/FuseOperations.java | 2 +- .../jfuse/examples/HelloWorldFileSystem.java | 3 +- .../jfuse/linux/aarch64/FuseImpl.java | 4 +- .../jfuse/linux/amd64/FuseImpl.java | 4 +- .../org/cryptomator/jfuse/mac/FuseImpl.java | 2 +- .../cryptomator/jfuse/win/amd64/FuseImpl.java | 4 +- .../jfuse/win/amd64/FuseImplTest.java | 2 +- 10 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java index b930b667..d075165c 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java @@ -47,7 +47,7 @@ public static FuseBuilder builder() { /** * Mounts this fuse file system at the given mount point. *

- * This method blocks until either {@link FuseOperations#init(FuseConnInfo)} completes or an error occurs. + * This method blocks until either {@link FuseOperations#init(FuseConnInfo, FuseConfig)} completes or an error occurs. * * @param progName The program name used to construct a usage message and to derive a fallback for -ofsname=... * @param mountPoint mount point diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java new file mode 100644 index 00000000..a4e949b1 --- /dev/null +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java @@ -0,0 +1,40 @@ +package org.cryptomator.jfuse.api; + +public interface FuseConfig { + + int set_gid(); + + int set_uid(); + + double entry_timeout(); + + double negative_timeout(); + + double attr_timeout(); + + boolean intr(); + + int intr_signal(); + + int remember(); + + boolean hard_remove(); + + boolean use_ino(); + + boolean readdir_ino(); + + boolean direct_io(); + + boolean kernel_cache(); + + boolean auto_cache(); + + int ac_attr_timeout_set(); + + boolean nullpath_ok(); + + //not supported by winfsp due to being on libfuse 3.2 + //int no_rofd_flush(); + +} diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConnInfo.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConnInfo.java index 6253c565..86ad9fc9 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConnInfo.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConnInfo.java @@ -1,7 +1,7 @@ package org.cryptomator.jfuse.api; /** - * Fuse connection info struct used in {@link FuseOperations#init(FuseConnInfo)} method. + * Fuse connection info struct used in {@link FuseOperations#init(FuseConnInfo, FuseConfig)} method. *

* This struct is a union of the libfuse2 and libfuse3 definition. If an accessor method or macro is not supported by used libfuse version, it is documented in the javadoc. * See also @code{fuse_common.h} of libfuse2 or 3. diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java index c4dcb4dd..1cec1b9c 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java @@ -520,7 +520,7 @@ default int fsyncdir(@Nullable String path, int datasync, FileInfo fi) { * * @param conn FUSE information */ - default void init(FuseConnInfo conn) { // TODO: add @Nullable FuseConfig for libfuse3 + default void init(FuseConnInfo conn, @Nullable FuseConfig cfg) { // no-op } diff --git a/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/HelloWorldFileSystem.java b/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/HelloWorldFileSystem.java index ad07fcb5..52e899c3 100644 --- a/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/HelloWorldFileSystem.java +++ b/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/HelloWorldFileSystem.java @@ -4,6 +4,7 @@ import org.cryptomator.jfuse.api.Errno; import org.cryptomator.jfuse.api.FileInfo; import org.cryptomator.jfuse.api.Fuse; +import org.cryptomator.jfuse.api.FuseConfig; import org.cryptomator.jfuse.api.FuseConnInfo; import org.cryptomator.jfuse.api.FuseOperations; import org.cryptomator.jfuse.api.MountFailedException; @@ -97,7 +98,7 @@ public int getattr(String path, Stat stat, FileInfo fi) { } @Override - public void init(FuseConnInfo conn) { + public void init(FuseConnInfo conn, FuseConfig cfg) { LOG.info("init() {}.{}", conn.protoMajor(), conn.protoMinor()); } diff --git a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java index b7e084a0..8cd9dd87 100644 --- a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java +++ b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java @@ -100,11 +100,11 @@ private void bind(FuseOperations.Operation operation) { } @VisibleForTesting - Addressable init(MemoryAddress conn, MemoryAddress fuseConfig) { + Addressable init(MemoryAddress conn, MemoryAddress cfg) { try (var scope = MemorySession.openConfined()) { var connInfo = new FuseConnInfoImpl(conn, scope); connInfo.setWant(connInfo.want() | FuseConnInfo.FUSE_CAP_READDIRPLUS); - delegate.init(connInfo); + delegate.init(connInfo, null); } return MemoryAddress.NULL; } diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java index 55bdb212..15c1e462 100644 --- a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java @@ -100,11 +100,11 @@ private void bind(FuseOperations.Operation operation) { } @VisibleForTesting - Addressable init(MemoryAddress conn, MemoryAddress fuseConfig) { + Addressable init(MemoryAddress conn, MemoryAddress cfg) { try (var scope = MemorySession.openConfined()) { var connInfo = new FuseConnInfoImpl(conn, scope); connInfo.setWant(connInfo.want() | FuseConnInfo.FUSE_CAP_READDIRPLUS); - delegate.init(connInfo); + delegate.init(connInfo, null); } return MemoryAddress.NULL; } diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java index f4655367..61dc604a 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java @@ -108,7 +108,7 @@ private void bind(FuseOperations.Operation operation) { private Addressable init(MemoryAddress conn) { try (var scope = MemorySession.openConfined()) { - delegate.init(new FuseConnInfoImpl(conn, scope)); + delegate.init(new FuseConnInfoImpl(conn, scope), null); } return MemoryAddress.NULL; } diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseImpl.java b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseImpl.java index f84a891b..5546121e 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseImpl.java +++ b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseImpl.java @@ -143,11 +143,11 @@ private void bind(FuseOperations.Operation operation) { } @VisibleForTesting - Addressable init(MemoryAddress conn, MemoryAddress fuseConfig) { + Addressable init(MemoryAddress conn, MemoryAddress cfg) { try (var scope = MemorySession.openConfined()) { var connInfo = new FuseConnInfoImpl(conn, scope); connInfo.setWant(connInfo.want() | FuseConnInfo.FUSE_CAP_READDIRPLUS); - delegate.init(connInfo); + delegate.init(connInfo, null); } return MemoryAddress.NULL; } diff --git a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseImplTest.java b/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseImplTest.java index 8942bfd3..eeb7648c 100644 --- a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseImplTest.java +++ b/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseImplTest.java @@ -178,7 +178,7 @@ public void testInit() { FuseConnInfo connInfo = invocation.getArgument(0); result.set(connInfo.want()); return null; - }).when(fuseOps).init(Mockito.any()); + }).when(fuseOps).init(Mockito.any(), Mockito.any()); var connInfo = fuse3_conn_info.allocate(scope); var fuseConfig = MemoryAddress.NULL; // TODO jextract fuse_config From 41c6523a3b55388a068bdfd8a833960efb2e69f8 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 4 Oct 2022 12:37:17 +0200 Subject: [PATCH 04/41] add setter to fuseConfig interface --- .../org/cryptomator/jfuse/api/FuseConfig.java | 86 +++++++++++++++---- 1 file changed, 70 insertions(+), 16 deletions(-) diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java index a4e949b1..c6ce9202 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java @@ -2,37 +2,91 @@ public interface FuseConfig { - int set_gid(); + boolean getSetGid(); - int set_uid(); + void setSetGid(boolean setGid); - double entry_timeout(); + int getGid(); - double negative_timeout(); + void setGid(int gid); - double attr_timeout(); + boolean getSetUid(); - boolean intr(); + void setSetUid(boolean setUid); - int intr_signal(); + int getUid(); - int remember(); + void setUid(int uid); - boolean hard_remove(); + boolean getSetMode(); - boolean use_ino(); + void setSetMode(boolean setMode); - boolean readdir_ino(); + int getUmask(); - boolean direct_io(); + void setUmask(int umask); - boolean kernel_cache(); - boolean auto_cache(); + double getEntryTimeout(); - int ac_attr_timeout_set(); + void setEntryTimeout(double entryTimeout); - boolean nullpath_ok(); + double getNegativeTimeout(); + + void setNegativeTimeout(double negativeTimeout); + + double getAttrTimeout(); + + void setAttrTimeout(double attrTimeout); + + + boolean getIntr(); + + void setIntr(boolean intr); + + int getIntrSignal(); + + void setIntrSignal(int intrSignal); + + int getRemember(); + + void setRemember(int secondsToRemember); + + boolean getHardRemove(); + + void setHardRemove(boolean hardRemove); + + boolean getUseIno(); + + void setUseIno(boolean useIno); + + boolean getReaddirIno(); + + void setReaddirIno(boolean readdirIno); + + boolean getDirectIo(); + + void setDirectIo(boolean directIo); + + boolean getKernelCache(); + + void setKernelCache(boolean kernelCache); + + boolean getAutoCache(); + + void setAutoCache(boolean autoCache); + + boolean getAcAttrTimeoutSet(); + + void setAcAttrTimeoutSet(boolean acAttrTimeoutSet); + + double getAcAttrTimeout(); + + void setAcAttrTimeout(double acAttrTimeout); + + boolean getNullpathOk(); + + void setNullpathOk(boolean nullpathOk); //not supported by winfsp due to being on libfuse 3.2 //int no_rofd_flush(); From 2da58ece77123a770fb942dcf0779e592eb415c9 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 4 Oct 2022 16:34:03 +0200 Subject: [PATCH 05/41] follow record naming of methods for FuseConfig interface --- .../org/cryptomator/jfuse/api/FuseConfig.java | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java index c6ce9202..825a624b 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java @@ -6,85 +6,85 @@ public interface FuseConfig { void setSetGid(boolean setGid); - int getGid(); + int gid(); - void setGid(int gid); + void getSetGid(int gid); boolean getSetUid(); void setSetUid(boolean setUid); - int getUid(); + int uid(); - void setUid(int uid); + void getSetUid(int uid); boolean getSetMode(); void setSetMode(boolean setMode); - int getUmask(); + int umask(); void setUmask(int umask); - double getEntryTimeout(); + double entryTimeout(); void setEntryTimeout(double entryTimeout); - double getNegativeTimeout(); + double negativeTimeout(); void setNegativeTimeout(double negativeTimeout); - double getAttrTimeout(); + double attrTimeout(); void setAttrTimeout(double attrTimeout); - boolean getIntr(); + boolean intr(); void setIntr(boolean intr); - int getIntrSignal(); + int intrSignal(); void setIntrSignal(int intrSignal); - int getRemember(); + int remember(); void setRemember(int secondsToRemember); - boolean getHardRemove(); + boolean hardRemove(); void setHardRemove(boolean hardRemove); - boolean getUseIno(); + boolean useIno(); void setUseIno(boolean useIno); - boolean getReaddirIno(); + boolean readdirIno(); void setReaddirIno(boolean readdirIno); - boolean getDirectIo(); + boolean directIo(); void setDirectIo(boolean directIo); - boolean getKernelCache(); + boolean kernelCache(); void setKernelCache(boolean kernelCache); - boolean getAutoCache(); + boolean autoCache(); void setAutoCache(boolean autoCache); - boolean getAcAttrTimeoutSet(); + boolean acAttrTimeoutSet(); void setAcAttrTimeoutSet(boolean acAttrTimeoutSet); - double getAcAttrTimeout(); + double acAttrTimeout(); void setAcAttrTimeout(double acAttrTimeout); - boolean getNullpathOk(); + boolean nullpathOk(); void setNullpathOk(boolean nullpathOk); From fe31133425db8c491b467686bffc3a2acab7007d Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 4 Oct 2022 16:38:32 +0200 Subject: [PATCH 06/41] keep it real --- .../org/cryptomator/jfuse/api/FuseConfig.java | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java index 825a624b..1fd485b0 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java @@ -2,25 +2,25 @@ public interface FuseConfig { - boolean getSetGid(); + int getSetGid(); - void setSetGid(boolean setGid); + void setSetGid(int setGid); int gid(); void getSetGid(int gid); - boolean getSetUid(); + int getSetUid(); - void setSetUid(boolean setUid); + void setSetUid(int setUid); int uid(); void getSetUid(int uid); - boolean getSetMode(); + int getSetMode(); - void setSetMode(boolean setMode); + void setSetMode(int setMode); int umask(); @@ -39,10 +39,9 @@ public interface FuseConfig { void setAttrTimeout(double attrTimeout); + int intr(); - boolean intr(); - - void setIntr(boolean intr); + void setIntr(int intr); int intrSignal(); @@ -52,41 +51,41 @@ public interface FuseConfig { void setRemember(int secondsToRemember); - boolean hardRemove(); + int hardRemove(); - void setHardRemove(boolean hardRemove); + void setHardRemove(int hardRemove); - boolean useIno(); + int useIno(); - void setUseIno(boolean useIno); + void setUseIno(int useIno); - boolean readdirIno(); + int readdirIno(); - void setReaddirIno(boolean readdirIno); + void setReaddirIno(int readdirIno); - boolean directIo(); + int directIo(); - void setDirectIo(boolean directIo); + void setDirectIo(int directIo); - boolean kernelCache(); + int kernelCache(); - void setKernelCache(boolean kernelCache); + void setKernelCache(int kernelCache); - boolean autoCache(); + int autoCache(); - void setAutoCache(boolean autoCache); + void setAutoCache(int autoCache); - boolean acAttrTimeoutSet(); + int acAttrTimeoutSet(); - void setAcAttrTimeoutSet(boolean acAttrTimeoutSet); + void setAcAttrTimeoutSet(int acAttrTimeoutSet); double acAttrTimeout(); void setAcAttrTimeout(double acAttrTimeout); - boolean nullpathOk(); + int nullpathOk(); - void setNullpathOk(boolean nullpathOk); + void setNullpathOk(int nullpathOk); //not supported by winfsp due to being on libfuse 3.2 //int no_rofd_flush(); From 6ae777363e99dcd99acb6b5c75942061599b9c2e Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Tue, 4 Oct 2022 17:27:34 +0200 Subject: [PATCH 07/41] add fuseConfig impl for windows --- jfuse-win-amd64/pom.xml | 1 + .../jfuse/win/amd64/FuseConfigImpl.java | 226 +++++++++ .../cryptomator/jfuse/win/amd64/FuseImpl.java | 3 +- .../jfuse/win/amd64/extr/fuse3_config.java | 434 ++++++++++++++++++ 4 files changed, 663 insertions(+), 1 deletion(-) create mode 100644 jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseConfigImpl.java create mode 100644 jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_config.java diff --git a/jfuse-win-amd64/pom.xml b/jfuse-win-amd64/pom.xml index 82665348..04587b33 100644 --- a/jfuse-win-amd64/pom.xml +++ b/jfuse-win-amd64/pom.xml @@ -114,6 +114,7 @@ fuse_stat fuse_statvfs fuse_timespec + fuse3_config fuse3_conn_info diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseConfigImpl.java b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseConfigImpl.java new file mode 100644 index 00000000..436c5e1a --- /dev/null +++ b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseConfigImpl.java @@ -0,0 +1,226 @@ +package org.cryptomator.jfuse.win.amd64; + +import org.cryptomator.jfuse.api.FuseConfig; +import org.cryptomator.jfuse.win.amd64.extr.fuse3_config; + +import java.lang.foreign.MemoryAddress; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.MemorySession; + +record FuseConfigImpl(MemorySegment segment) implements FuseConfig { + + public FuseConfigImpl(MemoryAddress address, MemorySession scope) { + this(fuse3_config.ofAddress(address, scope)); + } + + @Override + public int getSetGid() { + return fuse3_config.set_gid$get(segment); + } + + @Override + public void setSetGid(int setGid) { + fuse3_config.set_gid$set(segment, setGid); + } + + @Override + public int gid() { + return fuse3_config.gid$get(segment); + } + + @Override + public void getSetGid(int gid) { + fuse3_config.gid$set(segment, gid); + } + + @Override + public int getSetUid() { + return fuse3_config.set_uid$get(segment); + } + + @Override + public void setSetUid(int setUid) { + fuse3_config.set_uid$set(segment, setUid); + } + + @Override + public int uid() { + return fuse3_config.uid$get(segment); + } + + @Override + public void getSetUid(int uid) { + fuse3_config.uid$set(segment, uid); + } + + @Override + public int getSetMode() { + return fuse3_config.set_mode$get(segment); + } + + @Override + public void setSetMode(int setMode) { + fuse3_config.set_mode$set(segment, setMode); + } + + @Override + public int umask() { + return fuse3_config.umask$get(segment); + } + + @Override + public void setUmask(int umask) { + fuse3_config.uid$set(segment, umask); + } + + @Override + public double entryTimeout() { + return fuse3_config.entry_timeout$get(segment); + } + + @Override + public void setEntryTimeout(double entryTimeout) { + fuse3_config.entry_timeout$set(segment, entryTimeout); + } + + @Override + public double negativeTimeout() { + return fuse3_config.negative_timeout$get(segment); + } + + @Override + public void setNegativeTimeout(double negativeTimeout) { + fuse3_config.negative_timeout$set(segment, negativeTimeout); + } + + @Override + public double attrTimeout() { + return fuse3_config.attr_timeout$get(segment); + } + + @Override + public void setAttrTimeout(double attrTimeout) { + fuse3_config.attr_timeout$set(segment, attrTimeout); + } + + @Override + public int intr() { + return fuse3_config.intr$get(segment); + } + + @Override + public void setIntr(int intr) { + fuse3_config.intr$set(segment, intr); + } + + @Override + public int intrSignal() { + return fuse3_config.intr_signal$get(segment); + } + + @Override + public void setIntrSignal(int intrSignal) { + fuse3_config.intr_signal$set(segment, intrSignal); + } + + @Override + public int remember() { + return fuse3_config.remember$get(segment); + } + + @Override + public void setRemember(int secondsToRemember) { + fuse3_config.remember$set(segment, secondsToRemember); + } + + @Override + public int hardRemove() { + return fuse3_config.hard_remove$get(segment); + } + + @Override + public void setHardRemove(int hardRemove) { + fuse3_config.hard_remove$set(segment, hardRemove); + } + + @Override + public int useIno() { + return fuse3_config.use_ino$get(segment); + } + + @Override + public void setUseIno(int useIno) { + fuse3_config.use_ino$set(segment, useIno); + } + + @Override + public int readdirIno() { + return fuse3_config.readdir_ino$get(segment); + } + + @Override + public void setReaddirIno(int readdirIno) { + fuse3_config.readdir_ino$set(segment, readdirIno); + } + + @Override + public int directIo() { + return fuse3_config.direct_io$get(segment); + } + + @Override + public void setDirectIo(int directIo) { + fuse3_config.direct_io$set(segment, directIo); + } + + @Override + public int kernelCache() { + return fuse3_config.kernel_cache$get(segment); + } + + @Override + public void setKernelCache(int kernelCache) { + fuse3_config.kernel_cache$set(segment, kernelCache); + } + + @Override + public int autoCache() { + return fuse3_config.auto_cache$get(segment); + } + + @Override + public void setAutoCache(int autoCache) { + fuse3_config.auto_cache$set(segment, autoCache); + } + + @Override + public int acAttrTimeoutSet() { + return fuse3_config.ac_attr_timeout_set$get(segment); + } + + @Override + public void setAcAttrTimeoutSet(int acAttrTimeoutSet) { + fuse3_config.ac_attr_timeout_set$set(segment, acAttrTimeoutSet); + } + + @Override + public double acAttrTimeout() { + return fuse3_config.ac_attr_timeout$get(segment); + } + + @Override + public void setAcAttrTimeout(double acAttrTimeout) { + fuse3_config.ac_attr_timeout$set(segment, acAttrTimeout); + } + + @Override + public int nullpathOk() { + return fuse3_config.nullpath_ok$get(segment); + } + + @Override + public void setNullpathOk(int nullpathOk) { + fuse3_config.nullpath_ok$set(segment, nullpathOk); + } + +} diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseImpl.java b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseImpl.java index 5546121e..a7218add 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseImpl.java +++ b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseImpl.java @@ -147,7 +147,8 @@ Addressable init(MemoryAddress conn, MemoryAddress cfg) { try (var scope = MemorySession.openConfined()) { var connInfo = new FuseConnInfoImpl(conn, scope); connInfo.setWant(connInfo.want() | FuseConnInfo.FUSE_CAP_READDIRPLUS); - delegate.init(connInfo, null); + var config = new FuseConfigImpl(cfg, scope); + delegate.init(connInfo, config); } return MemoryAddress.NULL; } diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_config.java b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_config.java new file mode 100644 index 00000000..f537ac6d --- /dev/null +++ b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/extr/fuse3_config.java @@ -0,0 +1,434 @@ +// Generated by jextract + +package org.cryptomator.jfuse.win.amd64.extr; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import java.lang.foreign.*; +import static java.lang.foreign.ValueLayout.*; +public class fuse3_config { + + static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( + Constants$root.C_LONG$LAYOUT.withName("set_gid"), + Constants$root.C_LONG$LAYOUT.withName("gid"), + Constants$root.C_LONG$LAYOUT.withName("set_uid"), + Constants$root.C_LONG$LAYOUT.withName("uid"), + Constants$root.C_LONG$LAYOUT.withName("set_mode"), + Constants$root.C_LONG$LAYOUT.withName("umask"), + Constants$root.C_DOUBLE$LAYOUT.withName("entry_timeout"), + Constants$root.C_DOUBLE$LAYOUT.withName("negative_timeout"), + Constants$root.C_DOUBLE$LAYOUT.withName("attr_timeout"), + Constants$root.C_LONG$LAYOUT.withName("intr"), + Constants$root.C_LONG$LAYOUT.withName("intr_signal"), + Constants$root.C_LONG$LAYOUT.withName("remember"), + Constants$root.C_LONG$LAYOUT.withName("hard_remove"), + Constants$root.C_LONG$LAYOUT.withName("use_ino"), + Constants$root.C_LONG$LAYOUT.withName("readdir_ino"), + Constants$root.C_LONG$LAYOUT.withName("direct_io"), + Constants$root.C_LONG$LAYOUT.withName("kernel_cache"), + Constants$root.C_LONG$LAYOUT.withName("auto_cache"), + Constants$root.C_LONG$LAYOUT.withName("ac_attr_timeout_set"), + Constants$root.C_DOUBLE$LAYOUT.withName("ac_attr_timeout"), + Constants$root.C_LONG$LAYOUT.withName("nullpath_ok"), + Constants$root.C_LONG$LAYOUT.withName("show_help"), + Constants$root.C_POINTER$LAYOUT.withName("modules"), + Constants$root.C_LONG$LAYOUT.withName("debug"), + MemoryLayout.paddingLayout(32) + ).withName("fuse3_config"); + public static MemoryLayout $LAYOUT() { + return fuse3_config.$struct$LAYOUT; + } + static final VarHandle set_gid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("set_gid")); + public static VarHandle set_gid$VH() { + return fuse3_config.set_gid$VH; + } + public static int set_gid$get(MemorySegment seg) { + return (int)fuse3_config.set_gid$VH.get(seg); + } + public static void set_gid$set( MemorySegment seg, int x) { + fuse3_config.set_gid$VH.set(seg, x); + } + public static int set_gid$get(MemorySegment seg, long index) { + return (int)fuse3_config.set_gid$VH.get(seg.asSlice(index*sizeof())); + } + public static void set_gid$set(MemorySegment seg, long index, int x) { + fuse3_config.set_gid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle gid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("gid")); + public static VarHandle gid$VH() { + return fuse3_config.gid$VH; + } + public static int gid$get(MemorySegment seg) { + return (int)fuse3_config.gid$VH.get(seg); + } + public static void gid$set( MemorySegment seg, int x) { + fuse3_config.gid$VH.set(seg, x); + } + public static int gid$get(MemorySegment seg, long index) { + return (int)fuse3_config.gid$VH.get(seg.asSlice(index*sizeof())); + } + public static void gid$set(MemorySegment seg, long index, int x) { + fuse3_config.gid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle set_uid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("set_uid")); + public static VarHandle set_uid$VH() { + return fuse3_config.set_uid$VH; + } + public static int set_uid$get(MemorySegment seg) { + return (int)fuse3_config.set_uid$VH.get(seg); + } + public static void set_uid$set( MemorySegment seg, int x) { + fuse3_config.set_uid$VH.set(seg, x); + } + public static int set_uid$get(MemorySegment seg, long index) { + return (int)fuse3_config.set_uid$VH.get(seg.asSlice(index*sizeof())); + } + public static void set_uid$set(MemorySegment seg, long index, int x) { + fuse3_config.set_uid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle uid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("uid")); + public static VarHandle uid$VH() { + return fuse3_config.uid$VH; + } + public static int uid$get(MemorySegment seg) { + return (int)fuse3_config.uid$VH.get(seg); + } + public static void uid$set( MemorySegment seg, int x) { + fuse3_config.uid$VH.set(seg, x); + } + public static int uid$get(MemorySegment seg, long index) { + return (int)fuse3_config.uid$VH.get(seg.asSlice(index*sizeof())); + } + public static void uid$set(MemorySegment seg, long index, int x) { + fuse3_config.uid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle set_mode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("set_mode")); + public static VarHandle set_mode$VH() { + return fuse3_config.set_mode$VH; + } + public static int set_mode$get(MemorySegment seg) { + return (int)fuse3_config.set_mode$VH.get(seg); + } + public static void set_mode$set( MemorySegment seg, int x) { + fuse3_config.set_mode$VH.set(seg, x); + } + public static int set_mode$get(MemorySegment seg, long index) { + return (int)fuse3_config.set_mode$VH.get(seg.asSlice(index*sizeof())); + } + public static void set_mode$set(MemorySegment seg, long index, int x) { + fuse3_config.set_mode$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle umask$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("umask")); + public static VarHandle umask$VH() { + return fuse3_config.umask$VH; + } + public static int umask$get(MemorySegment seg) { + return (int)fuse3_config.umask$VH.get(seg); + } + public static void umask$set( MemorySegment seg, int x) { + fuse3_config.umask$VH.set(seg, x); + } + public static int umask$get(MemorySegment seg, long index) { + return (int)fuse3_config.umask$VH.get(seg.asSlice(index*sizeof())); + } + public static void umask$set(MemorySegment seg, long index, int x) { + fuse3_config.umask$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle entry_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("entry_timeout")); + public static VarHandle entry_timeout$VH() { + return fuse3_config.entry_timeout$VH; + } + public static double entry_timeout$get(MemorySegment seg) { + return (double)fuse3_config.entry_timeout$VH.get(seg); + } + public static void entry_timeout$set( MemorySegment seg, double x) { + fuse3_config.entry_timeout$VH.set(seg, x); + } + public static double entry_timeout$get(MemorySegment seg, long index) { + return (double)fuse3_config.entry_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void entry_timeout$set(MemorySegment seg, long index, double x) { + fuse3_config.entry_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle negative_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("negative_timeout")); + public static VarHandle negative_timeout$VH() { + return fuse3_config.negative_timeout$VH; + } + public static double negative_timeout$get(MemorySegment seg) { + return (double)fuse3_config.negative_timeout$VH.get(seg); + } + public static void negative_timeout$set( MemorySegment seg, double x) { + fuse3_config.negative_timeout$VH.set(seg, x); + } + public static double negative_timeout$get(MemorySegment seg, long index) { + return (double)fuse3_config.negative_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void negative_timeout$set(MemorySegment seg, long index, double x) { + fuse3_config.negative_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle attr_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("attr_timeout")); + public static VarHandle attr_timeout$VH() { + return fuse3_config.attr_timeout$VH; + } + public static double attr_timeout$get(MemorySegment seg) { + return (double)fuse3_config.attr_timeout$VH.get(seg); + } + public static void attr_timeout$set( MemorySegment seg, double x) { + fuse3_config.attr_timeout$VH.set(seg, x); + } + public static double attr_timeout$get(MemorySegment seg, long index) { + return (double)fuse3_config.attr_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void attr_timeout$set(MemorySegment seg, long index, double x) { + fuse3_config.attr_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle intr$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("intr")); + public static VarHandle intr$VH() { + return fuse3_config.intr$VH; + } + public static int intr$get(MemorySegment seg) { + return (int)fuse3_config.intr$VH.get(seg); + } + public static void intr$set( MemorySegment seg, int x) { + fuse3_config.intr$VH.set(seg, x); + } + public static int intr$get(MemorySegment seg, long index) { + return (int)fuse3_config.intr$VH.get(seg.asSlice(index*sizeof())); + } + public static void intr$set(MemorySegment seg, long index, int x) { + fuse3_config.intr$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle intr_signal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("intr_signal")); + public static VarHandle intr_signal$VH() { + return fuse3_config.intr_signal$VH; + } + public static int intr_signal$get(MemorySegment seg) { + return (int)fuse3_config.intr_signal$VH.get(seg); + } + public static void intr_signal$set( MemorySegment seg, int x) { + fuse3_config.intr_signal$VH.set(seg, x); + } + public static int intr_signal$get(MemorySegment seg, long index) { + return (int)fuse3_config.intr_signal$VH.get(seg.asSlice(index*sizeof())); + } + public static void intr_signal$set(MemorySegment seg, long index, int x) { + fuse3_config.intr_signal$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle remember$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("remember")); + public static VarHandle remember$VH() { + return fuse3_config.remember$VH; + } + public static int remember$get(MemorySegment seg) { + return (int)fuse3_config.remember$VH.get(seg); + } + public static void remember$set( MemorySegment seg, int x) { + fuse3_config.remember$VH.set(seg, x); + } + public static int remember$get(MemorySegment seg, long index) { + return (int)fuse3_config.remember$VH.get(seg.asSlice(index*sizeof())); + } + public static void remember$set(MemorySegment seg, long index, int x) { + fuse3_config.remember$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle hard_remove$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hard_remove")); + public static VarHandle hard_remove$VH() { + return fuse3_config.hard_remove$VH; + } + public static int hard_remove$get(MemorySegment seg) { + return (int)fuse3_config.hard_remove$VH.get(seg); + } + public static void hard_remove$set( MemorySegment seg, int x) { + fuse3_config.hard_remove$VH.set(seg, x); + } + public static int hard_remove$get(MemorySegment seg, long index) { + return (int)fuse3_config.hard_remove$VH.get(seg.asSlice(index*sizeof())); + } + public static void hard_remove$set(MemorySegment seg, long index, int x) { + fuse3_config.hard_remove$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle use_ino$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("use_ino")); + public static VarHandle use_ino$VH() { + return fuse3_config.use_ino$VH; + } + public static int use_ino$get(MemorySegment seg) { + return (int)fuse3_config.use_ino$VH.get(seg); + } + public static void use_ino$set( MemorySegment seg, int x) { + fuse3_config.use_ino$VH.set(seg, x); + } + public static int use_ino$get(MemorySegment seg, long index) { + return (int)fuse3_config.use_ino$VH.get(seg.asSlice(index*sizeof())); + } + public static void use_ino$set(MemorySegment seg, long index, int x) { + fuse3_config.use_ino$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle readdir_ino$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("readdir_ino")); + public static VarHandle readdir_ino$VH() { + return fuse3_config.readdir_ino$VH; + } + public static int readdir_ino$get(MemorySegment seg) { + return (int)fuse3_config.readdir_ino$VH.get(seg); + } + public static void readdir_ino$set( MemorySegment seg, int x) { + fuse3_config.readdir_ino$VH.set(seg, x); + } + public static int readdir_ino$get(MemorySegment seg, long index) { + return (int)fuse3_config.readdir_ino$VH.get(seg.asSlice(index*sizeof())); + } + public static void readdir_ino$set(MemorySegment seg, long index, int x) { + fuse3_config.readdir_ino$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle direct_io$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("direct_io")); + public static VarHandle direct_io$VH() { + return fuse3_config.direct_io$VH; + } + public static int direct_io$get(MemorySegment seg) { + return (int)fuse3_config.direct_io$VH.get(seg); + } + public static void direct_io$set( MemorySegment seg, int x) { + fuse3_config.direct_io$VH.set(seg, x); + } + public static int direct_io$get(MemorySegment seg, long index) { + return (int)fuse3_config.direct_io$VH.get(seg.asSlice(index*sizeof())); + } + public static void direct_io$set(MemorySegment seg, long index, int x) { + fuse3_config.direct_io$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle kernel_cache$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("kernel_cache")); + public static VarHandle kernel_cache$VH() { + return fuse3_config.kernel_cache$VH; + } + public static int kernel_cache$get(MemorySegment seg) { + return (int)fuse3_config.kernel_cache$VH.get(seg); + } + public static void kernel_cache$set( MemorySegment seg, int x) { + fuse3_config.kernel_cache$VH.set(seg, x); + } + public static int kernel_cache$get(MemorySegment seg, long index) { + return (int)fuse3_config.kernel_cache$VH.get(seg.asSlice(index*sizeof())); + } + public static void kernel_cache$set(MemorySegment seg, long index, int x) { + fuse3_config.kernel_cache$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle auto_cache$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("auto_cache")); + public static VarHandle auto_cache$VH() { + return fuse3_config.auto_cache$VH; + } + public static int auto_cache$get(MemorySegment seg) { + return (int)fuse3_config.auto_cache$VH.get(seg); + } + public static void auto_cache$set( MemorySegment seg, int x) { + fuse3_config.auto_cache$VH.set(seg, x); + } + public static int auto_cache$get(MemorySegment seg, long index) { + return (int)fuse3_config.auto_cache$VH.get(seg.asSlice(index*sizeof())); + } + public static void auto_cache$set(MemorySegment seg, long index, int x) { + fuse3_config.auto_cache$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle ac_attr_timeout_set$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ac_attr_timeout_set")); + public static VarHandle ac_attr_timeout_set$VH() { + return fuse3_config.ac_attr_timeout_set$VH; + } + public static int ac_attr_timeout_set$get(MemorySegment seg) { + return (int)fuse3_config.ac_attr_timeout_set$VH.get(seg); + } + public static void ac_attr_timeout_set$set( MemorySegment seg, int x) { + fuse3_config.ac_attr_timeout_set$VH.set(seg, x); + } + public static int ac_attr_timeout_set$get(MemorySegment seg, long index) { + return (int)fuse3_config.ac_attr_timeout_set$VH.get(seg.asSlice(index*sizeof())); + } + public static void ac_attr_timeout_set$set(MemorySegment seg, long index, int x) { + fuse3_config.ac_attr_timeout_set$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle ac_attr_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ac_attr_timeout")); + public static VarHandle ac_attr_timeout$VH() { + return fuse3_config.ac_attr_timeout$VH; + } + public static double ac_attr_timeout$get(MemorySegment seg) { + return (double)fuse3_config.ac_attr_timeout$VH.get(seg); + } + public static void ac_attr_timeout$set( MemorySegment seg, double x) { + fuse3_config.ac_attr_timeout$VH.set(seg, x); + } + public static double ac_attr_timeout$get(MemorySegment seg, long index) { + return (double)fuse3_config.ac_attr_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void ac_attr_timeout$set(MemorySegment seg, long index, double x) { + fuse3_config.ac_attr_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle nullpath_ok$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("nullpath_ok")); + public static VarHandle nullpath_ok$VH() { + return fuse3_config.nullpath_ok$VH; + } + public static int nullpath_ok$get(MemorySegment seg) { + return (int)fuse3_config.nullpath_ok$VH.get(seg); + } + public static void nullpath_ok$set( MemorySegment seg, int x) { + fuse3_config.nullpath_ok$VH.set(seg, x); + } + public static int nullpath_ok$get(MemorySegment seg, long index) { + return (int)fuse3_config.nullpath_ok$VH.get(seg.asSlice(index*sizeof())); + } + public static void nullpath_ok$set(MemorySegment seg, long index, int x) { + fuse3_config.nullpath_ok$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle show_help$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("show_help")); + public static VarHandle show_help$VH() { + return fuse3_config.show_help$VH; + } + public static int show_help$get(MemorySegment seg) { + return (int)fuse3_config.show_help$VH.get(seg); + } + public static void show_help$set( MemorySegment seg, int x) { + fuse3_config.show_help$VH.set(seg, x); + } + public static int show_help$get(MemorySegment seg, long index) { + return (int)fuse3_config.show_help$VH.get(seg.asSlice(index*sizeof())); + } + public static void show_help$set(MemorySegment seg, long index, int x) { + fuse3_config.show_help$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle modules$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("modules")); + public static VarHandle modules$VH() { + return fuse3_config.modules$VH; + } + public static MemoryAddress modules$get(MemorySegment seg) { + return (java.lang.foreign.MemoryAddress)fuse3_config.modules$VH.get(seg); + } + public static void modules$set( MemorySegment seg, MemoryAddress x) { + fuse3_config.modules$VH.set(seg, x); + } + public static MemoryAddress modules$get(MemorySegment seg, long index) { + return (java.lang.foreign.MemoryAddress)fuse3_config.modules$VH.get(seg.asSlice(index*sizeof())); + } + public static void modules$set(MemorySegment seg, long index, MemoryAddress x) { + fuse3_config.modules$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle debug$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("debug")); + public static VarHandle debug$VH() { + return fuse3_config.debug$VH; + } + public static int debug$get(MemorySegment seg) { + return (int)fuse3_config.debug$VH.get(seg); + } + public static void debug$set( MemorySegment seg, int x) { + fuse3_config.debug$VH.set(seg, x); + } + public static int debug$get(MemorySegment seg, long index) { + return (int)fuse3_config.debug$VH.get(seg.asSlice(index*sizeof())); + } + public static void debug$set(MemorySegment seg, long index, int x) { + fuse3_config.debug$VH.set(seg.asSlice(index*sizeof()), x); + } + public static long sizeof() { return $LAYOUT().byteSize(); } + public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } + public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + } + public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } +} + + From 3442cf9e0c2c4830624853ca47038187f9e6d1f1 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Fri, 7 Oct 2022 15:20:24 +0200 Subject: [PATCH 08/41] Add `S_IFMT` and `S_ISxxx` predicates --- .../java/org/cryptomator/jfuse/api/Stat.java | 113 ++++++----- .../org/cryptomator/jfuse/api/StatTest.java | 179 ++++++++++++------ .../examples/AbstractMirrorFileSystem.java | 8 +- 3 files changed, 187 insertions(+), 113 deletions(-) diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Stat.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Stat.java index 95b1891f..9d16d292 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Stat.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Stat.java @@ -2,46 +2,99 @@ import java.nio.file.attribute.PosixFilePermission; import java.util.Set; - +import java.util.function.IntPredicate; + +/** + * Represents the stat struct, which contains file attributes. + * + * @see stat man page + * @see inode man page + */ @SuppressWarnings("OctalInteger") public interface Stat { + /** + * Bit mask for the file type bit field + */ + int S_IFMT = 0170000; + /** * Mask value for file type socket * See man page of inode(7). */ int S_IFSOCK = 0140000; + /** * Mask value for file type symbolic link * See man page of inode(7). */ int S_IFLNK = 0120000; + /** * Mask value for file type regular file * See man page of inode(7). */ int S_IFREG = 0100000; + /** * Mask value for file type block device * See man page of inode(7). */ int S_IFBLK = 0060000; + /** * Mask value for file type directory * See man page of inode(7). */ int S_IFDIR = 0040000; + /** * Mask value for file type character device * See man page of inode(7). */ int S_IFCHR = 0020000; + /** * Mask value for file type named pipe (FIFO) * See man page of inode(7). */ int S_IFIFO = 0010000; + /** + * is it a regular file? + */ + IntPredicate S_ISREG = m -> (m & S_IFMT) == S_IFREG; + + /** + * directory? + */ + IntPredicate S_ISDIR = m -> (m & S_IFMT) == S_IFDIR; + + /** + * character device? + */ + IntPredicate S_ISCHR = m -> (m & S_IFMT) == S_IFCHR; + + /** + * block device? + */ + IntPredicate S_ISBLK = m -> (m & S_IFMT) == S_IFBLK; + + /** + * FIFO (named pipe)? + */ + IntPredicate S_ISFIFO = m -> (m & S_IFMT) == S_IFIFO; + + /** + * symbolic link? + */ + IntPredicate S_ISLNK = m -> (m & S_IFMT) == S_IFLNK; + + /** + * socket? + */ + IntPredicate S_ISSOCK = m -> (m & S_IFMT) == S_IFSOCK; + TimeSpec aTime(); TimeSpec cTime(); @@ -80,64 +133,26 @@ default void setPermissions(Set permissions) { setMode(mode); } - /** - * @return true if S_IFDIR bit is set in {@link #getMode()} - */ - default boolean isDir() { - return hasMode(S_IFDIR); - } - - /** - * Sets the S_IFDIR bit in {@link #setMode(int)} - * - * @param isDir Whether to set the S_IFDIR bit to one. - */ - default void toggleDir(boolean isDir) { - toggleMode(S_IFDIR, isDir); - } - - /** - * @return true if S_IFREG bit is set in {@link #getMode()} - */ - default boolean isReg() { - return hasMode(S_IFREG); + default boolean hasMode(int mask) { + return (getMode() & mask) == mask; } /** - * Sets the S_IFREG bit in {@link #setMode(int)} + * Adds the given bit to {@link #getMode() mode} * - * @param isReg Whether to set the S_IFREG bit to one. - */ - default void toggleReg(boolean isReg) { - toggleMode(S_IFREG, isReg); - } - - /** - * @return true if S_IFLNK bit is set in {@link #getMode()} + * @param mask the bits to set */ - default boolean isLnk() { - return hasMode(S_IFLNK); + default void setModeBits(int mask) { + setMode(getMode() | mask); } /** - * Sets the S_IFLNK bit in {@link #setMode(int)} + * Erases the given bit from {@link #getMode() mode} * - * @param isLnk Whether to set the S_IFLNK bit to one. + * @param mask the bits to unset */ - default void toggleLnk(boolean isLnk) { - toggleMode(S_IFLNK, isLnk); - } - - default boolean hasMode(int mask) { - return (getMode() & mask) == mask; - } - - default void toggleMode(int mask, boolean set) { - if (set) { - setMode(getMode() | mask); - } else { - setMode(getMode() & ~mask); - } + default void unsetModeBits(int mask) { + setMode(getMode() & ~mask); } } diff --git a/jfuse-api/src/test/java/org/cryptomator/jfuse/api/StatTest.java b/jfuse-api/src/test/java/org/cryptomator/jfuse/api/StatTest.java index 8d1b8617..cfcfa811 100644 --- a/jfuse-api/src/test/java/org/cryptomator/jfuse/api/StatTest.java +++ b/jfuse-api/src/test/java/org/cryptomator/jfuse/api/StatTest.java @@ -1,101 +1,160 @@ package org.cryptomator.jfuse.api; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; -import org.mockito.ArgumentMatcher; import org.mockito.Mockito; -import java.util.stream.Stream; +import java.nio.file.attribute.PosixFilePermissions; -import static org.cryptomator.jfuse.api.Stat.S_IFDIR; -import static org.cryptomator.jfuse.api.Stat.S_IFLNK; -import static org.cryptomator.jfuse.api.Stat.S_IFREG; +import static org.cryptomator.jfuse.api.Stat.*; +@SuppressWarnings("OctalInteger") public class StatTest { private static final int MAGIC = 123456;//some rando number public Stat stat = Mockito.spy(new StubStatImpl()); - @ParameterizedTest - @MethodSource("provideDataForToggle") - public void testToggleMode(int mode, int mask, boolean toSet) { - Mockito.when(stat.getMode()).thenReturn(mode); - stat.toggleMode(mask, toSet); - Mockito.verify(stat).setMode(Mockito.intThat(toSet ? hasBitsSet(mask) : hasBitsNotSet(mask))); + @Nested + @DisplayName("Test File Type Predicates") + public class FileTypeTests { + + @Test + @DisplayName("neither file mode bit set") + public void testNone() { + Assertions.assertFalse(Stat.S_ISREG.test(0)); + Assertions.assertFalse(Stat.S_ISDIR.test(0)); + Assertions.assertFalse(Stat.S_ISCHR.test(0)); + Assertions.assertFalse(Stat.S_ISBLK.test(0)); + Assertions.assertFalse(Stat.S_ISFIFO.test(0)); + Assertions.assertFalse(Stat.S_ISLNK.test(0)); + Assertions.assertFalse(Stat.S_ISSOCK.test(0)); + } + + @ParameterizedTest(name = "S_ISREG({0})") + @DisplayName("S_ISREG") + @ValueSource(ints = {S_IFREG, S_IFREG | 0755}) + public void testIsReg(int mode) { + Assertions.assertTrue(Stat.S_ISREG.test(mode)); + } + + @ParameterizedTest(name = "S_ISDIR({0})") + @DisplayName("S_ISDIR") + @ValueSource(ints = {S_IFDIR, S_IFDIR | 0755}) + public void testIsDir(int mode) { + Assertions.assertTrue(Stat.S_ISDIR.test(mode)); + } + + @ParameterizedTest(name = "S_ISCHR({0})") + @DisplayName("S_ISCHR") + @ValueSource(ints = {S_IFCHR, S_IFCHR | 0755}) + public void testIsChr(int mode) { + Assertions.assertTrue(Stat.S_ISCHR.test(mode)); + } + + @ParameterizedTest(name = "S_ISBLK({0})") + @DisplayName("S_ISBLK") + @ValueSource(ints = {S_IFBLK, S_IFBLK | 0755}) + public void testIsBlk(int mode) { + Assertions.assertTrue(Stat.S_ISBLK.test(mode)); + } + + @ParameterizedTest(name = "S_ISFIFO({0})") + @DisplayName("S_ISFIFO") + @ValueSource(ints = {S_IFIFO, S_IFIFO | 0755}) + public void testIsFifo(int mode) { + Assertions.assertTrue(Stat.S_ISFIFO.test(mode)); + } + + @ParameterizedTest(name = "S_ISLNK({0})") + @DisplayName("S_ISLNK") + @ValueSource(ints = {S_IFLNK, S_IFLNK | 0755}) + public void testIsLnk(int mode) { + Assertions.assertTrue(Stat.S_ISLNK.test(mode)); + } + + @ParameterizedTest(name = "S_ISSOCK({0})") + @DisplayName("S_ISSOCK") + @ValueSource(ints = {S_IFSOCK, S_IFSOCK | 0755}) + public void testIsSock(int mode) { + Assertions.assertTrue(Stat.S_ISSOCK.test(mode)); + } + } - public static Stream provideDataForToggle() { - return Stream.of( - Arguments.arguments(S_IFDIR, S_IFDIR, true), // - Arguments.arguments(S_IFDIR, S_IFDIR, false), // - Arguments.arguments(0, S_IFDIR, true), // - Arguments.arguments(0, S_IFDIR, false) - ); + @Nested + @DisplayName("permissions") + public class Permissions { + + @DisplayName("getPermissions()") + @ParameterizedTest(name = "getPermissions({0}) == {1}") + @CsvSource(value = { + "0755,rwxr-xr-x", + "0644,rw-r--r--", + "0010644,rw-r--r--" + }) + public void getPermissions(String mode, String perms) { + Mockito.when(stat.getMode()).thenReturn(Integer.valueOf(mode, 8)); + var expected = PosixFilePermissions.fromString(perms); + + var result = stat.getPermissions(); + + Assertions.assertEquals(expected, result); + } + + @DisplayName("setPermissions()") + @ParameterizedTest(name = "setPermissions({1}) == {0}") + @CsvSource(value = { + "0755,rwxr-xr-x", + "0644,rw-r--r--", + }) + public void setPermissions(String mode, String perms) { + Mockito.when(stat.getMode()).thenReturn(S_IFDIR); + var permissions = PosixFilePermissions.fromString(perms); + + stat.setPermissions(permissions); + + Mockito.verify(stat).setMode(S_IFDIR | Integer.valueOf(mode, 8)); + } + } @ParameterizedTest @ValueSource(booleans = {true, false}) public void testHasMode(boolean isPresent) { Mockito.when(stat.getMode()).thenReturn(isPresent ? MAGIC : ~MAGIC); + boolean result = stat.hasMode(MAGIC); + Assertions.assertEquals(isPresent, result); } - @Test - public void testIsDir() { - stat.isDir(); - Mockito.verify(stat).hasMode(S_IFDIR); - } - - @ParameterizedTest - @ValueSource(booleans = {true, false}) - public void testToggleDir(boolean isDir) { - stat.toggleDir(isDir); - Mockito.verify(stat).toggleMode(S_IFDIR, isDir); - } + @DisplayName("setModeBits()") + public void testSetModeBits() { + Mockito.when(stat.getMode()).thenReturn(0755); - @Test - public void testIsReg() { - stat.isReg(); - Mockito.verify(stat).hasMode(S_IFREG); - } + stat.setModeBits(S_IFDIR); - @ParameterizedTest - @ValueSource(booleans = {true, false}) - public void testToggleReg(boolean isReg) { - stat.toggleReg(isReg); - Mockito.verify(stat).toggleMode(S_IFREG, isReg); + Mockito.verify(stat).setMode(S_IFDIR | 0755); } @Test - public void testIsLnk() { - stat.isLnk(); - Mockito.verify(stat).hasMode(S_IFLNK); - } + @DisplayName("unsetModeBits()") + public void testUnsetModeBits() { + Mockito.when(stat.getMode()).thenReturn(S_IFDIR | 0755); - @ParameterizedTest - @ValueSource(booleans = {true, false}) - public void testToggleLnk(boolean isLnk) { - stat.toggleLnk(isLnk); - Mockito.verify(stat).toggleMode(S_IFLNK, isLnk); - } + stat.unsetModeBits(S_IFDIR); - private static ArgumentMatcher hasBitsSet(int mask) { - return toMatch -> (toMatch & mask) == mask; + Mockito.verify(stat).setMode(0755); } - private static ArgumentMatcher hasBitsNotSet(int mask) { - return toMatch -> (toMatch & mask) == 0; - } - - - private class StubStatImpl implements Stat { + private static class StubStatImpl implements Stat { @Override public TimeSpec aTime() { diff --git a/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java b/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java index 1eb78c62..16458027 100644 --- a/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java +++ b/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java @@ -194,12 +194,12 @@ protected void copyAttrsToStat(BasicFileAttributes attrs, Stat stat) { stat.setSize(attrs.size()); stat.setNLink((short) 1); if (attrs.isDirectory()) { - stat.toggleDir(true); + stat.setModeBits(Stat.S_IFDIR); stat.setNLink((short) 2); // quick and dirty implementation. should really be 2 + subdir count } else if (attrs.isSymbolicLink()) { - stat.toggleLnk(true); - } else if (attrs.isRegularFile()){ - stat.toggleReg(true); + stat.setModeBits(Stat.S_IFLNK); + } else if (attrs.isRegularFile()) { + stat.setModeBits(Stat.S_IFREG); } stat.aTime().set(attrs.lastAccessTime().toInstant()); stat.mTime().set(attrs.lastModifiedTime().toInstant()); From 4fc106c340bfbfe87a0aa5995d832a14196885ee Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Fri, 7 Oct 2022 16:48:04 +0200 Subject: [PATCH 09/41] renamed parent module and always build all os-specific modules --- jfuse-api/pom.xml | 2 +- jfuse-examples/pom.xml | 2 +- jfuse-linux-aarch64/pom.xml | 2 +- jfuse-linux-amd64/pom.xml | 2 +- jfuse-mac/pom.xml | 2 +- jfuse-tests/pom.xml | 2 +- jfuse-win-amd64/pom.xml | 2 +- pom.xml | 60 ++++--------------------------------- 8 files changed, 13 insertions(+), 61 deletions(-) diff --git a/jfuse-api/pom.xml b/jfuse-api/pom.xml index 4807c61e..7da42d19 100644 --- a/jfuse-api/pom.xml +++ b/jfuse-api/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.cryptomator - jfuse + jfuse-parent 0.3.0-SNAPSHOT 4.0.0 diff --git a/jfuse-examples/pom.xml b/jfuse-examples/pom.xml index cdd0b1bd..eaae883b 100644 --- a/jfuse-examples/pom.xml +++ b/jfuse-examples/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.cryptomator - jfuse + jfuse-parent 0.3.0-SNAPSHOT 4.0.0 diff --git a/jfuse-linux-aarch64/pom.xml b/jfuse-linux-aarch64/pom.xml index b25bc516..b6b2f548 100644 --- a/jfuse-linux-aarch64/pom.xml +++ b/jfuse-linux-aarch64/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - jfuse + jfuse-parent org.cryptomator 0.3.0-SNAPSHOT diff --git a/jfuse-linux-amd64/pom.xml b/jfuse-linux-amd64/pom.xml index f30d0fa8..e999e79f 100644 --- a/jfuse-linux-amd64/pom.xml +++ b/jfuse-linux-amd64/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.cryptomator - jfuse + jfuse-parent 0.3.0-SNAPSHOT 4.0.0 diff --git a/jfuse-mac/pom.xml b/jfuse-mac/pom.xml index fb006e51..344b4cab 100644 --- a/jfuse-mac/pom.xml +++ b/jfuse-mac/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.cryptomator - jfuse + jfuse-parent 0.3.0-SNAPSHOT 4.0.0 diff --git a/jfuse-tests/pom.xml b/jfuse-tests/pom.xml index d1c11ed7..3d237745 100644 --- a/jfuse-tests/pom.xml +++ b/jfuse-tests/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.cryptomator - jfuse + jfuse-parent 0.3.0-SNAPSHOT 4.0.0 diff --git a/jfuse-win-amd64/pom.xml b/jfuse-win-amd64/pom.xml index 82665348..48eb4d04 100644 --- a/jfuse-win-amd64/pom.xml +++ b/jfuse-win-amd64/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> org.cryptomator - jfuse + jfuse-parent 0.3.0-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index 6029b14f..bff01380 100644 --- a/pom.xml +++ b/pom.xml @@ -4,10 +4,10 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.cryptomator - jfuse + jfuse-parent pom 0.3.0-SNAPSHOT - jFUSE + jFUSE Parent Java bindings for FUSE using foreign functions & memory API https://github.com/cryptomator/jfuse @@ -43,6 +43,10 @@ jfuse-api + jfuse-linux-aarch64 + jfuse-linux-amd64 + jfuse-mac + jfuse-win-amd64 @@ -192,58 +196,6 @@ - - mac - - - mac - - - - jfuse-mac - - - - - linux-amd64 - - - unix - linux - amd64 - - - - jfuse-linux-amd64 - - - - - linux-aarch64 - - - unix - linux - aarch64 - - - - jfuse-linux-aarch64 - - - - - win-amd64 - - - windows - amd64 - - - - jfuse-win-amd64 - - test From 180f8754dc142a6cd89aa8d0a53913971e6a676c Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Fri, 7 Oct 2022 16:48:43 +0200 Subject: [PATCH 10/41] add aggregator module and make examples/test depend on it --- jfuse-examples/pom.xml | 74 +---------------- jfuse-examples/src/main/java/module-info.java | 2 +- jfuse-tests/pom.xml | 63 +-------------- jfuse/pom.xml | 79 +++++++++++++++++++ jfuse/src/main/java/module-info.java | 10 +++ pom.xml | 6 ++ 6 files changed, 98 insertions(+), 136 deletions(-) create mode 100644 jfuse/pom.xml create mode 100644 jfuse/src/main/java/module-info.java diff --git a/jfuse-examples/pom.xml b/jfuse-examples/pom.xml index eaae883b..2f0b414c 100644 --- a/jfuse-examples/pom.xml +++ b/jfuse-examples/pom.xml @@ -18,7 +18,7 @@ org.cryptomator - jfuse-api + jfuse ${project.version} @@ -28,78 +28,6 @@ - - - mac - - - mac - x86_64 - - - - - org.cryptomator - jfuse-mac - ${project.version} - - - - - - linux-amd64 - - - unix - linux - amd64 - - - - - org.cryptomator - jfuse-linux-amd64 - ${project.version} - - - - - - linux-aarch64 - - - unix - linux - aarch64 - - - - - org.cryptomator - jfuse-linux-aarch64 - ${project.version} - - - - - - win-amd64 - - - windows - amd64 - - - - - org.cryptomator - jfuse-win-amd64 - ${project.version} - - - - - diff --git a/jfuse-examples/src/main/java/module-info.java b/jfuse-examples/src/main/java/module-info.java index cb9c2738..e9a63820 100644 --- a/jfuse-examples/src/main/java/module-info.java +++ b/jfuse-examples/src/main/java/module-info.java @@ -1,4 +1,4 @@ module org.cryptomator.jfuse.examples { - requires org.cryptomator.jfuse.api; + requires org.cryptomator.jfuse; requires org.slf4j; } \ No newline at end of file diff --git a/jfuse-tests/pom.xml b/jfuse-tests/pom.xml index 3d237745..e619caf4 100644 --- a/jfuse-tests/pom.xml +++ b/jfuse-tests/pom.xml @@ -19,7 +19,7 @@ org.cryptomator - jfuse-api + jfuse ${project.version} @@ -126,72 +126,11 @@ mac - x86_64 /usr/local/lib - - - org.cryptomator - jfuse-mac - ${project.version} - - - - - - linux-amd64 - - - unix - linux - amd64 - - - - - org.cryptomator - jfuse-linux-amd64 - ${project.version} - - - - - - linux-aarch64 - - - unix - linux - aarch64 - - - - - org.cryptomator - jfuse-linux-aarch64 - ${project.version} - - - - - - win-amd64 - - - windows - amd64 - - - - - org.cryptomator - jfuse-win-amd64 - ${project.version} - - diff --git a/jfuse/pom.xml b/jfuse/pom.xml new file mode 100644 index 00000000..c17a7ea5 --- /dev/null +++ b/jfuse/pom.xml @@ -0,0 +1,79 @@ + + + + org.cryptomator + jfuse-parent + 0.3.0-SNAPSHOT + + 4.0.0 + jfuse + jFUSE + Java bindings for FUSE using foreign functions & memory API + https://github.com/cryptomator/jfuse/ + + + + org.cryptomator + jfuse-api + ${project.version} + + + org.cryptomator + jfuse-linux-aarch64 + ${project.version} + + + org.cryptomator + jfuse-linux-amd64 + ${project.version} + + + org.cryptomator + jfuse-mac + ${project.version} + + + org.cryptomator + jfuse-win-amd64 + ${project.version} + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + true + + + + org.apache.maven.plugins + maven-jar-plugin + + + default-jar + package + + jar + + + + javadoc-jar + package + + jar + + + javadoc + + + + + + + + \ No newline at end of file diff --git a/jfuse/src/main/java/module-info.java b/jfuse/src/main/java/module-info.java new file mode 100644 index 00000000..0279440b --- /dev/null +++ b/jfuse/src/main/java/module-info.java @@ -0,0 +1,10 @@ +/** + * Defines the API to create a FUSE file system in Java. + */ +module org.cryptomator.jfuse { + requires transitive org.cryptomator.jfuse.api; + requires org.cryptomator.jfuse.linux.aarch64; + requires org.cryptomator.jfuse.linux.amd64; + requires org.cryptomator.jfuse.mac; + requires org.cryptomator.jfuse.win.amd64; +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index bff01380..32bcc1d1 100644 --- a/pom.xml +++ b/pom.xml @@ -47,6 +47,7 @@ jfuse-linux-amd64 jfuse-mac jfuse-win-amd64 + jfuse @@ -101,6 +102,11 @@ maven-gpg-plugin 3.0.1 + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + org.apache.maven.plugins maven-source-plugin From 54beafd3d9c0d6aa6f4d847e22cfa107bfbcc172 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 11 Oct 2022 21:33:14 +0200 Subject: [PATCH 11/41] update usage instructions: use aggregate jar --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 2405876e..6a7cf439 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,14 @@ Not all [`fuse_operations`](https://libfuse.github.io/doxygen/structfuse__operat Usage examples can be found under [`/jfuse-examples/`](jfuse-examples). You basically need to implement `FuseOperations` and pass it to the `Fuse.builder()`: +```xml + + org.cryptomator + jfuse + x.y.z + +``` + ```java var builder = Fuse.builder(); var fs = new MyFileSystem(builder.errno()); From 090efd0c28547bac1781bb596cddb1010c041b42 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 11 Oct 2022 23:11:07 +0200 Subject: [PATCH 12/41] add some inline documentation [ci skip] --- jfuse/pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jfuse/pom.xml b/jfuse/pom.xml index 13b19ba6..a03b43d4 100644 --- a/jfuse/pom.xml +++ b/jfuse/pom.xml @@ -47,6 +47,7 @@ org.apache.maven.plugins maven-javadoc-plugin + true @@ -62,6 +63,7 @@ + javadoc-jar package From 6299283efb55853500879fe43c6481fb07ced6f2 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 12 Oct 2022 11:34:15 +0200 Subject: [PATCH 13/41] add fuse_config impl to linux-amd64 --- jfuse-linux-amd64/pom.xml | 1 + .../jfuse/linux/amd64/FuseConfigImpl.java | 226 +++++++++ .../jfuse/linux/amd64/FuseImpl.java | 3 +- .../jfuse/linux/amd64/extr/fuse_config.java | 452 ++++++++++++++++++ .../jfuse/linux/amd64/FuseImplTest.java | 5 +- 5 files changed, 684 insertions(+), 3 deletions(-) create mode 100644 jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java create mode 100644 jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/extr/fuse_config.java diff --git a/jfuse-linux-amd64/pom.xml b/jfuse-linux-amd64/pom.xml index 79bdde1f..37ce5e4c 100644 --- a/jfuse-linux-amd64/pom.xml +++ b/jfuse-linux-amd64/pom.xml @@ -114,6 +114,7 @@ statvfs timespec fuse_conn_info + fuse_config fuse_args fuse_loop_config diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java new file mode 100644 index 00000000..d9a19ebd --- /dev/null +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java @@ -0,0 +1,226 @@ +package org.cryptomator.jfuse.linux.amd64; + +import org.cryptomator.jfuse.api.FuseConfig; +import org.cryptomator.jfuse.linux.amd64.extr.fuse_config; + +import java.lang.foreign.MemoryAddress; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.MemorySession; + +record FuseConfigImpl(MemorySegment segment) implements FuseConfig { + + public FuseConfigImpl(MemoryAddress address, MemorySession scope) { + this(fuse_config.ofAddress(address, scope)); + } + + @Override + public int getSetGid() { + return fuse_config.set_gid$get(segment); + } + + @Override + public void setSetGid(int setGid) { + fuse_config.set_gid$set(segment, setGid); + } + + @Override + public int gid() { + return fuse_config.gid$get(segment); + } + + @Override + public void getSetGid(int gid) { + fuse_config.gid$set(segment, gid); + } + + @Override + public int getSetUid() { + return fuse_config.set_uid$get(segment); + } + + @Override + public void setSetUid(int setUid) { + fuse_config.set_uid$set(segment, setUid); + } + + @Override + public int uid() { + return fuse_config.uid$get(segment); + } + + @Override + public void getSetUid(int uid) { + fuse_config.uid$set(segment, uid); + } + + @Override + public int getSetMode() { + return fuse_config.set_mode$get(segment); + } + + @Override + public void setSetMode(int setMode) { + fuse_config.set_mode$set(segment, setMode); + } + + @Override + public int umask() { + return fuse_config.umask$get(segment); + } + + @Override + public void setUmask(int umask) { + fuse_config.uid$set(segment, umask); + } + + @Override + public double entryTimeout() { + return fuse_config.entry_timeout$get(segment); + } + + @Override + public void setEntryTimeout(double entryTimeout) { + fuse_config.entry_timeout$set(segment, entryTimeout); + } + + @Override + public double negativeTimeout() { + return fuse_config.negative_timeout$get(segment); + } + + @Override + public void setNegativeTimeout(double negativeTimeout) { + fuse_config.negative_timeout$set(segment, negativeTimeout); + } + + @Override + public double attrTimeout() { + return fuse_config.attr_timeout$get(segment); + } + + @Override + public void setAttrTimeout(double attrTimeout) { + fuse_config.attr_timeout$set(segment, attrTimeout); + } + + @Override + public int intr() { + return fuse_config.intr$get(segment); + } + + @Override + public void setIntr(int intr) { + fuse_config.intr$set(segment, intr); + } + + @Override + public int intrSignal() { + return fuse_config.intr_signal$get(segment); + } + + @Override + public void setIntrSignal(int intrSignal) { + fuse_config.intr_signal$set(segment, intrSignal); + } + + @Override + public int remember() { + return fuse_config.remember$get(segment); + } + + @Override + public void setRemember(int secondsToRemember) { + fuse_config.remember$set(segment, secondsToRemember); + } + + @Override + public int hardRemove() { + return fuse_config.hard_remove$get(segment); + } + + @Override + public void setHardRemove(int hardRemove) { + fuse_config.hard_remove$set(segment, hardRemove); + } + + @Override + public int useIno() { + return fuse_config.use_ino$get(segment); + } + + @Override + public void setUseIno(int useIno) { + fuse_config.use_ino$set(segment, useIno); + } + + @Override + public int readdirIno() { + return fuse_config.readdir_ino$get(segment); + } + + @Override + public void setReaddirIno(int readdirIno) { + fuse_config.readdir_ino$set(segment, readdirIno); + } + + @Override + public int directIo() { + return fuse_config.direct_io$get(segment); + } + + @Override + public void setDirectIo(int directIo) { + fuse_config.direct_io$set(segment, directIo); + } + + @Override + public int kernelCache() { + return fuse_config.kernel_cache$get(segment); + } + + @Override + public void setKernelCache(int kernelCache) { + fuse_config.kernel_cache$set(segment, kernelCache); + } + + @Override + public int autoCache() { + return fuse_config.auto_cache$get(segment); + } + + @Override + public void setAutoCache(int autoCache) { + fuse_config.auto_cache$set(segment, autoCache); + } + + @Override + public int acAttrTimeoutSet() { + return fuse_config.ac_attr_timeout_set$get(segment); + } + + @Override + public void setAcAttrTimeoutSet(int acAttrTimeoutSet) { + fuse_config.ac_attr_timeout_set$set(segment, acAttrTimeoutSet); + } + + @Override + public double acAttrTimeout() { + return fuse_config.ac_attr_timeout$get(segment); + } + + @Override + public void setAcAttrTimeout(double acAttrTimeout) { + fuse_config.ac_attr_timeout$set(segment, acAttrTimeout); + } + + @Override + public int nullpathOk() { + return fuse_config.nullpath_ok$get(segment); + } + + @Override + public void setNullpathOk(int nullpathOk) { + fuse_config.nullpath_ok$set(segment, nullpathOk); + } + +} diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java index 15c1e462..2221ea4b 100644 --- a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java @@ -104,7 +104,8 @@ Addressable init(MemoryAddress conn, MemoryAddress cfg) { try (var scope = MemorySession.openConfined()) { var connInfo = new FuseConnInfoImpl(conn, scope); connInfo.setWant(connInfo.want() | FuseConnInfo.FUSE_CAP_READDIRPLUS); - delegate.init(connInfo, null); + var config = new FuseConfigImpl(cfg, scope); + delegate.init(connInfo, config); } return MemoryAddress.NULL; } diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/extr/fuse_config.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/extr/fuse_config.java new file mode 100644 index 00000000..e73e46a8 --- /dev/null +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/extr/fuse_config.java @@ -0,0 +1,452 @@ +// Generated by jextract + +package org.cryptomator.jfuse.linux.amd64.extr; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import java.lang.foreign.*; +import static java.lang.foreign.ValueLayout.*; +public class fuse_config { + + static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( + Constants$root.C_INT$LAYOUT.withName("set_gid"), + Constants$root.C_INT$LAYOUT.withName("gid"), + Constants$root.C_INT$LAYOUT.withName("set_uid"), + Constants$root.C_INT$LAYOUT.withName("uid"), + Constants$root.C_INT$LAYOUT.withName("set_mode"), + Constants$root.C_INT$LAYOUT.withName("umask"), + Constants$root.C_DOUBLE$LAYOUT.withName("entry_timeout"), + Constants$root.C_DOUBLE$LAYOUT.withName("negative_timeout"), + Constants$root.C_DOUBLE$LAYOUT.withName("attr_timeout"), + Constants$root.C_INT$LAYOUT.withName("intr"), + Constants$root.C_INT$LAYOUT.withName("intr_signal"), + Constants$root.C_INT$LAYOUT.withName("remember"), + Constants$root.C_INT$LAYOUT.withName("hard_remove"), + Constants$root.C_INT$LAYOUT.withName("use_ino"), + Constants$root.C_INT$LAYOUT.withName("readdir_ino"), + Constants$root.C_INT$LAYOUT.withName("direct_io"), + Constants$root.C_INT$LAYOUT.withName("kernel_cache"), + Constants$root.C_INT$LAYOUT.withName("auto_cache"), + Constants$root.C_INT$LAYOUT.withName("no_rofd_flush"), + Constants$root.C_INT$LAYOUT.withName("ac_attr_timeout_set"), + MemoryLayout.paddingLayout(32), + Constants$root.C_DOUBLE$LAYOUT.withName("ac_attr_timeout"), + Constants$root.C_INT$LAYOUT.withName("nullpath_ok"), + Constants$root.C_INT$LAYOUT.withName("show_help"), + Constants$root.C_POINTER$LAYOUT.withName("modules"), + Constants$root.C_INT$LAYOUT.withName("debug"), + MemoryLayout.paddingLayout(32) + ).withName("fuse_config"); + public static MemoryLayout $LAYOUT() { + return fuse_config.$struct$LAYOUT; + } + static final VarHandle set_gid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("set_gid")); + public static VarHandle set_gid$VH() { + return fuse_config.set_gid$VH; + } + public static int set_gid$get(MemorySegment seg) { + return (int)fuse_config.set_gid$VH.get(seg); + } + public static void set_gid$set( MemorySegment seg, int x) { + fuse_config.set_gid$VH.set(seg, x); + } + public static int set_gid$get(MemorySegment seg, long index) { + return (int)fuse_config.set_gid$VH.get(seg.asSlice(index*sizeof())); + } + public static void set_gid$set(MemorySegment seg, long index, int x) { + fuse_config.set_gid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle gid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("gid")); + public static VarHandle gid$VH() { + return fuse_config.gid$VH; + } + public static int gid$get(MemorySegment seg) { + return (int)fuse_config.gid$VH.get(seg); + } + public static void gid$set( MemorySegment seg, int x) { + fuse_config.gid$VH.set(seg, x); + } + public static int gid$get(MemorySegment seg, long index) { + return (int)fuse_config.gid$VH.get(seg.asSlice(index*sizeof())); + } + public static void gid$set(MemorySegment seg, long index, int x) { + fuse_config.gid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle set_uid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("set_uid")); + public static VarHandle set_uid$VH() { + return fuse_config.set_uid$VH; + } + public static int set_uid$get(MemorySegment seg) { + return (int)fuse_config.set_uid$VH.get(seg); + } + public static void set_uid$set( MemorySegment seg, int x) { + fuse_config.set_uid$VH.set(seg, x); + } + public static int set_uid$get(MemorySegment seg, long index) { + return (int)fuse_config.set_uid$VH.get(seg.asSlice(index*sizeof())); + } + public static void set_uid$set(MemorySegment seg, long index, int x) { + fuse_config.set_uid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle uid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("uid")); + public static VarHandle uid$VH() { + return fuse_config.uid$VH; + } + public static int uid$get(MemorySegment seg) { + return (int)fuse_config.uid$VH.get(seg); + } + public static void uid$set( MemorySegment seg, int x) { + fuse_config.uid$VH.set(seg, x); + } + public static int uid$get(MemorySegment seg, long index) { + return (int)fuse_config.uid$VH.get(seg.asSlice(index*sizeof())); + } + public static void uid$set(MemorySegment seg, long index, int x) { + fuse_config.uid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle set_mode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("set_mode")); + public static VarHandle set_mode$VH() { + return fuse_config.set_mode$VH; + } + public static int set_mode$get(MemorySegment seg) { + return (int)fuse_config.set_mode$VH.get(seg); + } + public static void set_mode$set( MemorySegment seg, int x) { + fuse_config.set_mode$VH.set(seg, x); + } + public static int set_mode$get(MemorySegment seg, long index) { + return (int)fuse_config.set_mode$VH.get(seg.asSlice(index*sizeof())); + } + public static void set_mode$set(MemorySegment seg, long index, int x) { + fuse_config.set_mode$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle umask$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("umask")); + public static VarHandle umask$VH() { + return fuse_config.umask$VH; + } + public static int umask$get(MemorySegment seg) { + return (int)fuse_config.umask$VH.get(seg); + } + public static void umask$set( MemorySegment seg, int x) { + fuse_config.umask$VH.set(seg, x); + } + public static int umask$get(MemorySegment seg, long index) { + return (int)fuse_config.umask$VH.get(seg.asSlice(index*sizeof())); + } + public static void umask$set(MemorySegment seg, long index, int x) { + fuse_config.umask$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle entry_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("entry_timeout")); + public static VarHandle entry_timeout$VH() { + return fuse_config.entry_timeout$VH; + } + public static double entry_timeout$get(MemorySegment seg) { + return (double)fuse_config.entry_timeout$VH.get(seg); + } + public static void entry_timeout$set( MemorySegment seg, double x) { + fuse_config.entry_timeout$VH.set(seg, x); + } + public static double entry_timeout$get(MemorySegment seg, long index) { + return (double)fuse_config.entry_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void entry_timeout$set(MemorySegment seg, long index, double x) { + fuse_config.entry_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle negative_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("negative_timeout")); + public static VarHandle negative_timeout$VH() { + return fuse_config.negative_timeout$VH; + } + public static double negative_timeout$get(MemorySegment seg) { + return (double)fuse_config.negative_timeout$VH.get(seg); + } + public static void negative_timeout$set( MemorySegment seg, double x) { + fuse_config.negative_timeout$VH.set(seg, x); + } + public static double negative_timeout$get(MemorySegment seg, long index) { + return (double)fuse_config.negative_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void negative_timeout$set(MemorySegment seg, long index, double x) { + fuse_config.negative_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle attr_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("attr_timeout")); + public static VarHandle attr_timeout$VH() { + return fuse_config.attr_timeout$VH; + } + public static double attr_timeout$get(MemorySegment seg) { + return (double)fuse_config.attr_timeout$VH.get(seg); + } + public static void attr_timeout$set( MemorySegment seg, double x) { + fuse_config.attr_timeout$VH.set(seg, x); + } + public static double attr_timeout$get(MemorySegment seg, long index) { + return (double)fuse_config.attr_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void attr_timeout$set(MemorySegment seg, long index, double x) { + fuse_config.attr_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle intr$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("intr")); + public static VarHandle intr$VH() { + return fuse_config.intr$VH; + } + public static int intr$get(MemorySegment seg) { + return (int)fuse_config.intr$VH.get(seg); + } + public static void intr$set( MemorySegment seg, int x) { + fuse_config.intr$VH.set(seg, x); + } + public static int intr$get(MemorySegment seg, long index) { + return (int)fuse_config.intr$VH.get(seg.asSlice(index*sizeof())); + } + public static void intr$set(MemorySegment seg, long index, int x) { + fuse_config.intr$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle intr_signal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("intr_signal")); + public static VarHandle intr_signal$VH() { + return fuse_config.intr_signal$VH; + } + public static int intr_signal$get(MemorySegment seg) { + return (int)fuse_config.intr_signal$VH.get(seg); + } + public static void intr_signal$set( MemorySegment seg, int x) { + fuse_config.intr_signal$VH.set(seg, x); + } + public static int intr_signal$get(MemorySegment seg, long index) { + return (int)fuse_config.intr_signal$VH.get(seg.asSlice(index*sizeof())); + } + public static void intr_signal$set(MemorySegment seg, long index, int x) { + fuse_config.intr_signal$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle remember$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("remember")); + public static VarHandle remember$VH() { + return fuse_config.remember$VH; + } + public static int remember$get(MemorySegment seg) { + return (int)fuse_config.remember$VH.get(seg); + } + public static void remember$set( MemorySegment seg, int x) { + fuse_config.remember$VH.set(seg, x); + } + public static int remember$get(MemorySegment seg, long index) { + return (int)fuse_config.remember$VH.get(seg.asSlice(index*sizeof())); + } + public static void remember$set(MemorySegment seg, long index, int x) { + fuse_config.remember$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle hard_remove$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hard_remove")); + public static VarHandle hard_remove$VH() { + return fuse_config.hard_remove$VH; + } + public static int hard_remove$get(MemorySegment seg) { + return (int)fuse_config.hard_remove$VH.get(seg); + } + public static void hard_remove$set( MemorySegment seg, int x) { + fuse_config.hard_remove$VH.set(seg, x); + } + public static int hard_remove$get(MemorySegment seg, long index) { + return (int)fuse_config.hard_remove$VH.get(seg.asSlice(index*sizeof())); + } + public static void hard_remove$set(MemorySegment seg, long index, int x) { + fuse_config.hard_remove$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle use_ino$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("use_ino")); + public static VarHandle use_ino$VH() { + return fuse_config.use_ino$VH; + } + public static int use_ino$get(MemorySegment seg) { + return (int)fuse_config.use_ino$VH.get(seg); + } + public static void use_ino$set( MemorySegment seg, int x) { + fuse_config.use_ino$VH.set(seg, x); + } + public static int use_ino$get(MemorySegment seg, long index) { + return (int)fuse_config.use_ino$VH.get(seg.asSlice(index*sizeof())); + } + public static void use_ino$set(MemorySegment seg, long index, int x) { + fuse_config.use_ino$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle readdir_ino$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("readdir_ino")); + public static VarHandle readdir_ino$VH() { + return fuse_config.readdir_ino$VH; + } + public static int readdir_ino$get(MemorySegment seg) { + return (int)fuse_config.readdir_ino$VH.get(seg); + } + public static void readdir_ino$set( MemorySegment seg, int x) { + fuse_config.readdir_ino$VH.set(seg, x); + } + public static int readdir_ino$get(MemorySegment seg, long index) { + return (int)fuse_config.readdir_ino$VH.get(seg.asSlice(index*sizeof())); + } + public static void readdir_ino$set(MemorySegment seg, long index, int x) { + fuse_config.readdir_ino$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle direct_io$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("direct_io")); + public static VarHandle direct_io$VH() { + return fuse_config.direct_io$VH; + } + public static int direct_io$get(MemorySegment seg) { + return (int)fuse_config.direct_io$VH.get(seg); + } + public static void direct_io$set( MemorySegment seg, int x) { + fuse_config.direct_io$VH.set(seg, x); + } + public static int direct_io$get(MemorySegment seg, long index) { + return (int)fuse_config.direct_io$VH.get(seg.asSlice(index*sizeof())); + } + public static void direct_io$set(MemorySegment seg, long index, int x) { + fuse_config.direct_io$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle kernel_cache$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("kernel_cache")); + public static VarHandle kernel_cache$VH() { + return fuse_config.kernel_cache$VH; + } + public static int kernel_cache$get(MemorySegment seg) { + return (int)fuse_config.kernel_cache$VH.get(seg); + } + public static void kernel_cache$set( MemorySegment seg, int x) { + fuse_config.kernel_cache$VH.set(seg, x); + } + public static int kernel_cache$get(MemorySegment seg, long index) { + return (int)fuse_config.kernel_cache$VH.get(seg.asSlice(index*sizeof())); + } + public static void kernel_cache$set(MemorySegment seg, long index, int x) { + fuse_config.kernel_cache$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle auto_cache$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("auto_cache")); + public static VarHandle auto_cache$VH() { + return fuse_config.auto_cache$VH; + } + public static int auto_cache$get(MemorySegment seg) { + return (int)fuse_config.auto_cache$VH.get(seg); + } + public static void auto_cache$set( MemorySegment seg, int x) { + fuse_config.auto_cache$VH.set(seg, x); + } + public static int auto_cache$get(MemorySegment seg, long index) { + return (int)fuse_config.auto_cache$VH.get(seg.asSlice(index*sizeof())); + } + public static void auto_cache$set(MemorySegment seg, long index, int x) { + fuse_config.auto_cache$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle no_rofd_flush$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("no_rofd_flush")); + public static VarHandle no_rofd_flush$VH() { + return fuse_config.no_rofd_flush$VH; + } + public static int no_rofd_flush$get(MemorySegment seg) { + return (int)fuse_config.no_rofd_flush$VH.get(seg); + } + public static void no_rofd_flush$set( MemorySegment seg, int x) { + fuse_config.no_rofd_flush$VH.set(seg, x); + } + public static int no_rofd_flush$get(MemorySegment seg, long index) { + return (int)fuse_config.no_rofd_flush$VH.get(seg.asSlice(index*sizeof())); + } + public static void no_rofd_flush$set(MemorySegment seg, long index, int x) { + fuse_config.no_rofd_flush$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle ac_attr_timeout_set$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ac_attr_timeout_set")); + public static VarHandle ac_attr_timeout_set$VH() { + return fuse_config.ac_attr_timeout_set$VH; + } + public static int ac_attr_timeout_set$get(MemorySegment seg) { + return (int)fuse_config.ac_attr_timeout_set$VH.get(seg); + } + public static void ac_attr_timeout_set$set( MemorySegment seg, int x) { + fuse_config.ac_attr_timeout_set$VH.set(seg, x); + } + public static int ac_attr_timeout_set$get(MemorySegment seg, long index) { + return (int)fuse_config.ac_attr_timeout_set$VH.get(seg.asSlice(index*sizeof())); + } + public static void ac_attr_timeout_set$set(MemorySegment seg, long index, int x) { + fuse_config.ac_attr_timeout_set$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle ac_attr_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ac_attr_timeout")); + public static VarHandle ac_attr_timeout$VH() { + return fuse_config.ac_attr_timeout$VH; + } + public static double ac_attr_timeout$get(MemorySegment seg) { + return (double)fuse_config.ac_attr_timeout$VH.get(seg); + } + public static void ac_attr_timeout$set( MemorySegment seg, double x) { + fuse_config.ac_attr_timeout$VH.set(seg, x); + } + public static double ac_attr_timeout$get(MemorySegment seg, long index) { + return (double)fuse_config.ac_attr_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void ac_attr_timeout$set(MemorySegment seg, long index, double x) { + fuse_config.ac_attr_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle nullpath_ok$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("nullpath_ok")); + public static VarHandle nullpath_ok$VH() { + return fuse_config.nullpath_ok$VH; + } + public static int nullpath_ok$get(MemorySegment seg) { + return (int)fuse_config.nullpath_ok$VH.get(seg); + } + public static void nullpath_ok$set( MemorySegment seg, int x) { + fuse_config.nullpath_ok$VH.set(seg, x); + } + public static int nullpath_ok$get(MemorySegment seg, long index) { + return (int)fuse_config.nullpath_ok$VH.get(seg.asSlice(index*sizeof())); + } + public static void nullpath_ok$set(MemorySegment seg, long index, int x) { + fuse_config.nullpath_ok$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle show_help$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("show_help")); + public static VarHandle show_help$VH() { + return fuse_config.show_help$VH; + } + public static int show_help$get(MemorySegment seg) { + return (int)fuse_config.show_help$VH.get(seg); + } + public static void show_help$set( MemorySegment seg, int x) { + fuse_config.show_help$VH.set(seg, x); + } + public static int show_help$get(MemorySegment seg, long index) { + return (int)fuse_config.show_help$VH.get(seg.asSlice(index*sizeof())); + } + public static void show_help$set(MemorySegment seg, long index, int x) { + fuse_config.show_help$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle modules$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("modules")); + public static VarHandle modules$VH() { + return fuse_config.modules$VH; + } + public static MemoryAddress modules$get(MemorySegment seg) { + return (java.lang.foreign.MemoryAddress)fuse_config.modules$VH.get(seg); + } + public static void modules$set( MemorySegment seg, MemoryAddress x) { + fuse_config.modules$VH.set(seg, x); + } + public static MemoryAddress modules$get(MemorySegment seg, long index) { + return (java.lang.foreign.MemoryAddress)fuse_config.modules$VH.get(seg.asSlice(index*sizeof())); + } + public static void modules$set(MemorySegment seg, long index, MemoryAddress x) { + fuse_config.modules$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle debug$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("debug")); + public static VarHandle debug$VH() { + return fuse_config.debug$VH; + } + public static int debug$get(MemorySegment seg) { + return (int)fuse_config.debug$VH.get(seg); + } + public static void debug$set( MemorySegment seg, int x) { + fuse_config.debug$VH.set(seg, x); + } + public static int debug$get(MemorySegment seg, long index) { + return (int)fuse_config.debug$VH.get(seg.asSlice(index*sizeof())); + } + public static void debug$set(MemorySegment seg, long index, int x) { + fuse_config.debug$VH.set(seg.asSlice(index*sizeof()), x); + } + public static long sizeof() { return $LAYOUT().byteSize(); } + public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } + public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + } + public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } +} + + diff --git a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java index 590a5155..42d68119 100644 --- a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java +++ b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java @@ -4,6 +4,7 @@ import org.cryptomator.jfuse.api.FuseOperations; import org.cryptomator.jfuse.api.MountFailedException; import org.cryptomator.jfuse.api.TimeSpec; +import org.cryptomator.jfuse.linux.amd64.extr.fuse_config; import org.cryptomator.jfuse.linux.amd64.extr.fuse_conn_info; import org.cryptomator.jfuse.linux.amd64.extr.fuse_file_info; import org.cryptomator.jfuse.linux.amd64.extr.fuse_h; @@ -131,9 +132,9 @@ public void testInit() { FuseConnInfo connInfo = invocation.getArgument(0); result.set(connInfo.want()); return null; - }).when(fuseOps).init(Mockito.any()); + }).when(fuseOps).init(Mockito.any(), Mockito.any()); var connInfo = fuse_conn_info.allocate(scope); - var fuseConfig = MemoryAddress.NULL; // TODO jextract fuse_config + var fuseConfig = fuse_config.allocate(scope); fuseImpl.init(connInfo.address(), fuseConfig.address()); From 8758a9b157f89f9b91a40b090b5643e9c0ff5d9a Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 12 Oct 2022 11:42:58 +0200 Subject: [PATCH 14/41] fix naming error in FuseConfig interface --- .../src/main/java/org/cryptomator/jfuse/api/FuseConfig.java | 4 ++-- .../org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java | 4 ++-- .../java/org/cryptomator/jfuse/win/amd64/FuseConfigImpl.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java index 1fd485b0..ee124d5c 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseConfig.java @@ -8,7 +8,7 @@ public interface FuseConfig { int gid(); - void getSetGid(int gid); + void setGid(int gid); int getSetUid(); @@ -16,7 +16,7 @@ public interface FuseConfig { int uid(); - void getSetUid(int uid); + void setUid(int uid); int getSetMode(); diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java index d9a19ebd..0162c463 100644 --- a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java @@ -29,7 +29,7 @@ public int gid() { } @Override - public void getSetGid(int gid) { + public void setGid(int gid) { fuse_config.gid$set(segment, gid); } @@ -49,7 +49,7 @@ public int uid() { } @Override - public void getSetUid(int uid) { + public void setUid(int uid) { fuse_config.uid$set(segment, uid); } diff --git a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseConfigImpl.java b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseConfigImpl.java index 436c5e1a..aed5aec1 100644 --- a/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseConfigImpl.java +++ b/jfuse-win-amd64/src/main/java/org/cryptomator/jfuse/win/amd64/FuseConfigImpl.java @@ -29,7 +29,7 @@ public int gid() { } @Override - public void getSetGid(int gid) { + public void setGid(int gid) { fuse3_config.gid$set(segment, gid); } @@ -49,7 +49,7 @@ public int uid() { } @Override - public void getSetUid(int uid) { + public void setUid(int uid) { fuse3_config.uid$set(segment, uid); } From 911f5ddb6180fbf3f26f599b5bc5cee93466d98c Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 12 Oct 2022 12:49:49 +0200 Subject: [PATCH 15/41] add unit tests for fuse config impls --- .../jfuse/linux/amd64/FuseConfigImplTest.java | 161 +++++++++++++++++ .../jfuse/win/amd64/FuseConfigImplTest.java | 162 ++++++++++++++++++ 2 files changed, 323 insertions(+) create mode 100644 jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImplTest.java create mode 100644 jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseConfigImplTest.java diff --git a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImplTest.java b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImplTest.java new file mode 100644 index 00000000..5e790c01 --- /dev/null +++ b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImplTest.java @@ -0,0 +1,161 @@ +package org.cryptomator.jfuse.linux.amd64; + +import org.cryptomator.jfuse.api.FuseConfig; +import org.cryptomator.jfuse.linux.amd64.extr.fuse_config; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Named; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.lang.foreign.MemorySegment; +import java.lang.foreign.MemorySession; +import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.stream.Stream; + +public class FuseConfigImplTest { + + @DisplayName("test getters returning int") + @ParameterizedTest(name = "{1}") + @MethodSource + public void testIntGetters(SetIntInMemorySegment setter, GetIntInConfig getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(segment, 42); + + Assertions.assertEquals(42, getter.apply(connInfo)); + } + } + + public static Stream testIntGetters() { + return Stream.of( + Arguments.arguments((SetIntInMemorySegment) fuse_config::set_gid$set, Named.of("getSetGid()", (GetIntInConfig) FuseConfig::getSetGid)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::gid$set, Named.of("gid()", (GetIntInConfig) FuseConfig::gid)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::set_uid$set, Named.of("getSetUid()", (GetIntInConfig) FuseConfig::getSetUid)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::uid$set, Named.of("uid()", (GetIntInConfig) FuseConfig::uid)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::set_mode$set, Named.of("getSetMode()", (GetIntInConfig) FuseConfig::getSetMode)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::umask$set, Named.of("umask()", (GetIntInConfig) FuseConfig::umask)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::intr$set, Named.of("intr()", (GetIntInConfig) FuseConfig::intr)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::intr_signal$set, Named.of("intrSignal()", (GetIntInConfig) FuseConfig::intrSignal)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::remember$set, Named.of("remember()", (GetIntInConfig) FuseConfig::remember)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::hard_remove$set, Named.of("hardRemove()", (GetIntInConfig) FuseConfig::hardRemove)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::use_ino$set, Named.of("useIno()", (GetIntInConfig) FuseConfig::useIno)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::readdir_ino$set, Named.of("readdirIno()", (GetIntInConfig) FuseConfig::readdirIno)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::direct_io$set, Named.of("directIo()", (GetIntInConfig) FuseConfig::directIo)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::kernel_cache$set, Named.of("kernelCache()", (GetIntInConfig) FuseConfig::kernelCache)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::auto_cache$set, Named.of("autoCache()", (GetIntInConfig) FuseConfig::autoCache)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::ac_attr_timeout_set$set, Named.of("acAtrrTimeoutSet()", (GetIntInConfig) FuseConfig::acAttrTimeoutSet)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::nullpath_ok$set, Named.of("nullpathOk()", (GetIntInConfig) FuseConfig::nullpathOk)) + ); + } + + private interface SetIntInMemorySegment extends BiConsumer { + } + + private interface GetIntInConfig extends Function { + } + + @DisplayName("test getters returning double") + @ParameterizedTest(name = "{1}") + @MethodSource + public void testDoubleGetters(SetDoubleInMemorySegment setter, GetDoubleInConfig getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(segment, 4.2); + + Assertions.assertEquals(4.2, getter.apply(connInfo)); + } + } + + public static Stream testDoubleGetters() { + return Stream.of( + Arguments.arguments((SetDoubleInMemorySegment) fuse_config::entry_timeout$set, Named.of("entryTimeout()", (GetDoubleInConfig) FuseConfig::entryTimeout)), + Arguments.arguments((SetDoubleInMemorySegment) fuse_config::negative_timeout$set, Named.of("negativeTimeout()", (GetDoubleInConfig) FuseConfig::negativeTimeout)), + Arguments.arguments((SetDoubleInMemorySegment) fuse_config::attr_timeout$set, Named.of("attrTimeout()", (GetDoubleInConfig) FuseConfig::attrTimeout)), + Arguments.arguments((SetDoubleInMemorySegment) fuse_config::ac_attr_timeout$set, Named.of("acAttrTimeout()", (GetDoubleInConfig) FuseConfig::acAttrTimeout)) + ); + } + + private interface SetDoubleInMemorySegment extends BiConsumer { + } + + private interface GetDoubleInConfig extends Function { + } + + @DisplayName("test integer setters") + @ParameterizedTest(name = "{0}") + @MethodSource + public void testIntSetters(SetIntInConfig setter, GetIntInMemorySegment getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(connInfo, 42); + + Assertions.assertEquals(42, getter.apply(segment)); + } + } + + public static Stream testIntSetters() { + return Stream.of( + Arguments.arguments(Named.of("setSetGid()", (SetIntInConfig) FuseConfig::setSetGid), (GetIntInMemorySegment) fuse_config::set_gid$get), + Arguments.arguments(Named.of("setGid()", (SetIntInConfig) FuseConfig::setGid), (GetIntInMemorySegment) fuse_config::gid$get), + Arguments.arguments(Named.of("setSetUid()", (SetIntInConfig) FuseConfig::setSetUid), (GetIntInMemorySegment) fuse_config::set_uid$get), + Arguments.arguments(Named.of("setUid()", (SetIntInConfig) FuseConfig::setUid), (GetIntInMemorySegment) fuse_config::uid$get), + Arguments.arguments(Named.of("setSetMode()", (SetIntInConfig) FuseConfig::setSetMode), (GetIntInMemorySegment) fuse_config::set_mode$get), + //Arguments.arguments(Named.of("setUmask()", (SetIntInConfig) FuseConfig::setUmask), (GetIntInMemorySegment) fuse_config::umask$get), + Arguments.arguments(Named.of("setIntr()", (SetIntInConfig) FuseConfig::setIntr), (GetIntInMemorySegment) fuse_config::intr$get), + Arguments.arguments(Named.of("setIntrSignal()", (SetIntInConfig) FuseConfig::setIntrSignal), (GetIntInMemorySegment) fuse_config::intr_signal$get), + Arguments.arguments(Named.of("setRemember()", (SetIntInConfig) FuseConfig::setRemember), (GetIntInMemorySegment) fuse_config::remember$get), + Arguments.arguments(Named.of("setHardRemove()", (SetIntInConfig) FuseConfig::setHardRemove), (GetIntInMemorySegment) fuse_config::hard_remove$get), + Arguments.arguments(Named.of("setUseIno()", (SetIntInConfig) FuseConfig::setUseIno), (GetIntInMemorySegment) fuse_config::use_ino$get), + Arguments.arguments(Named.of("setReaddirIno()", (SetIntInConfig) FuseConfig::setReaddirIno), (GetIntInMemorySegment) fuse_config::readdir_ino$get), + Arguments.arguments(Named.of("setDirectIo()", (SetIntInConfig) FuseConfig::setDirectIo), (GetIntInMemorySegment) fuse_config::direct_io$get), + Arguments.arguments(Named.of("setKernelCache()", (SetIntInConfig) FuseConfig::setKernelCache), (GetIntInMemorySegment) fuse_config::kernel_cache$get), + Arguments.arguments(Named.of("setAutoCache()", (SetIntInConfig) FuseConfig::setAutoCache), (GetIntInMemorySegment) fuse_config::auto_cache$get), + Arguments.arguments(Named.of("setAcAtrrTimeoutSet()", (SetIntInConfig) FuseConfig::setAcAttrTimeoutSet), (GetIntInMemorySegment) fuse_config::ac_attr_timeout_set$get), + Arguments.arguments(Named.of("setNullpathOk()", (SetIntInConfig) FuseConfig::setNullpathOk), (GetIntInMemorySegment) fuse_config::nullpath_ok$get) + ); + } + + private interface SetIntInConfig extends BiConsumer { + } + + private interface GetIntInMemorySegment extends Function { + } + + @DisplayName("test double setters") + @ParameterizedTest(name = "{0}") + @MethodSource + public void testDoubleSetters(SetDoubleInConfig setter, GetDoubleInMemorySegment getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(connInfo, 4.2); + + Assertions.assertEquals(4.2, getter.apply(segment)); + } + } + + public static Stream testDoubleSetters() { + return Stream.of( + Arguments.arguments(Named.of("entryTimeout()", (SetDoubleInConfig) FuseConfig::setEntryTimeout), (GetDoubleInMemorySegment) fuse_config::entry_timeout$get), + Arguments.arguments(Named.of("setNegativeTimeout()", (SetDoubleInConfig) FuseConfig::setNegativeTimeout), (GetDoubleInMemorySegment) fuse_config::negative_timeout$get), + Arguments.arguments(Named.of("setAttrTimeout()", (SetDoubleInConfig) FuseConfig::setAttrTimeout), (GetDoubleInMemorySegment) fuse_config::attr_timeout$get), + Arguments.arguments(Named.of("setAcAttrTimeout()", (SetDoubleInConfig) FuseConfig::setAcAttrTimeout), (GetDoubleInMemorySegment) fuse_config::ac_attr_timeout$get) + ); + } + + private interface SetDoubleInConfig extends BiConsumer { + } + + private interface GetDoubleInMemorySegment extends Function { + } +} diff --git a/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseConfigImplTest.java b/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseConfigImplTest.java new file mode 100644 index 00000000..240bcf94 --- /dev/null +++ b/jfuse-win-amd64/src/test/java/org/cryptomator/jfuse/win/amd64/FuseConfigImplTest.java @@ -0,0 +1,162 @@ +package org.cryptomator.jfuse.win.amd64; + +import org.cryptomator.jfuse.api.FuseConfig; +import org.cryptomator.jfuse.win.amd64.extr.fuse3_config; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Named; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.lang.foreign.MemorySegment; +import java.lang.foreign.MemorySession; +import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.stream.Stream; + +public class FuseConfigImplTest { + + @DisplayName("test getters returning int") + @ParameterizedTest(name = "{1}") + @MethodSource + public void testIntGetters(SetIntInMemorySegment setter, GetIntInConfig getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse3_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(segment, 42); + + Assertions.assertEquals(42, getter.apply(connInfo)); + } + } + + public static Stream testIntGetters() { + return Stream.of( + Arguments.arguments((SetIntInMemorySegment) fuse3_config::set_gid$set, Named.of("getSetGid()", (GetIntInConfig) FuseConfig::getSetGid)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::gid$set, Named.of("gid()", (GetIntInConfig) FuseConfig::gid)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::set_uid$set, Named.of("getSetUid()", (GetIntInConfig) FuseConfig::getSetUid)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::uid$set, Named.of("uid()", (GetIntInConfig) FuseConfig::uid)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::set_mode$set, Named.of("getSetMode()", (GetIntInConfig) FuseConfig::getSetMode)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::umask$set, Named.of("umask()", (GetIntInConfig) FuseConfig::umask)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::intr$set, Named.of("intr()", (GetIntInConfig) FuseConfig::intr)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::intr_signal$set, Named.of("intrSignal()", (GetIntInConfig) FuseConfig::intrSignal)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::remember$set, Named.of("remember()", (GetIntInConfig) FuseConfig::remember)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::hard_remove$set, Named.of("hardRemove()", (GetIntInConfig) FuseConfig::hardRemove)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::use_ino$set, Named.of("useIno()", (GetIntInConfig) FuseConfig::useIno)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::readdir_ino$set, Named.of("readdirIno()", (GetIntInConfig) FuseConfig::readdirIno)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::direct_io$set, Named.of("directIo()", (GetIntInConfig) FuseConfig::directIo)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::kernel_cache$set, Named.of("kernelCache()", (GetIntInConfig) FuseConfig::kernelCache)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::auto_cache$set, Named.of("autoCache()", (GetIntInConfig) FuseConfig::autoCache)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::ac_attr_timeout_set$set, Named.of("acAtrrTimeoutSet()", (GetIntInConfig) FuseConfig::acAttrTimeoutSet)), + Arguments.arguments((SetIntInMemorySegment) fuse3_config::nullpath_ok$set, Named.of("nullpathOk()", (GetIntInConfig) FuseConfig::nullpathOk)) + ); + } + + private interface SetIntInMemorySegment extends BiConsumer { + } + + private interface GetIntInConfig extends Function { + } + + @DisplayName("test getters returning double") + @ParameterizedTest(name = "{1}") + @MethodSource + public void testDoubleGetters(SetDoubleInMemorySegment setter, GetDoubleInConfig getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse3_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(segment, 4.2); + + Assertions.assertEquals(4.2, getter.apply(connInfo)); + } + } + + public static Stream testDoubleGetters() { + return Stream.of( + Arguments.arguments((SetDoubleInMemorySegment) fuse3_config::entry_timeout$set, Named.of("entryTimeout()", (GetDoubleInConfig) FuseConfig::entryTimeout)), + Arguments.arguments((SetDoubleInMemorySegment) fuse3_config::negative_timeout$set, Named.of("negativeTimeout()", (GetDoubleInConfig) FuseConfig::negativeTimeout)), + Arguments.arguments((SetDoubleInMemorySegment) fuse3_config::attr_timeout$set, Named.of("attrTimeout()", (GetDoubleInConfig) FuseConfig::attrTimeout)), + Arguments.arguments((SetDoubleInMemorySegment) fuse3_config::ac_attr_timeout$set, Named.of("acAttrTimeout()", (GetDoubleInConfig) FuseConfig::acAttrTimeout)) + ); + } + + private interface SetDoubleInMemorySegment extends BiConsumer { + } + + private interface GetDoubleInConfig extends Function { + } + + @DisplayName("test integer setters") + @ParameterizedTest(name = "{0}") + @MethodSource + public void testIntSetters(SetIntInConfig setter, GetIntInMemorySegment getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse3_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(connInfo, 42); + + Assertions.assertEquals(42, getter.apply(segment)); + } + } + + public static Stream testIntSetters() { + return Stream.of( + Arguments.arguments(Named.of("setSetGid()", (SetIntInConfig) FuseConfig::setSetGid), (GetIntInMemorySegment) fuse3_config::set_gid$get), + Arguments.arguments(Named.of("setGid()", (SetIntInConfig) FuseConfig::setGid), (GetIntInMemorySegment) fuse3_config::gid$get), + Arguments.arguments(Named.of("setSetUid()", (SetIntInConfig) FuseConfig::setSetUid), (GetIntInMemorySegment) fuse3_config::set_uid$get), + Arguments.arguments(Named.of("setUid()", (SetIntInConfig) FuseConfig::setUid), (GetIntInMemorySegment) fuse3_config::uid$get), + Arguments.arguments(Named.of("setSetMode()", (SetIntInConfig) FuseConfig::setSetMode), (GetIntInMemorySegment) fuse3_config::set_mode$get), + //Arguments.arguments(Named.of("setUmask()", (SetIntInConfig) FuseConfig::setUmask), (GetIntInMemorySegment) fuse3_config::umask$get), //TODO: HERE + Arguments.arguments(Named.of("setIntr()", (SetIntInConfig) FuseConfig::setIntr), (GetIntInMemorySegment) fuse3_config::intr$get), + Arguments.arguments(Named.of("setIntrSignal()", (SetIntInConfig) FuseConfig::setIntrSignal), (GetIntInMemorySegment) fuse3_config::intr_signal$get), + Arguments.arguments(Named.of("setRemember()", (SetIntInConfig) FuseConfig::setRemember), (GetIntInMemorySegment) fuse3_config::remember$get), + Arguments.arguments(Named.of("setHardRemove()", (SetIntInConfig) FuseConfig::setHardRemove), (GetIntInMemorySegment) fuse3_config::hard_remove$get), + Arguments.arguments(Named.of("setUseIno()", (SetIntInConfig) FuseConfig::setUseIno), (GetIntInMemorySegment) fuse3_config::use_ino$get), + Arguments.arguments(Named.of("setReaddirIno()", (SetIntInConfig) FuseConfig::setReaddirIno), (GetIntInMemorySegment) fuse3_config::readdir_ino$get), + Arguments.arguments(Named.of("setDirectIo()", (SetIntInConfig) FuseConfig::setDirectIo), (GetIntInMemorySegment) fuse3_config::direct_io$get), + Arguments.arguments(Named.of("setKernelCache()", (SetIntInConfig) FuseConfig::setKernelCache), (GetIntInMemorySegment) fuse3_config::kernel_cache$get), + Arguments.arguments(Named.of("setAutoCache()", (SetIntInConfig) FuseConfig::setAutoCache), (GetIntInMemorySegment) fuse3_config::auto_cache$get), + Arguments.arguments(Named.of("setAcAtrrTimeoutSet()", (SetIntInConfig) FuseConfig::setAcAttrTimeoutSet), (GetIntInMemorySegment) fuse3_config::ac_attr_timeout_set$get), + Arguments.arguments(Named.of("setNullpathOk()", (SetIntInConfig) FuseConfig::setNullpathOk), (GetIntInMemorySegment) fuse3_config::nullpath_ok$get) + ); + } + + private interface SetIntInConfig extends BiConsumer { + } + + private interface GetIntInMemorySegment extends Function { + } + + @DisplayName("test double setters") + @ParameterizedTest(name = "{0}") + @MethodSource + public void testDoubleSetters(SetDoubleInConfig setter, GetDoubleInMemorySegment getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse3_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(connInfo, 4.2); + + Assertions.assertEquals(4.2, getter.apply(segment)); + } + } + + public static Stream testDoubleSetters() { + return Stream.of( + Arguments.arguments(Named.of("entryTimeout()", (SetDoubleInConfig) FuseConfig::setEntryTimeout), (GetDoubleInMemorySegment) fuse3_config::entry_timeout$get), + Arguments.arguments(Named.of("setNegativeTimeout()", (SetDoubleInConfig) FuseConfig::setNegativeTimeout), (GetDoubleInMemorySegment) fuse3_config::negative_timeout$get), + Arguments.arguments(Named.of("setAttrTimeout()", (SetDoubleInConfig) FuseConfig::setAttrTimeout), (GetDoubleInMemorySegment) fuse3_config::attr_timeout$get), + Arguments.arguments(Named.of("setAcAttrTimeout()", (SetDoubleInConfig) FuseConfig::setAcAttrTimeout), (GetDoubleInMemorySegment) fuse3_config::ac_attr_timeout$get) + ); + } + + private interface SetDoubleInConfig extends BiConsumer { + } + + private interface GetDoubleInMemorySegment extends Function { + } +} From 3394b783e36a848da3fa39c5fa75468d930a9532 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 12 Oct 2022 13:07:58 +0200 Subject: [PATCH 16/41] add FuseConfig impl to linux aarch64 --- jfuse-linux-aarch64/pom.xml | 1 + .../jfuse/linux/aarch64/FuseConfigImpl.java | 226 +++++++++ .../jfuse/linux/aarch64/FuseImpl.java | 3 +- .../jfuse/linux/aarch64/extr/fuse_config.java | 452 ++++++++++++++++++ .../linux/aarch64/FuseConfigImplTest.java | 161 +++++++ .../jfuse/linux/aarch64/FuseImplTest.java | 7 +- 6 files changed, 845 insertions(+), 5 deletions(-) create mode 100644 jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImpl.java create mode 100644 jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/extr/fuse_config.java create mode 100644 jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImplTest.java diff --git a/jfuse-linux-aarch64/pom.xml b/jfuse-linux-aarch64/pom.xml index 6381696b..a04b0e51 100644 --- a/jfuse-linux-aarch64/pom.xml +++ b/jfuse-linux-aarch64/pom.xml @@ -114,6 +114,7 @@ statvfs timespec fuse_conn_info + fuse_config fuse_args fuse_loop_config diff --git a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImpl.java b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImpl.java new file mode 100644 index 00000000..1d79d273 --- /dev/null +++ b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImpl.java @@ -0,0 +1,226 @@ +package org.cryptomator.jfuse.linux.aarch64; + +import org.cryptomator.jfuse.api.FuseConfig; +import org.cryptomator.jfuse.linux.aarch64.extr.fuse_config; + +import java.lang.foreign.MemoryAddress; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.MemorySession; + +record FuseConfigImpl(MemorySegment segment) implements FuseConfig { + + public FuseConfigImpl(MemoryAddress address, MemorySession scope) { + this(fuse_config.ofAddress(address, scope)); + } + + @Override + public int getSetGid() { + return fuse_config.set_gid$get(segment); + } + + @Override + public void setSetGid(int setGid) { + fuse_config.set_gid$set(segment, setGid); + } + + @Override + public int gid() { + return fuse_config.gid$get(segment); + } + + @Override + public void setGid(int gid) { + fuse_config.gid$set(segment, gid); + } + + @Override + public int getSetUid() { + return fuse_config.set_uid$get(segment); + } + + @Override + public void setSetUid(int setUid) { + fuse_config.set_uid$set(segment, setUid); + } + + @Override + public int uid() { + return fuse_config.uid$get(segment); + } + + @Override + public void setUid(int uid) { + fuse_config.uid$set(segment, uid); + } + + @Override + public int getSetMode() { + return fuse_config.set_mode$get(segment); + } + + @Override + public void setSetMode(int setMode) { + fuse_config.set_mode$set(segment, setMode); + } + + @Override + public int umask() { + return fuse_config.umask$get(segment); + } + + @Override + public void setUmask(int umask) { + fuse_config.uid$set(segment, umask); + } + + @Override + public double entryTimeout() { + return fuse_config.entry_timeout$get(segment); + } + + @Override + public void setEntryTimeout(double entryTimeout) { + fuse_config.entry_timeout$set(segment, entryTimeout); + } + + @Override + public double negativeTimeout() { + return fuse_config.negative_timeout$get(segment); + } + + @Override + public void setNegativeTimeout(double negativeTimeout) { + fuse_config.negative_timeout$set(segment, negativeTimeout); + } + + @Override + public double attrTimeout() { + return fuse_config.attr_timeout$get(segment); + } + + @Override + public void setAttrTimeout(double attrTimeout) { + fuse_config.attr_timeout$set(segment, attrTimeout); + } + + @Override + public int intr() { + return fuse_config.intr$get(segment); + } + + @Override + public void setIntr(int intr) { + fuse_config.intr$set(segment, intr); + } + + @Override + public int intrSignal() { + return fuse_config.intr_signal$get(segment); + } + + @Override + public void setIntrSignal(int intrSignal) { + fuse_config.intr_signal$set(segment, intrSignal); + } + + @Override + public int remember() { + return fuse_config.remember$get(segment); + } + + @Override + public void setRemember(int secondsToRemember) { + fuse_config.remember$set(segment, secondsToRemember); + } + + @Override + public int hardRemove() { + return fuse_config.hard_remove$get(segment); + } + + @Override + public void setHardRemove(int hardRemove) { + fuse_config.hard_remove$set(segment, hardRemove); + } + + @Override + public int useIno() { + return fuse_config.use_ino$get(segment); + } + + @Override + public void setUseIno(int useIno) { + fuse_config.use_ino$set(segment, useIno); + } + + @Override + public int readdirIno() { + return fuse_config.readdir_ino$get(segment); + } + + @Override + public void setReaddirIno(int readdirIno) { + fuse_config.readdir_ino$set(segment, readdirIno); + } + + @Override + public int directIo() { + return fuse_config.direct_io$get(segment); + } + + @Override + public void setDirectIo(int directIo) { + fuse_config.direct_io$set(segment, directIo); + } + + @Override + public int kernelCache() { + return fuse_config.kernel_cache$get(segment); + } + + @Override + public void setKernelCache(int kernelCache) { + fuse_config.kernel_cache$set(segment, kernelCache); + } + + @Override + public int autoCache() { + return fuse_config.auto_cache$get(segment); + } + + @Override + public void setAutoCache(int autoCache) { + fuse_config.auto_cache$set(segment, autoCache); + } + + @Override + public int acAttrTimeoutSet() { + return fuse_config.ac_attr_timeout_set$get(segment); + } + + @Override + public void setAcAttrTimeoutSet(int acAttrTimeoutSet) { + fuse_config.ac_attr_timeout_set$set(segment, acAttrTimeoutSet); + } + + @Override + public double acAttrTimeout() { + return fuse_config.ac_attr_timeout$get(segment); + } + + @Override + public void setAcAttrTimeout(double acAttrTimeout) { + fuse_config.ac_attr_timeout$set(segment, acAttrTimeout); + } + + @Override + public int nullpathOk() { + return fuse_config.nullpath_ok$get(segment); + } + + @Override + public void setNullpathOk(int nullpathOk) { + fuse_config.nullpath_ok$set(segment, nullpathOk); + } + +} diff --git a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java index 8cd9dd87..8f22e010 100644 --- a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java +++ b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java @@ -104,7 +104,8 @@ Addressable init(MemoryAddress conn, MemoryAddress cfg) { try (var scope = MemorySession.openConfined()) { var connInfo = new FuseConnInfoImpl(conn, scope); connInfo.setWant(connInfo.want() | FuseConnInfo.FUSE_CAP_READDIRPLUS); - delegate.init(connInfo, null); + var config = new FuseConfigImpl(cfg, scope); + delegate.init(connInfo, config); } return MemoryAddress.NULL; } diff --git a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/extr/fuse_config.java b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/extr/fuse_config.java new file mode 100644 index 00000000..0711943c --- /dev/null +++ b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/extr/fuse_config.java @@ -0,0 +1,452 @@ +// Generated by jextract + +package org.cryptomator.jfuse.linux.aarch64.extr; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.VarHandle; +import java.nio.ByteOrder; +import java.lang.foreign.*; +import static java.lang.foreign.ValueLayout.*; +public class fuse_config { + + static final GroupLayout $struct$LAYOUT = MemoryLayout.structLayout( + Constants$root.C_INT$LAYOUT.withName("set_gid"), + Constants$root.C_INT$LAYOUT.withName("gid"), + Constants$root.C_INT$LAYOUT.withName("set_uid"), + Constants$root.C_INT$LAYOUT.withName("uid"), + Constants$root.C_INT$LAYOUT.withName("set_mode"), + Constants$root.C_INT$LAYOUT.withName("umask"), + Constants$root.C_DOUBLE$LAYOUT.withName("entry_timeout"), + Constants$root.C_DOUBLE$LAYOUT.withName("negative_timeout"), + Constants$root.C_DOUBLE$LAYOUT.withName("attr_timeout"), + Constants$root.C_INT$LAYOUT.withName("intr"), + Constants$root.C_INT$LAYOUT.withName("intr_signal"), + Constants$root.C_INT$LAYOUT.withName("remember"), + Constants$root.C_INT$LAYOUT.withName("hard_remove"), + Constants$root.C_INT$LAYOUT.withName("use_ino"), + Constants$root.C_INT$LAYOUT.withName("readdir_ino"), + Constants$root.C_INT$LAYOUT.withName("direct_io"), + Constants$root.C_INT$LAYOUT.withName("kernel_cache"), + Constants$root.C_INT$LAYOUT.withName("auto_cache"), + Constants$root.C_INT$LAYOUT.withName("no_rofd_flush"), + Constants$root.C_INT$LAYOUT.withName("ac_attr_timeout_set"), + MemoryLayout.paddingLayout(32), + Constants$root.C_DOUBLE$LAYOUT.withName("ac_attr_timeout"), + Constants$root.C_INT$LAYOUT.withName("nullpath_ok"), + Constants$root.C_INT$LAYOUT.withName("show_help"), + Constants$root.C_POINTER$LAYOUT.withName("modules"), + Constants$root.C_INT$LAYOUT.withName("debug"), + MemoryLayout.paddingLayout(32) + ).withName("fuse_config"); + public static MemoryLayout $LAYOUT() { + return fuse_config.$struct$LAYOUT; + } + static final VarHandle set_gid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("set_gid")); + public static VarHandle set_gid$VH() { + return fuse_config.set_gid$VH; + } + public static int set_gid$get(MemorySegment seg) { + return (int)fuse_config.set_gid$VH.get(seg); + } + public static void set_gid$set( MemorySegment seg, int x) { + fuse_config.set_gid$VH.set(seg, x); + } + public static int set_gid$get(MemorySegment seg, long index) { + return (int)fuse_config.set_gid$VH.get(seg.asSlice(index*sizeof())); + } + public static void set_gid$set(MemorySegment seg, long index, int x) { + fuse_config.set_gid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle gid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("gid")); + public static VarHandle gid$VH() { + return fuse_config.gid$VH; + } + public static int gid$get(MemorySegment seg) { + return (int)fuse_config.gid$VH.get(seg); + } + public static void gid$set( MemorySegment seg, int x) { + fuse_config.gid$VH.set(seg, x); + } + public static int gid$get(MemorySegment seg, long index) { + return (int)fuse_config.gid$VH.get(seg.asSlice(index*sizeof())); + } + public static void gid$set(MemorySegment seg, long index, int x) { + fuse_config.gid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle set_uid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("set_uid")); + public static VarHandle set_uid$VH() { + return fuse_config.set_uid$VH; + } + public static int set_uid$get(MemorySegment seg) { + return (int)fuse_config.set_uid$VH.get(seg); + } + public static void set_uid$set( MemorySegment seg, int x) { + fuse_config.set_uid$VH.set(seg, x); + } + public static int set_uid$get(MemorySegment seg, long index) { + return (int)fuse_config.set_uid$VH.get(seg.asSlice(index*sizeof())); + } + public static void set_uid$set(MemorySegment seg, long index, int x) { + fuse_config.set_uid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle uid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("uid")); + public static VarHandle uid$VH() { + return fuse_config.uid$VH; + } + public static int uid$get(MemorySegment seg) { + return (int)fuse_config.uid$VH.get(seg); + } + public static void uid$set( MemorySegment seg, int x) { + fuse_config.uid$VH.set(seg, x); + } + public static int uid$get(MemorySegment seg, long index) { + return (int)fuse_config.uid$VH.get(seg.asSlice(index*sizeof())); + } + public static void uid$set(MemorySegment seg, long index, int x) { + fuse_config.uid$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle set_mode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("set_mode")); + public static VarHandle set_mode$VH() { + return fuse_config.set_mode$VH; + } + public static int set_mode$get(MemorySegment seg) { + return (int)fuse_config.set_mode$VH.get(seg); + } + public static void set_mode$set( MemorySegment seg, int x) { + fuse_config.set_mode$VH.set(seg, x); + } + public static int set_mode$get(MemorySegment seg, long index) { + return (int)fuse_config.set_mode$VH.get(seg.asSlice(index*sizeof())); + } + public static void set_mode$set(MemorySegment seg, long index, int x) { + fuse_config.set_mode$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle umask$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("umask")); + public static VarHandle umask$VH() { + return fuse_config.umask$VH; + } + public static int umask$get(MemorySegment seg) { + return (int)fuse_config.umask$VH.get(seg); + } + public static void umask$set( MemorySegment seg, int x) { + fuse_config.umask$VH.set(seg, x); + } + public static int umask$get(MemorySegment seg, long index) { + return (int)fuse_config.umask$VH.get(seg.asSlice(index*sizeof())); + } + public static void umask$set(MemorySegment seg, long index, int x) { + fuse_config.umask$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle entry_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("entry_timeout")); + public static VarHandle entry_timeout$VH() { + return fuse_config.entry_timeout$VH; + } + public static double entry_timeout$get(MemorySegment seg) { + return (double)fuse_config.entry_timeout$VH.get(seg); + } + public static void entry_timeout$set( MemorySegment seg, double x) { + fuse_config.entry_timeout$VH.set(seg, x); + } + public static double entry_timeout$get(MemorySegment seg, long index) { + return (double)fuse_config.entry_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void entry_timeout$set(MemorySegment seg, long index, double x) { + fuse_config.entry_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle negative_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("negative_timeout")); + public static VarHandle negative_timeout$VH() { + return fuse_config.negative_timeout$VH; + } + public static double negative_timeout$get(MemorySegment seg) { + return (double)fuse_config.negative_timeout$VH.get(seg); + } + public static void negative_timeout$set( MemorySegment seg, double x) { + fuse_config.negative_timeout$VH.set(seg, x); + } + public static double negative_timeout$get(MemorySegment seg, long index) { + return (double)fuse_config.negative_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void negative_timeout$set(MemorySegment seg, long index, double x) { + fuse_config.negative_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle attr_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("attr_timeout")); + public static VarHandle attr_timeout$VH() { + return fuse_config.attr_timeout$VH; + } + public static double attr_timeout$get(MemorySegment seg) { + return (double)fuse_config.attr_timeout$VH.get(seg); + } + public static void attr_timeout$set( MemorySegment seg, double x) { + fuse_config.attr_timeout$VH.set(seg, x); + } + public static double attr_timeout$get(MemorySegment seg, long index) { + return (double)fuse_config.attr_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void attr_timeout$set(MemorySegment seg, long index, double x) { + fuse_config.attr_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle intr$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("intr")); + public static VarHandle intr$VH() { + return fuse_config.intr$VH; + } + public static int intr$get(MemorySegment seg) { + return (int)fuse_config.intr$VH.get(seg); + } + public static void intr$set( MemorySegment seg, int x) { + fuse_config.intr$VH.set(seg, x); + } + public static int intr$get(MemorySegment seg, long index) { + return (int)fuse_config.intr$VH.get(seg.asSlice(index*sizeof())); + } + public static void intr$set(MemorySegment seg, long index, int x) { + fuse_config.intr$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle intr_signal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("intr_signal")); + public static VarHandle intr_signal$VH() { + return fuse_config.intr_signal$VH; + } + public static int intr_signal$get(MemorySegment seg) { + return (int)fuse_config.intr_signal$VH.get(seg); + } + public static void intr_signal$set( MemorySegment seg, int x) { + fuse_config.intr_signal$VH.set(seg, x); + } + public static int intr_signal$get(MemorySegment seg, long index) { + return (int)fuse_config.intr_signal$VH.get(seg.asSlice(index*sizeof())); + } + public static void intr_signal$set(MemorySegment seg, long index, int x) { + fuse_config.intr_signal$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle remember$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("remember")); + public static VarHandle remember$VH() { + return fuse_config.remember$VH; + } + public static int remember$get(MemorySegment seg) { + return (int)fuse_config.remember$VH.get(seg); + } + public static void remember$set( MemorySegment seg, int x) { + fuse_config.remember$VH.set(seg, x); + } + public static int remember$get(MemorySegment seg, long index) { + return (int)fuse_config.remember$VH.get(seg.asSlice(index*sizeof())); + } + public static void remember$set(MemorySegment seg, long index, int x) { + fuse_config.remember$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle hard_remove$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hard_remove")); + public static VarHandle hard_remove$VH() { + return fuse_config.hard_remove$VH; + } + public static int hard_remove$get(MemorySegment seg) { + return (int)fuse_config.hard_remove$VH.get(seg); + } + public static void hard_remove$set( MemorySegment seg, int x) { + fuse_config.hard_remove$VH.set(seg, x); + } + public static int hard_remove$get(MemorySegment seg, long index) { + return (int)fuse_config.hard_remove$VH.get(seg.asSlice(index*sizeof())); + } + public static void hard_remove$set(MemorySegment seg, long index, int x) { + fuse_config.hard_remove$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle use_ino$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("use_ino")); + public static VarHandle use_ino$VH() { + return fuse_config.use_ino$VH; + } + public static int use_ino$get(MemorySegment seg) { + return (int)fuse_config.use_ino$VH.get(seg); + } + public static void use_ino$set( MemorySegment seg, int x) { + fuse_config.use_ino$VH.set(seg, x); + } + public static int use_ino$get(MemorySegment seg, long index) { + return (int)fuse_config.use_ino$VH.get(seg.asSlice(index*sizeof())); + } + public static void use_ino$set(MemorySegment seg, long index, int x) { + fuse_config.use_ino$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle readdir_ino$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("readdir_ino")); + public static VarHandle readdir_ino$VH() { + return fuse_config.readdir_ino$VH; + } + public static int readdir_ino$get(MemorySegment seg) { + return (int)fuse_config.readdir_ino$VH.get(seg); + } + public static void readdir_ino$set( MemorySegment seg, int x) { + fuse_config.readdir_ino$VH.set(seg, x); + } + public static int readdir_ino$get(MemorySegment seg, long index) { + return (int)fuse_config.readdir_ino$VH.get(seg.asSlice(index*sizeof())); + } + public static void readdir_ino$set(MemorySegment seg, long index, int x) { + fuse_config.readdir_ino$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle direct_io$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("direct_io")); + public static VarHandle direct_io$VH() { + return fuse_config.direct_io$VH; + } + public static int direct_io$get(MemorySegment seg) { + return (int)fuse_config.direct_io$VH.get(seg); + } + public static void direct_io$set( MemorySegment seg, int x) { + fuse_config.direct_io$VH.set(seg, x); + } + public static int direct_io$get(MemorySegment seg, long index) { + return (int)fuse_config.direct_io$VH.get(seg.asSlice(index*sizeof())); + } + public static void direct_io$set(MemorySegment seg, long index, int x) { + fuse_config.direct_io$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle kernel_cache$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("kernel_cache")); + public static VarHandle kernel_cache$VH() { + return fuse_config.kernel_cache$VH; + } + public static int kernel_cache$get(MemorySegment seg) { + return (int)fuse_config.kernel_cache$VH.get(seg); + } + public static void kernel_cache$set( MemorySegment seg, int x) { + fuse_config.kernel_cache$VH.set(seg, x); + } + public static int kernel_cache$get(MemorySegment seg, long index) { + return (int)fuse_config.kernel_cache$VH.get(seg.asSlice(index*sizeof())); + } + public static void kernel_cache$set(MemorySegment seg, long index, int x) { + fuse_config.kernel_cache$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle auto_cache$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("auto_cache")); + public static VarHandle auto_cache$VH() { + return fuse_config.auto_cache$VH; + } + public static int auto_cache$get(MemorySegment seg) { + return (int)fuse_config.auto_cache$VH.get(seg); + } + public static void auto_cache$set( MemorySegment seg, int x) { + fuse_config.auto_cache$VH.set(seg, x); + } + public static int auto_cache$get(MemorySegment seg, long index) { + return (int)fuse_config.auto_cache$VH.get(seg.asSlice(index*sizeof())); + } + public static void auto_cache$set(MemorySegment seg, long index, int x) { + fuse_config.auto_cache$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle no_rofd_flush$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("no_rofd_flush")); + public static VarHandle no_rofd_flush$VH() { + return fuse_config.no_rofd_flush$VH; + } + public static int no_rofd_flush$get(MemorySegment seg) { + return (int)fuse_config.no_rofd_flush$VH.get(seg); + } + public static void no_rofd_flush$set( MemorySegment seg, int x) { + fuse_config.no_rofd_flush$VH.set(seg, x); + } + public static int no_rofd_flush$get(MemorySegment seg, long index) { + return (int)fuse_config.no_rofd_flush$VH.get(seg.asSlice(index*sizeof())); + } + public static void no_rofd_flush$set(MemorySegment seg, long index, int x) { + fuse_config.no_rofd_flush$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle ac_attr_timeout_set$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ac_attr_timeout_set")); + public static VarHandle ac_attr_timeout_set$VH() { + return fuse_config.ac_attr_timeout_set$VH; + } + public static int ac_attr_timeout_set$get(MemorySegment seg) { + return (int)fuse_config.ac_attr_timeout_set$VH.get(seg); + } + public static void ac_attr_timeout_set$set( MemorySegment seg, int x) { + fuse_config.ac_attr_timeout_set$VH.set(seg, x); + } + public static int ac_attr_timeout_set$get(MemorySegment seg, long index) { + return (int)fuse_config.ac_attr_timeout_set$VH.get(seg.asSlice(index*sizeof())); + } + public static void ac_attr_timeout_set$set(MemorySegment seg, long index, int x) { + fuse_config.ac_attr_timeout_set$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle ac_attr_timeout$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ac_attr_timeout")); + public static VarHandle ac_attr_timeout$VH() { + return fuse_config.ac_attr_timeout$VH; + } + public static double ac_attr_timeout$get(MemorySegment seg) { + return (double)fuse_config.ac_attr_timeout$VH.get(seg); + } + public static void ac_attr_timeout$set( MemorySegment seg, double x) { + fuse_config.ac_attr_timeout$VH.set(seg, x); + } + public static double ac_attr_timeout$get(MemorySegment seg, long index) { + return (double)fuse_config.ac_attr_timeout$VH.get(seg.asSlice(index*sizeof())); + } + public static void ac_attr_timeout$set(MemorySegment seg, long index, double x) { + fuse_config.ac_attr_timeout$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle nullpath_ok$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("nullpath_ok")); + public static VarHandle nullpath_ok$VH() { + return fuse_config.nullpath_ok$VH; + } + public static int nullpath_ok$get(MemorySegment seg) { + return (int)fuse_config.nullpath_ok$VH.get(seg); + } + public static void nullpath_ok$set( MemorySegment seg, int x) { + fuse_config.nullpath_ok$VH.set(seg, x); + } + public static int nullpath_ok$get(MemorySegment seg, long index) { + return (int)fuse_config.nullpath_ok$VH.get(seg.asSlice(index*sizeof())); + } + public static void nullpath_ok$set(MemorySegment seg, long index, int x) { + fuse_config.nullpath_ok$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle show_help$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("show_help")); + public static VarHandle show_help$VH() { + return fuse_config.show_help$VH; + } + public static int show_help$get(MemorySegment seg) { + return (int)fuse_config.show_help$VH.get(seg); + } + public static void show_help$set( MemorySegment seg, int x) { + fuse_config.show_help$VH.set(seg, x); + } + public static int show_help$get(MemorySegment seg, long index) { + return (int)fuse_config.show_help$VH.get(seg.asSlice(index*sizeof())); + } + public static void show_help$set(MemorySegment seg, long index, int x) { + fuse_config.show_help$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle modules$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("modules")); + public static VarHandle modules$VH() { + return fuse_config.modules$VH; + } + public static MemoryAddress modules$get(MemorySegment seg) { + return (java.lang.foreign.MemoryAddress)fuse_config.modules$VH.get(seg); + } + public static void modules$set( MemorySegment seg, MemoryAddress x) { + fuse_config.modules$VH.set(seg, x); + } + public static MemoryAddress modules$get(MemorySegment seg, long index) { + return (java.lang.foreign.MemoryAddress)fuse_config.modules$VH.get(seg.asSlice(index*sizeof())); + } + public static void modules$set(MemorySegment seg, long index, MemoryAddress x) { + fuse_config.modules$VH.set(seg.asSlice(index*sizeof()), x); + } + static final VarHandle debug$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("debug")); + public static VarHandle debug$VH() { + return fuse_config.debug$VH; + } + public static int debug$get(MemorySegment seg) { + return (int)fuse_config.debug$VH.get(seg); + } + public static void debug$set( MemorySegment seg, int x) { + fuse_config.debug$VH.set(seg, x); + } + public static int debug$get(MemorySegment seg, long index) { + return (int)fuse_config.debug$VH.get(seg.asSlice(index*sizeof())); + } + public static void debug$set(MemorySegment seg, long index, int x) { + fuse_config.debug$VH.set(seg.asSlice(index*sizeof()), x); + } + public static long sizeof() { return $LAYOUT().byteSize(); } + public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } + public static MemorySegment allocateArray(int len, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + } + public static MemorySegment ofAddress(MemoryAddress addr, MemorySession session) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, session); } +} + + diff --git a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImplTest.java b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImplTest.java new file mode 100644 index 00000000..6249c298 --- /dev/null +++ b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImplTest.java @@ -0,0 +1,161 @@ +package org.cryptomator.jfuse.linux.aarch64; + +import org.cryptomator.jfuse.api.FuseConfig; +import org.cryptomator.jfuse.linux.aarch64.extr.fuse_config; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Named; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.lang.foreign.MemorySegment; +import java.lang.foreign.MemorySession; +import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.stream.Stream; + +public class FuseConfigImplTest { + + @DisplayName("test getters returning int") + @ParameterizedTest(name = "{1}") + @MethodSource + public void testIntGetters(SetIntInMemorySegment setter, GetIntInConfig getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(segment, 42); + + Assertions.assertEquals(42, getter.apply(connInfo)); + } + } + + public static Stream testIntGetters() { + return Stream.of( + Arguments.arguments((SetIntInMemorySegment) fuse_config::set_gid$set, Named.of("getSetGid()", (GetIntInConfig) FuseConfig::getSetGid)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::gid$set, Named.of("gid()", (GetIntInConfig) FuseConfig::gid)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::set_uid$set, Named.of("getSetUid()", (GetIntInConfig) FuseConfig::getSetUid)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::uid$set, Named.of("uid()", (GetIntInConfig) FuseConfig::uid)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::set_mode$set, Named.of("getSetMode()", (GetIntInConfig) FuseConfig::getSetMode)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::umask$set, Named.of("umask()", (GetIntInConfig) FuseConfig::umask)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::intr$set, Named.of("intr()", (GetIntInConfig) FuseConfig::intr)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::intr_signal$set, Named.of("intrSignal()", (GetIntInConfig) FuseConfig::intrSignal)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::remember$set, Named.of("remember()", (GetIntInConfig) FuseConfig::remember)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::hard_remove$set, Named.of("hardRemove()", (GetIntInConfig) FuseConfig::hardRemove)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::use_ino$set, Named.of("useIno()", (GetIntInConfig) FuseConfig::useIno)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::readdir_ino$set, Named.of("readdirIno()", (GetIntInConfig) FuseConfig::readdirIno)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::direct_io$set, Named.of("directIo()", (GetIntInConfig) FuseConfig::directIo)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::kernel_cache$set, Named.of("kernelCache()", (GetIntInConfig) FuseConfig::kernelCache)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::auto_cache$set, Named.of("autoCache()", (GetIntInConfig) FuseConfig::autoCache)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::ac_attr_timeout_set$set, Named.of("acAtrrTimeoutSet()", (GetIntInConfig) FuseConfig::acAttrTimeoutSet)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::nullpath_ok$set, Named.of("nullpathOk()", (GetIntInConfig) FuseConfig::nullpathOk)) + ); + } + + private interface SetIntInMemorySegment extends BiConsumer { + } + + private interface GetIntInConfig extends Function { + } + + @DisplayName("test getters returning double") + @ParameterizedTest(name = "{1}") + @MethodSource + public void testDoubleGetters(SetDoubleInMemorySegment setter, GetDoubleInConfig getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(segment, 4.2); + + Assertions.assertEquals(4.2, getter.apply(connInfo)); + } + } + + public static Stream testDoubleGetters() { + return Stream.of( + Arguments.arguments((SetDoubleInMemorySegment) fuse_config::entry_timeout$set, Named.of("entryTimeout()", (GetDoubleInConfig) FuseConfig::entryTimeout)), + Arguments.arguments((SetDoubleInMemorySegment) fuse_config::negative_timeout$set, Named.of("negativeTimeout()", (GetDoubleInConfig) FuseConfig::negativeTimeout)), + Arguments.arguments((SetDoubleInMemorySegment) fuse_config::attr_timeout$set, Named.of("attrTimeout()", (GetDoubleInConfig) FuseConfig::attrTimeout)), + Arguments.arguments((SetDoubleInMemorySegment) fuse_config::ac_attr_timeout$set, Named.of("acAttrTimeout()", (GetDoubleInConfig) FuseConfig::acAttrTimeout)) + ); + } + + private interface SetDoubleInMemorySegment extends BiConsumer { + } + + private interface GetDoubleInConfig extends Function { + } + + @DisplayName("test integer setters") + @ParameterizedTest(name = "{0}") + @MethodSource + public void testIntSetters(SetIntInConfig setter, GetIntInMemorySegment getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(connInfo, 42); + + Assertions.assertEquals(42, getter.apply(segment)); + } + } + + public static Stream testIntSetters() { + return Stream.of( + Arguments.arguments(Named.of("setSetGid()", (SetIntInConfig) FuseConfig::setSetGid), (GetIntInMemorySegment) fuse_config::set_gid$get), + Arguments.arguments(Named.of("setGid()", (SetIntInConfig) FuseConfig::setGid), (GetIntInMemorySegment) fuse_config::gid$get), + Arguments.arguments(Named.of("setSetUid()", (SetIntInConfig) FuseConfig::setSetUid), (GetIntInMemorySegment) fuse_config::set_uid$get), + Arguments.arguments(Named.of("setUid()", (SetIntInConfig) FuseConfig::setUid), (GetIntInMemorySegment) fuse_config::uid$get), + Arguments.arguments(Named.of("setSetMode()", (SetIntInConfig) FuseConfig::setSetMode), (GetIntInMemorySegment) fuse_config::set_mode$get), + //Arguments.arguments(Named.of("setUmask()", (SetIntInConfig) FuseConfig::setUmask), (GetIntInMemorySegment) fuse_config::umask$get), + Arguments.arguments(Named.of("setIntr()", (SetIntInConfig) FuseConfig::setIntr), (GetIntInMemorySegment) fuse_config::intr$get), + Arguments.arguments(Named.of("setIntrSignal()", (SetIntInConfig) FuseConfig::setIntrSignal), (GetIntInMemorySegment) fuse_config::intr_signal$get), + Arguments.arguments(Named.of("setRemember()", (SetIntInConfig) FuseConfig::setRemember), (GetIntInMemorySegment) fuse_config::remember$get), + Arguments.arguments(Named.of("setHardRemove()", (SetIntInConfig) FuseConfig::setHardRemove), (GetIntInMemorySegment) fuse_config::hard_remove$get), + Arguments.arguments(Named.of("setUseIno()", (SetIntInConfig) FuseConfig::setUseIno), (GetIntInMemorySegment) fuse_config::use_ino$get), + Arguments.arguments(Named.of("setReaddirIno()", (SetIntInConfig) FuseConfig::setReaddirIno), (GetIntInMemorySegment) fuse_config::readdir_ino$get), + Arguments.arguments(Named.of("setDirectIo()", (SetIntInConfig) FuseConfig::setDirectIo), (GetIntInMemorySegment) fuse_config::direct_io$get), + Arguments.arguments(Named.of("setKernelCache()", (SetIntInConfig) FuseConfig::setKernelCache), (GetIntInMemorySegment) fuse_config::kernel_cache$get), + Arguments.arguments(Named.of("setAutoCache()", (SetIntInConfig) FuseConfig::setAutoCache), (GetIntInMemorySegment) fuse_config::auto_cache$get), + Arguments.arguments(Named.of("setAcAtrrTimeoutSet()", (SetIntInConfig) FuseConfig::setAcAttrTimeoutSet), (GetIntInMemorySegment) fuse_config::ac_attr_timeout_set$get), + Arguments.arguments(Named.of("setNullpathOk()", (SetIntInConfig) FuseConfig::setNullpathOk), (GetIntInMemorySegment) fuse_config::nullpath_ok$get) + ); + } + + private interface SetIntInConfig extends BiConsumer { + } + + private interface GetIntInMemorySegment extends Function { + } + + @DisplayName("test double setters") + @ParameterizedTest(name = "{0}") + @MethodSource + public void testDoubleSetters(SetDoubleInConfig setter, GetDoubleInMemorySegment getter) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse_config.allocate(scope); + var connInfo = new FuseConfigImpl(segment.address(), scope); + + setter.accept(connInfo, 4.2); + + Assertions.assertEquals(4.2, getter.apply(segment)); + } + } + + public static Stream testDoubleSetters() { + return Stream.of( + Arguments.arguments(Named.of("entryTimeout()", (SetDoubleInConfig) FuseConfig::setEntryTimeout), (GetDoubleInMemorySegment) fuse_config::entry_timeout$get), + Arguments.arguments(Named.of("setNegativeTimeout()", (SetDoubleInConfig) FuseConfig::setNegativeTimeout), (GetDoubleInMemorySegment) fuse_config::negative_timeout$get), + Arguments.arguments(Named.of("setAttrTimeout()", (SetDoubleInConfig) FuseConfig::setAttrTimeout), (GetDoubleInMemorySegment) fuse_config::attr_timeout$get), + Arguments.arguments(Named.of("setAcAttrTimeout()", (SetDoubleInConfig) FuseConfig::setAcAttrTimeout), (GetDoubleInMemorySegment) fuse_config::ac_attr_timeout$get) + ); + } + + private interface SetDoubleInConfig extends BiConsumer { + } + + private interface GetDoubleInMemorySegment extends Function { + } +} diff --git a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java index 393d1569..bca2dcda 100644 --- a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java +++ b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java @@ -4,6 +4,7 @@ import org.cryptomator.jfuse.api.FuseOperations; import org.cryptomator.jfuse.api.MountFailedException; import org.cryptomator.jfuse.api.TimeSpec; +import org.cryptomator.jfuse.linux.aarch64.extr.fuse_config; import org.cryptomator.jfuse.linux.aarch64.extr.fuse_conn_info; import org.cryptomator.jfuse.linux.aarch64.extr.fuse_file_info; import org.cryptomator.jfuse.linux.aarch64.extr.fuse_h; @@ -20,10 +21,8 @@ import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; import org.mockito.Answers; -import org.mockito.Mock; import org.mockito.MockedStatic; import org.mockito.Mockito; -import org.mockito.verification.VerificationMode; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySegment; @@ -133,9 +132,9 @@ public void testInit() { FuseConnInfo connInfo = invocation.getArgument(0); result.set(connInfo.want()); return null; - }).when(fuseOps).init(Mockito.any()); + }).when(fuseOps).init(Mockito.any(), Mockito.any()); var connInfo = fuse_conn_info.allocate(scope); - var fuseConfig = MemoryAddress.NULL; // TODO jextract fuse_config + var fuseConfig = fuse_config.allocate(scope); fuseImpl.init(connInfo.address(), fuseConfig.address()); From 33268999e756fb67f27f072328c62ff1fc541ee2 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 12 Oct 2022 13:38:42 +0200 Subject: [PATCH 17/41] apply options for all javadoc targets [ci skip] --- pom.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 54757178..070621ba 100644 --- a/pom.xml +++ b/pom.xml @@ -156,14 +156,12 @@ jar - - 19 - --enable-preview - *.extr + 19 + --enable-preview From 1e764f5cd5d06e9ee13301568985d20fe753df24 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 12 Oct 2022 13:39:39 +0200 Subject: [PATCH 18/41] add required options (mac-specific for now) [ci skip] --- .idea/runConfigurations/RandomFileSystem.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.idea/runConfigurations/RandomFileSystem.xml b/.idea/runConfigurations/RandomFileSystem.xml index 5e0e8100..6ebe82bc 100644 --- a/.idea/runConfigurations/RandomFileSystem.xml +++ b/.idea/runConfigurations/RandomFileSystem.xml @@ -1,8 +1,9 @@ - +

+ * Set no_rofd_flush field in fuse_config or no-op if not supported + */ + void setNoRofdFlush(int noRofdFlush); } diff --git a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImpl.java b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImpl.java index e71be804..f3da04db 100644 --- a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImpl.java +++ b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImpl.java @@ -223,4 +223,14 @@ public void setNullpathOk(int nullpathOk) { fuse_config.nullpath_ok$set(segment, nullpathOk); } + @Override + public int noRofdFlush() { + return fuse_config.no_rofd_flush$get(segment); + } + + @Override + public void setNoRofdFlush(int noRofdFlush) { + fuse_config.no_rofd_flush$set(segment, noRofdFlush); + } + } diff --git a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImplTest.java b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImplTest.java index bad9376c..d9945363 100644 --- a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImplTest.java +++ b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseConfigImplTest.java @@ -49,7 +49,8 @@ public static Stream testIntGetters() { Arguments.arguments((SetIntInMemorySegment) fuse_config::kernel_cache$set, Named.of("kernelCache()", (GetIntInConfig) FuseConfig::kernelCache)), Arguments.arguments((SetIntInMemorySegment) fuse_config::auto_cache$set, Named.of("autoCache()", (GetIntInConfig) FuseConfig::autoCache)), Arguments.arguments((SetIntInMemorySegment) fuse_config::ac_attr_timeout_set$set, Named.of("acAtrrTimeoutSet()", (GetIntInConfig) FuseConfig::acAttrTimeoutSet)), - Arguments.arguments((SetIntInMemorySegment) fuse_config::nullpath_ok$set, Named.of("nullpathOk()", (GetIntInConfig) FuseConfig::nullpathOk)) + Arguments.arguments((SetIntInMemorySegment) fuse_config::nullpath_ok$set, Named.of("nullpathOk()", (GetIntInConfig) FuseConfig::nullpathOk)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::no_rofd_flush$set, Named.of("noRofdFlush()", (GetIntInConfig) FuseConfig::noRofdFlush)) ); } @@ -120,7 +121,8 @@ public static Stream testIntSetters() { Arguments.arguments(Named.of("setKernelCache()", (SetIntInConfig) FuseConfig::setKernelCache), (GetIntInMemorySegment) fuse_config::kernel_cache$get), Arguments.arguments(Named.of("setAutoCache()", (SetIntInConfig) FuseConfig::setAutoCache), (GetIntInMemorySegment) fuse_config::auto_cache$get), Arguments.arguments(Named.of("setAcAtrrTimeoutSet()", (SetIntInConfig) FuseConfig::setAcAttrTimeoutSet), (GetIntInMemorySegment) fuse_config::ac_attr_timeout_set$get), - Arguments.arguments(Named.of("setNullpathOk()", (SetIntInConfig) FuseConfig::setNullpathOk), (GetIntInMemorySegment) fuse_config::nullpath_ok$get) + Arguments.arguments(Named.of("setNullpathOk()", (SetIntInConfig) FuseConfig::setNullpathOk), (GetIntInMemorySegment) fuse_config::nullpath_ok$get), + Arguments.arguments(Named.of("setNoRofdFlush()", (SetIntInConfig) FuseConfig::setNoRofdFlush), (GetIntInMemorySegment) fuse_config::no_rofd_flush$get) ); } diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java index 730ec852..a884f54f 100644 --- a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImpl.java @@ -223,4 +223,14 @@ public void setNullpathOk(int nullpathOk) { fuse_config.nullpath_ok$set(segment, nullpathOk); } + @Override + public int noRofdFlush() { + return fuse_config.no_rofd_flush$get(segment); + } + + @Override + public void setNoRofdFlush(int noRofdFlush) { + fuse_config.no_rofd_flush$set(segment, noRofdFlush); + } + } diff --git a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImplTest.java b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImplTest.java index e9bd4678..ebf76a53 100644 --- a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImplTest.java +++ b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseConfigImplTest.java @@ -49,7 +49,8 @@ public static Stream testIntGetters() { Arguments.arguments((SetIntInMemorySegment) fuse_config::kernel_cache$set, Named.of("kernelCache()", (GetIntInConfig) FuseConfig::kernelCache)), Arguments.arguments((SetIntInMemorySegment) fuse_config::auto_cache$set, Named.of("autoCache()", (GetIntInConfig) FuseConfig::autoCache)), Arguments.arguments((SetIntInMemorySegment) fuse_config::ac_attr_timeout_set$set, Named.of("acAtrrTimeoutSet()", (GetIntInConfig) FuseConfig::acAttrTimeoutSet)), - Arguments.arguments((SetIntInMemorySegment) fuse_config::nullpath_ok$set, Named.of("nullpathOk()", (GetIntInConfig) FuseConfig::nullpathOk)) + Arguments.arguments((SetIntInMemorySegment) fuse_config::nullpath_ok$set, Named.of("nullpathOk()", (GetIntInConfig) FuseConfig::nullpathOk)), + Arguments.arguments((SetIntInMemorySegment) fuse_config::no_rofd_flush$set, Named.of("noRofdFlush()", (GetIntInConfig) FuseConfig::noRofdFlush)) ); } @@ -120,7 +121,8 @@ public static Stream testIntSetters() { Arguments.arguments(Named.of("setKernelCache()", (SetIntInConfig) FuseConfig::setKernelCache), (GetIntInMemorySegment) fuse_config::kernel_cache$get), Arguments.arguments(Named.of("setAutoCache()", (SetIntInConfig) FuseConfig::setAutoCache), (GetIntInMemorySegment) fuse_config::auto_cache$get), Arguments.arguments(Named.of("setAcAtrrTimeoutSet()", (SetIntInConfig) FuseConfig::setAcAttrTimeoutSet), (GetIntInMemorySegment) fuse_config::ac_attr_timeout_set$get), - Arguments.arguments(Named.of("setNullpathOk()", (SetIntInConfig) FuseConfig::setNullpathOk), (GetIntInMemorySegment) fuse_config::nullpath_ok$get) + Arguments.arguments(Named.of("setNullpathOk()", (SetIntInConfig) FuseConfig::setNullpathOk), (GetIntInMemorySegment) fuse_config::nullpath_ok$get), + Arguments.arguments(Named.of("setNoRofdFlush()", (SetIntInConfig) FuseConfig::setNoRofdFlush), (GetIntInMemorySegment) fuse_config::no_rofd_flush$get) ); } diff --git a/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseConfigImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseConfigImpl.java index 2c00f67a..62a6f005 100644 --- a/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseConfigImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseConfigImpl.java @@ -223,4 +223,14 @@ public void setNullpathOk(int nullpathOk) { fuse3_config.nullpath_ok$set(segment, nullpathOk); } + @Override + public int noRofdFlush() { + return 0; + } + + @Override + public void setNoRofdFlush(int noRofdFlush) { + //no-op + } + } From 99f8d0b675259e1be22a12b585a958d34ae49d25 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 12 Oct 2022 17:16:20 +0200 Subject: [PATCH 25/41] revert update of libfuse3 --- libfuse3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libfuse3 b/libfuse3 index 7657ec15..b1290d4c 160000 --- a/libfuse3 +++ b/libfuse3 @@ -1 +1 @@ -Subproject commit 7657ec158becdc59656c59dff40346fefde78cb2 +Subproject commit b1290d4c091a5c590e61a6195e625eab33300673 From 899205ed53453289ee6c00f70e6ca96deccbaa1b Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 13 Oct 2022 12:12:46 +0200 Subject: [PATCH 26/41] bump used gh actions --- .github/workflows/build.yml | 32 +++++++++++++-------------- .github/workflows/publish-central.yml | 4 ++-- .github/workflows/publish-github.yml | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 063d2fa3..b1e0104f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,8 +9,8 @@ jobs: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 with: java-version: 19 distribution: 'zulu' @@ -21,7 +21,7 @@ jobs: sudo apt-get install fuse3 libfuse3-dev - name: Maven build run: mvn -B verify -Plinux-amd64 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: coverage-linux-amd64 path: jfuse-tests/target/site/jacoco-aggregate/jacoco.xml @@ -32,8 +32,8 @@ jobs: runs-on: macos-10.15 if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 with: java-version: 19 distribution: 'zulu' @@ -42,7 +42,7 @@ jobs: run: brew install macfuse - name: Maven build run: mvn -B verify -Pmac - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: coverage-mac path: jfuse-tests/target/site/jacoco-aggregate/jacoco.xml @@ -53,8 +53,8 @@ jobs: runs-on: windows-latest if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 with: java-version: 19 distribution: 'zulu' @@ -63,7 +63,7 @@ jobs: run: choco install winfsp --version 1.10.22006 -y - name: Maven build run: mvn -B verify -Pwin - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: coverage-win path: jfuse-tests/target/site/jacoco-aggregate/jacoco.xml @@ -74,29 +74,29 @@ jobs: needs: [linux-amd64, mac, win] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: java-version: 19 distribution: 'zulu' cache: 'maven' - name: Cache SonarCloud packages - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: coverage-linux-amd64 path: coverage/linux-amd64 - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: coverage-mac path: coverage/mac - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v3 with: name: coverage-win path: coverage/win @@ -119,7 +119,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Create Release - uses: actions/create-release@v1 + uses: actions/create-release@v1 #REMARK: action/create-release is unmaintend env: GITHUB_TOKEN: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} # release as "cryptobot" with: diff --git a/.github/workflows/publish-central.yml b/.github/workflows/publish-central.yml index 006c5258..38d7fe23 100644 --- a/.github/workflows/publish-central.yml +++ b/.github/workflows/publish-central.yml @@ -10,10 +10,10 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: "refs/tags/${{ github.event.inputs.tag }}" - - uses: actions/setup-java@v2 + - uses: actions/setup-java@v3 with: java-version: 19 distribution: 'zulu' diff --git a/.github/workflows/publish-github.yml b/.github/workflows/publish-github.yml index 2ada729a..fbad902e 100644 --- a/.github/workflows/publish-github.yml +++ b/.github/workflows/publish-github.yml @@ -7,8 +7,8 @@ jobs: runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') # only allow publishing tagged versions steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 with: java-version: 19 distribution: 'zulu' From d645f08f566dc370a110172550bf519d8a7ae3e6 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Thu, 13 Oct 2022 14:08:05 +0200 Subject: [PATCH 27/41] make sure not to accidentally invoke jextract on parent --- README.md | 2 +- jfuse-linux-aarch64/pom.xml | 4 ---- jfuse-linux-amd64/pom.xml | 4 ---- jfuse-mac/README.md | 2 +- jfuse-mac/pom.xml | 8 ++------ jfuse-win/README.md | 2 +- jfuse-win/pom.xml | 4 ---- pom.xml | 26 ++++++++++++++++++++++++++ 8 files changed, 31 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 6a7cf439..6506d3dc 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ Each platform has its own module. In rare cases, we need to update jextracted cl In most cases this requires you to run the build on the target platform, as you need access to its system-specific header files and (most likely) build tools. See module readme for specific requirements. -In order to run `jextract`, use the corresponding Maven profile (`-Pjextract`). +In order to run `jextract`, switch to the submodule that you want to update and use the corresponding Maven profile (`-Pjextract`). Using this profile on the parent module is not supported. ### Adding a new platform diff --git a/jfuse-linux-aarch64/pom.xml b/jfuse-linux-aarch64/pom.xml index 10f8575e..ea26660e 100644 --- a/jfuse-linux-aarch64/pom.xml +++ b/jfuse-linux-aarch64/pom.xml @@ -41,10 +41,6 @@ - - unix - This build configuration requires Linux. - ${linux.headerSearchPath} diff --git a/jfuse-linux-amd64/pom.xml b/jfuse-linux-amd64/pom.xml index 28a13587..a5a55996 100644 --- a/jfuse-linux-amd64/pom.xml +++ b/jfuse-linux-amd64/pom.xml @@ -41,10 +41,6 @@ - - unix - This build configuration requires Linux. - ${linux.headerSearchPath} diff --git a/jfuse-mac/README.md b/jfuse-mac/README.md index c0d98487..167c1dc1 100644 --- a/jfuse-mac/README.md +++ b/jfuse-mac/README.md @@ -2,4 +2,4 @@ ## Requirements for `jextract` -In order to run `jextract`, you need to install Xcode. \ No newline at end of file +In order to run `jextract`, you need to install Xcode to get access to the macOS headers. \ No newline at end of file diff --git a/jfuse-mac/pom.xml b/jfuse-mac/pom.xml index 344b4cab..22758a7b 100644 --- a/jfuse-mac/pom.xml +++ b/jfuse-mac/pom.xml @@ -41,15 +41,11 @@ - - mac - This build configuration requires macOS. - - /Applications/Xcode.app + ${mac.headerSearchPath} - XCode not found. + macOS headers not found. diff --git a/jfuse-win/README.md b/jfuse-win/README.md index c92b275f..b246309f 100644 --- a/jfuse-win/README.md +++ b/jfuse-win/README.md @@ -1,4 +1,4 @@ -# jFUSE Windows x86_64 +# jFUSE Windows x86_64 and arm64 ## Requirements for `jextract` diff --git a/jfuse-win/pom.xml b/jfuse-win/pom.xml index 31e320f2..a26d35c5 100644 --- a/jfuse-win/pom.xml +++ b/jfuse-win/pom.xml @@ -41,10 +41,6 @@ - - windows - This build configuration requires Windows. - ${win.ucrtHeaderPath} diff --git a/pom.xml b/pom.xml index 9d24fdc1..3849d36e 100644 --- a/pom.xml +++ b/pom.xml @@ -200,6 +200,32 @@ + + jextract + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + prohibit-jextract-on-parent + + enforce + + + + + Using the jextract profile is only supported on submodules. + + + + + + + + + test From dd44c125ff196ac78552c58c27a39583c89836d7 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 18 Oct 2022 10:49:18 +0200 Subject: [PATCH 28/41] use separate profiles for `jextract-win`, `jextract-mac`, ... [ci skip] --- README.md | 2 +- jfuse-linux-aarch64/pom.xml | 2 +- jfuse-linux-amd64/pom.xml | 2 +- jfuse-mac/pom.xml | 2 +- jfuse-win/pom.xml | 2 +- pom.xml | 27 --------------------------- 6 files changed, 5 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 6506d3dc..00c1c90c 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ Each platform has its own module. In rare cases, we need to update jextracted cl In most cases this requires you to run the build on the target platform, as you need access to its system-specific header files and (most likely) build tools. See module readme for specific requirements. -In order to run `jextract`, switch to the submodule that you want to update and use the corresponding Maven profile (`-Pjextract`). Using this profile on the parent module is not supported. +In order to run `jextract`, use the corresponding Maven profile (e.g. `-Pjextract-win`). ### Adding a new platform diff --git a/jfuse-linux-aarch64/pom.xml b/jfuse-linux-aarch64/pom.xml index ea26660e..f345e90c 100644 --- a/jfuse-linux-aarch64/pom.xml +++ b/jfuse-linux-aarch64/pom.xml @@ -27,7 +27,7 @@ - jextract + jextract-linux-aarch64 diff --git a/jfuse-linux-amd64/pom.xml b/jfuse-linux-amd64/pom.xml index a5a55996..bbffcc11 100644 --- a/jfuse-linux-amd64/pom.xml +++ b/jfuse-linux-amd64/pom.xml @@ -27,7 +27,7 @@ - jextract + jextract-linux-amd64 diff --git a/jfuse-mac/pom.xml b/jfuse-mac/pom.xml index 22758a7b..37dadbdb 100644 --- a/jfuse-mac/pom.xml +++ b/jfuse-mac/pom.xml @@ -27,7 +27,7 @@ - jextract + jextract-mac diff --git a/jfuse-win/pom.xml b/jfuse-win/pom.xml index a26d35c5..afb28f2f 100644 --- a/jfuse-win/pom.xml +++ b/jfuse-win/pom.xml @@ -27,7 +27,7 @@ - jextract + jextract-win diff --git a/pom.xml b/pom.xml index 3849d36e..079d450f 100644 --- a/pom.xml +++ b/pom.xml @@ -200,33 +200,6 @@ - - jextract - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - prohibit-jextract-on-parent - - enforce - - - - - Using the jextract profile is only supported on submodules. - - - - - - - - - - test From ef8302d0197db280fe8a36043ba17a9b7c1f31a2 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 18 Oct 2022 12:17:22 +0200 Subject: [PATCH 29/41] add accessors for st_uid and st_gid --- .../java/org/cryptomator/jfuse/api/Stat.java | 8 +++ .../org/cryptomator/jfuse/api/StatTest.java | 70 +++---------------- .../jfuse/linux/aarch64/StatImpl.java | 20 ++++++ .../jfuse/linux/amd64/StatImpl.java | 20 ++++++ .../org/cryptomator/jfuse/mac/StatImpl.java | 20 ++++++ .../org/cryptomator/jfuse/win/StatImpl.java | 20 ++++++ 6 files changed, 99 insertions(+), 59 deletions(-) diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Stat.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Stat.java index 9d16d292..6fdb3503 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Stat.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Stat.java @@ -107,6 +107,14 @@ public interface Stat { int getMode(); + void setUid(int uid); + + int getUid(); + + void setGid(int gid); + + int getGid(); + void setNLink(short count); long getNLink(); diff --git a/jfuse-api/src/test/java/org/cryptomator/jfuse/api/StatTest.java b/jfuse-api/src/test/java/org/cryptomator/jfuse/api/StatTest.java index cfcfa811..b6e3f68b 100644 --- a/jfuse-api/src/test/java/org/cryptomator/jfuse/api/StatTest.java +++ b/jfuse-api/src/test/java/org/cryptomator/jfuse/api/StatTest.java @@ -18,7 +18,7 @@ public class StatTest { private static final int MAGIC = 123456;//some rando number - public Stat stat = Mockito.spy(new StubStatImpl()); + public Stat stat = Mockito.mock(Stat.class); @Nested @DisplayName("Test File Type Predicates") @@ -99,7 +99,8 @@ public class Permissions { "0010644,rw-r--r--" }) public void getPermissions(String mode, String perms) { - Mockito.when(stat.getMode()).thenReturn(Integer.valueOf(mode, 8)); + Mockito.doReturn(Integer.valueOf(mode, 8)).when(stat).getMode(); + Mockito.doCallRealMethod().when(stat).getPermissions(); var expected = PosixFilePermissions.fromString(perms); var result = stat.getPermissions(); @@ -114,7 +115,8 @@ public void getPermissions(String mode, String perms) { "0644,rw-r--r--", }) public void setPermissions(String mode, String perms) { - Mockito.when(stat.getMode()).thenReturn(S_IFDIR); + Mockito.doReturn(S_IFDIR).when(stat).getMode(); + Mockito.doCallRealMethod().when(stat).setPermissions(Mockito.any()); var permissions = PosixFilePermissions.fromString(perms); stat.setPermissions(permissions); @@ -127,7 +129,8 @@ public void setPermissions(String mode, String perms) { @ParameterizedTest @ValueSource(booleans = {true, false}) public void testHasMode(boolean isPresent) { - Mockito.when(stat.getMode()).thenReturn(isPresent ? MAGIC : ~MAGIC); + Mockito.doReturn(isPresent ? MAGIC : ~MAGIC).when(stat).getMode(); + Mockito.doCallRealMethod().when(stat).hasMode(Mockito.anyInt()); boolean result = stat.hasMode(MAGIC); @@ -137,7 +140,8 @@ public void testHasMode(boolean isPresent) { @Test @DisplayName("setModeBits()") public void testSetModeBits() { - Mockito.when(stat.getMode()).thenReturn(0755); + Mockito.doReturn(0755).when(stat).getMode(); + Mockito.doCallRealMethod().when(stat).setModeBits(Mockito.anyInt()); stat.setModeBits(S_IFDIR); @@ -147,64 +151,12 @@ public void testSetModeBits() { @Test @DisplayName("unsetModeBits()") public void testUnsetModeBits() { - Mockito.when(stat.getMode()).thenReturn(S_IFDIR | 0755); + Mockito.doReturn(S_IFDIR | 0755).when(stat).getMode(); + Mockito.doCallRealMethod().when(stat).unsetModeBits(Mockito.anyInt()); stat.unsetModeBits(S_IFDIR); Mockito.verify(stat).setMode(0755); } - private static class StubStatImpl implements Stat { - - @Override - public TimeSpec aTime() { - return null; - } - - @Override - public TimeSpec cTime() { - return null; - } - - @Override - public TimeSpec mTime() { - return null; - } - - @Override - public TimeSpec birthTime() { - return null; - } - - @Override - public void setMode(int mode) { - - } - - @Override - public int getMode() { - return 0; - } - - @Override - public void setNLink(short count) { - - } - - @Override - public long getNLink() { - return 0; - } - - @Override - public void setSize(long size) { - - } - - @Override - public long getSize() { - return 0; - } - } - } diff --git a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/StatImpl.java b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/StatImpl.java index 35be683d..2f75b36b 100644 --- a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/StatImpl.java +++ b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/StatImpl.java @@ -46,6 +46,26 @@ public int getMode() { return stat.st_mode$get(segment); } + @Override + public void setUid(int uid) { + stat.st_uid$set(segment, uid); + } + + @Override + public int getUid() { + return stat.st_uid$get(segment); + } + + @Override + public void setGid(int gid) { + stat.st_gid$set(segment, gid); + } + + @Override + public int getGid() { + return stat.st_gid$get(segment); + } + @Override public void setNLink(short count) { stat.st_nlink$set(segment, count); diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/StatImpl.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/StatImpl.java index ad68f710..9200e5ef 100644 --- a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/StatImpl.java +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/StatImpl.java @@ -45,6 +45,26 @@ public int getMode() { return stat.st_mode$get(segment); } + @Override + public void setUid(int uid) { + stat.st_uid$set(segment, uid); + } + + @Override + public int getUid() { + return stat.st_uid$get(segment); + } + + @Override + public void setGid(int gid) { + stat.st_gid$set(segment, gid); + } + + @Override + public int getGid() { + return stat.st_gid$get(segment); + } + @Override public void setNLink(short count) { stat.st_nlink$set(segment, count); diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatImpl.java index e4e0af51..56bb8ab1 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatImpl.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatImpl.java @@ -45,6 +45,26 @@ public int getMode() { return stat.st_mode$get(segment); } + @Override + public void setUid(int uid) { + stat.st_uid$set(segment, uid); + } + + @Override + public int getUid() { + return stat.st_uid$get(segment); + } + + @Override + public void setGid(int gid) { + stat.st_gid$set(segment, gid); + } + + @Override + public int getGid() { + return stat.st_gid$get(segment); + } + @Override public void setNLink(short count) { stat.st_nlink$set(segment, count); diff --git a/jfuse-win/src/main/java/org/cryptomator/jfuse/win/StatImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/StatImpl.java index 38221522..49e6b92a 100644 --- a/jfuse-win/src/main/java/org/cryptomator/jfuse/win/StatImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/StatImpl.java @@ -44,6 +44,26 @@ public int getMode() { return fuse_stat.st_mode$get(segment); } + @Override + public void setUid(int uid) { + fuse_stat.st_uid$set(segment, uid); + } + + @Override + public int getUid() { + return fuse_stat.st_uid$get(segment); + } + + @Override + public void setGid(int gid) { + fuse_stat.st_gid$set(segment, gid); + } + + @Override + public int getGid() { + return fuse_stat.st_gid$get(segment); + } + @Override public void setNLink(short count) { fuse_stat.st_nlink$set(segment, count); From c62671039ba4b9b0134b3fdb6cbdeb335e7afb55 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 18 Oct 2022 13:15:28 +0200 Subject: [PATCH 30/41] add unit tests for `StatImpl` --- .../jfuse/linux/aarch64/StatImplTest.java | 76 +++++++++++++++++++ .../jfuse/linux/amd64/StatImplTest.java | 76 +++++++++++++++++++ .../cryptomator/jfuse/mac/StatImplTest.java | 76 +++++++++++++++++++ .../cryptomator/jfuse/win/StatImplTest.java | 76 +++++++++++++++++++ 4 files changed, 304 insertions(+) create mode 100644 jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/StatImplTest.java create mode 100644 jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/StatImplTest.java create mode 100644 jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/StatImplTest.java create mode 100644 jfuse-win/src/test/java/org/cryptomator/jfuse/win/StatImplTest.java diff --git a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/StatImplTest.java b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/StatImplTest.java new file mode 100644 index 00000000..b13b839f --- /dev/null +++ b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/StatImplTest.java @@ -0,0 +1,76 @@ +package org.cryptomator.jfuse.linux.aarch64; + +import org.cryptomator.jfuse.api.Stat; +import org.cryptomator.jfuse.linux.aarch64.extr.stat; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Named; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.lang.foreign.MemorySegment; +import java.lang.foreign.MemorySession; +import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.stream.Stream; + +public class StatImplTest { + + @DisplayName("test getters") + @ParameterizedTest(name = "{1}") + @MethodSource + public void testGetters(SetInMemorySegment setter, GetInStat getter, Number value) { + try (var scope = MemorySession.openConfined()) { + var segment = stat.allocate(scope); + var stat = new StatImpl(segment.address(), scope); + + setter.accept(segment, value); + + Assertions.assertEquals(value.longValue(), getter.apply(stat).longValue()); + } + } + + public static Stream testGetters() { + return Stream.of( + Arguments.arguments((SetInMemorySegment) stat::st_mode$set, Named.of("getMode()", (GetInStat) Stat::getMode), 42), + Arguments.arguments((SetInMemorySegment) stat::st_uid$set, Named.of("getUid()", (GetInStat) Stat::getUid), 42), + Arguments.arguments((SetInMemorySegment) stat::st_gid$set, Named.of("getGid()", (GetInStat) Stat::getGid), 42), + Arguments.arguments((SetInMemorySegment) stat::st_nlink$set, Named.of("getNLink()", (GetInStat) Stat::getNLink), 42), + Arguments.arguments((SetInMemorySegment) stat::st_size$set, Named.of("getSize()", (GetInStat) Stat::getSize), 42L) + ); + } + + private interface SetInMemorySegment extends BiConsumer {} + + private interface GetInStat extends Function {} + + @DisplayName("test setters") + @ParameterizedTest(name = "{0}") + @MethodSource + public void testSetters(SetInStat setter, GetInMemorySegment getter, Number value) { + try (var scope = MemorySession.openConfined()) { + var segment = stat.allocate(scope); + var stat = new StatImpl(segment.address(), scope); + + setter.accept(stat, value); + + Assertions.assertEquals(value.longValue(), getter.apply(segment).longValue()); + } + } + + public static Stream testSetters() { + return Stream.of( + Arguments.arguments(Named.of("setMode()", (SetInStat) Stat::setMode), (GetInMemorySegment) stat::st_mode$get, 42), + Arguments.arguments(Named.of("setUid()", (SetInStat) Stat::setUid), (GetInMemorySegment) stat::st_uid$get, 42), + Arguments.arguments(Named.of("setGid()", (SetInStat) Stat::setGid), (GetInMemorySegment) stat::st_gid$get, 42), + Arguments.arguments(Named.of("setNLink()", (SetInStat) Stat::setNLink), (GetInMemorySegment) stat::st_nlink$get, (short) 42), + Arguments.arguments(Named.of("setSize()", (SetInStat) Stat::setSize), (GetInMemorySegment) stat::st_size$get, 42L) + ); + } + + private interface SetInStat extends BiConsumer {} + + private interface GetInMemorySegment extends Function {} + +} \ No newline at end of file diff --git a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/StatImplTest.java b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/StatImplTest.java new file mode 100644 index 00000000..d898189a --- /dev/null +++ b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/StatImplTest.java @@ -0,0 +1,76 @@ +package org.cryptomator.jfuse.linux.amd64; + +import org.cryptomator.jfuse.api.Stat; +import org.cryptomator.jfuse.linux.amd64.extr.stat; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Named; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.lang.foreign.MemorySegment; +import java.lang.foreign.MemorySession; +import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.stream.Stream; + +public class StatImplTest { + + @DisplayName("test getters") + @ParameterizedTest(name = "{1}") + @MethodSource + public void testGetters(SetInMemorySegment setter, GetInStat getter, Number value) { + try (var scope = MemorySession.openConfined()) { + var segment = stat.allocate(scope); + var stat = new StatImpl(segment.address(), scope); + + setter.accept(segment, value); + + Assertions.assertEquals(value.longValue(), getter.apply(stat).longValue()); + } + } + + public static Stream testGetters() { + return Stream.of( + Arguments.arguments((SetInMemorySegment) stat::st_mode$set, Named.of("getMode()", (GetInStat) Stat::getMode), 42), + Arguments.arguments((SetInMemorySegment) stat::st_uid$set, Named.of("getUid()", (GetInStat) Stat::getUid), 42), + Arguments.arguments((SetInMemorySegment) stat::st_gid$set, Named.of("getGid()", (GetInStat) Stat::getGid), 42), + Arguments.arguments((SetInMemorySegment) stat::st_nlink$set, Named.of("getNLink()", (GetInStat) Stat::getNLink), 42L), + Arguments.arguments((SetInMemorySegment) stat::st_size$set, Named.of("getSize()", (GetInStat) Stat::getSize), 42L) + ); + } + + private interface SetInMemorySegment extends BiConsumer {} + + private interface GetInStat extends Function {} + + @DisplayName("test setters") + @ParameterizedTest(name = "{0}") + @MethodSource + public void testSetters(SetInStat setter, GetInMemorySegment getter, Number value) { + try (var scope = MemorySession.openConfined()) { + var segment = stat.allocate(scope); + var stat = new StatImpl(segment.address(), scope); + + setter.accept(stat, value); + + Assertions.assertEquals(value.longValue(), getter.apply(segment).longValue()); + } + } + + public static Stream testSetters() { + return Stream.of( + Arguments.arguments(Named.of("setMode()", (SetInStat) Stat::setMode), (GetInMemorySegment) stat::st_mode$get, 42), + Arguments.arguments(Named.of("setUid()", (SetInStat) Stat::setUid), (GetInMemorySegment) stat::st_uid$get, 42), + Arguments.arguments(Named.of("setGid()", (SetInStat) Stat::setGid), (GetInMemorySegment) stat::st_gid$get, 42), + Arguments.arguments(Named.of("setNLink()", (SetInStat) Stat::setNLink), (GetInMemorySegment) stat::st_nlink$get, (short) 42), + Arguments.arguments(Named.of("setSize()", (SetInStat) Stat::setSize), (GetInMemorySegment) stat::st_size$get, 42L) + ); + } + + private interface SetInStat extends BiConsumer {} + + private interface GetInMemorySegment extends Function {} + +} \ No newline at end of file diff --git a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/StatImplTest.java b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/StatImplTest.java new file mode 100644 index 00000000..fb31d70f --- /dev/null +++ b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/StatImplTest.java @@ -0,0 +1,76 @@ +package org.cryptomator.jfuse.mac; + +import org.cryptomator.jfuse.api.Stat; +import org.cryptomator.jfuse.mac.extr.stat; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Named; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.lang.foreign.MemorySegment; +import java.lang.foreign.MemorySession; +import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.stream.Stream; + +public class StatImplTest { + + @DisplayName("test getters") + @ParameterizedTest(name = "{1}") + @MethodSource + public void testGetters(SetInMemorySegment setter, GetInStat getter, Number value) { + try (var scope = MemorySession.openConfined()) { + var segment = stat.allocate(scope); + var stat = new StatImpl(segment.address(), scope); + + setter.accept(segment, value); + + Assertions.assertEquals(value.longValue(), getter.apply(stat).longValue()); + } + } + + public static Stream testGetters() { + return Stream.of( + Arguments.arguments((SetInMemorySegment) stat::st_mode$set, Named.of("getMode()", (GetInStat) Stat::getMode), (short) 42), + Arguments.arguments((SetInMemorySegment) stat::st_uid$set, Named.of("getUid()", (GetInStat) Stat::getUid), 42), + Arguments.arguments((SetInMemorySegment) stat::st_gid$set, Named.of("getGid()", (GetInStat) Stat::getGid), 42), + Arguments.arguments((SetInMemorySegment) stat::st_nlink$set, Named.of("getNLink()", (GetInStat) Stat::getNLink), (short) 42), + Arguments.arguments((SetInMemorySegment) stat::st_size$set, Named.of("getSize()", (GetInStat) Stat::getSize), 42L) + ); + } + + private interface SetInMemorySegment extends BiConsumer {} + + private interface GetInStat extends Function {} + + @DisplayName("test setters") + @ParameterizedTest(name = "{0}") + @MethodSource + public void testSetters(SetInStat setter, GetInMemorySegment getter, Number value) { + try (var scope = MemorySession.openConfined()) { + var segment = stat.allocate(scope); + var stat = new StatImpl(segment.address(), scope); + + setter.accept(stat, value); + + Assertions.assertEquals(value.longValue(), getter.apply(segment).longValue()); + } + } + + public static Stream testSetters() { + return Stream.of( + Arguments.arguments(Named.of("setMode()", (SetInStat) Stat::setMode), (GetInMemorySegment) stat::st_mode$get, 42), + Arguments.arguments(Named.of("setUid()", (SetInStat) Stat::setUid), (GetInMemorySegment) stat::st_uid$get, 42), + Arguments.arguments(Named.of("setGid()", (SetInStat) Stat::setGid), (GetInMemorySegment) stat::st_gid$get, 42), + Arguments.arguments(Named.of("setNLink()", (SetInStat) Stat::setNLink), (GetInMemorySegment) stat::st_nlink$get, (short) 42), + Arguments.arguments(Named.of("setSize()", (SetInStat) Stat::setSize), (GetInMemorySegment) stat::st_size$get, 42L) + ); + } + + private interface SetInStat extends BiConsumer {} + + private interface GetInMemorySegment extends Function {} + +} \ No newline at end of file diff --git a/jfuse-win/src/test/java/org/cryptomator/jfuse/win/StatImplTest.java b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/StatImplTest.java new file mode 100644 index 00000000..13ecddd0 --- /dev/null +++ b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/StatImplTest.java @@ -0,0 +1,76 @@ +package org.cryptomator.jfuse.win; + +import org.cryptomator.jfuse.api.Stat; +import org.cryptomator.jfuse.win.extr.fuse_stat; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Named; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.lang.foreign.MemorySegment; +import java.lang.foreign.MemorySession; +import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.stream.Stream; + +public class StatImplTest { + + @DisplayName("test getters") + @ParameterizedTest(name = "{1}") + @MethodSource + public void testGetters(SetInMemorySegment setter, GetInStat getter, Number value) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse_stat.allocate(scope); + var stat = new StatImpl(segment.address(), scope); + + setter.accept(segment, value); + + Assertions.assertEquals(value.longValue(), getter.apply(stat).longValue()); + } + } + + public static Stream testGetters() { + return Stream.of( + Arguments.arguments((SetInMemorySegment) fuse_stat::st_mode$set, Named.of("getMode()", (GetInStat) Stat::getMode), 42), + Arguments.arguments((SetInMemorySegment) fuse_stat::st_uid$set, Named.of("getUid()", (GetInStat) Stat::getUid), 42), + Arguments.arguments((SetInMemorySegment) fuse_stat::st_gid$set, Named.of("getGid()", (GetInStat) Stat::getGid), 42), + Arguments.arguments((SetInMemorySegment) fuse_stat::st_nlink$set, Named.of("getNLink()", (GetInStat) Stat::getNLink), (short) 42), + Arguments.arguments((SetInMemorySegment) fuse_stat::st_size$set, Named.of("getSize()", (GetInStat) Stat::getSize), 42L) + ); + } + + private interface SetInMemorySegment extends BiConsumer {} + + private interface GetInStat extends Function {} + + @DisplayName("test setters") + @ParameterizedTest(name = "{0}") + @MethodSource + public void testSetters(SetInStat setter, GetInMemorySegment getter, Number value) { + try (var scope = MemorySession.openConfined()) { + var segment = fuse_stat.allocate(scope); + var stat = new StatImpl(segment.address(), scope); + + setter.accept(stat, value); + + Assertions.assertEquals(value.longValue(), getter.apply(segment).longValue()); + } + } + + public static Stream testSetters() { + return Stream.of( + Arguments.arguments(Named.of("setMode()", (SetInStat) Stat::setMode), (GetInMemorySegment) fuse_stat::st_mode$get, 42), + Arguments.arguments(Named.of("setUid()", (SetInStat) Stat::setUid), (GetInMemorySegment) fuse_stat::st_uid$get, 42), + Arguments.arguments(Named.of("setGid()", (SetInStat) Stat::setGid), (GetInMemorySegment) fuse_stat::st_gid$get, 42), + Arguments.arguments(Named.of("setNLink()", (SetInStat) Stat::setNLink), (GetInMemorySegment) fuse_stat::st_nlink$get, (short) 42), + Arguments.arguments(Named.of("setSize()", (SetInStat) Stat::setSize), (GetInMemorySegment) fuse_stat::st_size$get, 42L) + ); + } + + private interface SetInStat extends BiConsumer {} + + private interface GetInMemorySegment extends Function {} + +} \ No newline at end of file From 7156ca0e98a378a5b32716fd9c9e74e273890b14 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 18 Oct 2022 14:11:02 +0200 Subject: [PATCH 31/41] fix coverage and CI config after merging #17 --- .github/workflows/build.yml | 7 +++---- .github/workflows/publish-central.yml | 2 +- .github/workflows/publish-github.yml | 2 +- jfuse-tests/pom.xml | 23 ++++++++++++++++++++++- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1e0104f..2d9cb3ad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,7 @@ jobs: sudo apt-get update sudo apt-get install fuse3 libfuse3-dev - name: Maven build - run: mvn -B verify -Plinux-amd64 + run: mvn -B verify - uses: actions/upload-artifact@v3 with: name: coverage-linux-amd64 @@ -41,7 +41,7 @@ jobs: - name: Setup fuse run: brew install macfuse - name: Maven build - run: mvn -B verify -Pmac + run: mvn -B verify - uses: actions/upload-artifact@v3 with: name: coverage-mac @@ -62,7 +62,7 @@ jobs: - name: Setup fuse run: choco install winfsp --version 1.10.22006 -y - name: Maven build - run: mvn -B verify -Pwin + run: mvn -B verify - uses: actions/upload-artifact@v3 with: name: coverage-win @@ -104,7 +104,6 @@ jobs: run: > mvn -B compile -DskipTests org.sonarsource.scanner.maven:sonar-maven-plugin:sonar - -Plinux-amd64,linux-aarch64,mac,win -Dsonar.projectKey=cryptomator_jfuse -Dsonar.coverage.jacoco.xmlReportPaths=${GITHUB_WORKSPACE}/coverage/**/jacoco.xml -Dsonar.organization=cryptomator diff --git a/.github/workflows/publish-central.yml b/.github/workflows/publish-central.yml index 38d7fe23..c3f28206 100644 --- a/.github/workflows/publish-central.yml +++ b/.github/workflows/publish-central.yml @@ -26,7 +26,7 @@ jobs: - name: Enforce project version ${{ github.event.inputs.tag }} run: mvn versions:set -B -DnewVersion=${{ github.event.inputs.tag }} - name: Deploy - run: mvn deploy -B -DskipTests -Psign,deploy-central,linux-amd64,linux-aarch64,mac,win --no-transfer-progress + run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} diff --git a/.github/workflows/publish-github.yml b/.github/workflows/publish-github.yml index fbad902e..b233f6ce 100644 --- a/.github/workflows/publish-github.yml +++ b/.github/workflows/publish-github.yml @@ -18,7 +18,7 @@ jobs: - name: Enforce project version ${{ github.event.release.tag_name }} run: mvn versions:set -B -DnewVersion=${{ github.event.release.tag_name }} - name: Deploy - run: mvn deploy -B -DskipTests -Psign,deploy-github,linux-amd64,linux-aarch64,mac,win --no-transfer-progress + run: mvn deploy -B -DskipTests -Psign,deploy-github --no-transfer-progress env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }} diff --git a/jfuse-tests/pom.xml b/jfuse-tests/pom.xml index e619caf4..d00f34af 100644 --- a/jfuse-tests/pom.xml +++ b/jfuse-tests/pom.xml @@ -17,9 +17,30 @@ + org.cryptomator - jfuse + jfuse-api + ${project.version} + + + org.cryptomator + jfuse-linux-aarch64 + ${project.version} + + + org.cryptomator + jfuse-linux-amd64 + ${project.version} + + + org.cryptomator + jfuse-mac + ${project.version} + + + org.cryptomator + jfuse-win ${project.version} From ce8c829c4fbb1a7f7f0f3bde0e659f85ff526a36 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 18 Oct 2022 15:23:18 +0200 Subject: [PATCH 32/41] add `chown` support --- .../org/cryptomator/jfuse/api/FuseOperations.java | 1 + .../cryptomator/jfuse/linux/aarch64/FuseImpl.java | 8 ++++++++ .../jfuse/linux/aarch64/FuseImplTest.java | 13 +++++++++++++ .../cryptomator/jfuse/linux/amd64/FuseImpl.java | 8 ++++++++ .../jfuse/linux/amd64/FuseImplTest.java | 14 ++++++++++++++ .../java/org/cryptomator/jfuse/mac/FuseImpl.java | 6 ++++++ .../org/cryptomator/jfuse/mac/FuseImplTest.java | 13 +++++++++++++ .../java/org/cryptomator/jfuse/win/FuseImpl.java | 8 ++++++++ .../org/cryptomator/jfuse/win/FuseImplTest.java | 14 ++++++++++++++ 9 files changed, 85 insertions(+) diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java index 1cec1b9c..efe9e712 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java @@ -16,6 +16,7 @@ public interface FuseOperations { enum Operation { ACCESS, CHMOD, + CHOWN, CREATE, DESTROY, GET_ATTR, diff --git a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java index a8e1edeb..25d64b17 100644 --- a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java +++ b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java @@ -76,6 +76,7 @@ private void bind(FuseOperations.Operation operation) { case INIT -> fuse_operations.init$set(fuseOps, fuse_operations.init.allocate(this::init, fuseScope).address()); case ACCESS -> fuse_operations.access$set(fuseOps, fuse_operations.access.allocate(this::access, fuseScope).address()); case CHMOD -> fuse_operations.chmod$set(fuseOps, fuse_operations.chmod.allocate(this::chmod, fuseScope).address()); + case CHOWN -> fuse_operations.chown$set(fuseOps, fuse_operations.chown.allocate(this::chown, fuseScope).address()); case CREATE -> fuse_operations.create$set(fuseOps, fuse_operations.create.allocate(this::create, fuseScope).address()); case DESTROY -> fuse_operations.destroy$set(fuseOps, fuse_operations.destroy.allocate(this::destroy, fuseScope).address()); case GET_ATTR -> fuse_operations.getattr$set(fuseOps, fuse_operations.getattr.allocate(this::getattr, fuseScope).address()); @@ -119,6 +120,13 @@ private int chmod(MemoryAddress path, int mode, MemoryAddress fi) { } } + @VisibleForTesting + int chown(MemoryAddress path, int uid, int gid, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.chown(path.getUtf8String(0), uid, gid, new FileInfoImpl(fi, scope)); + } + } + private int create(MemoryAddress path, int mode, MemoryAddress fi) { try (var scope = MemorySession.openConfined()) { return delegate.create(path.getUtf8String(0), mode, new FileInfoImpl(fi, scope)); diff --git a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java index a0fb328b..04afad4c 100644 --- a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java +++ b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java @@ -186,4 +186,17 @@ public void testUtimens(long sec0, long nsec0, long sec1, long nsec1) { } } + @Test + @DisplayName("chown") + public void testChown() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).chown(Mockito.eq("/foo"), Mockito.eq(42), Mockito.eq(1337), Mockito.any()); + + var result = fuseImpl.chown(path.address(), 42, 1337, fi.address()); + + Assertions.assertEquals(42, result); + } + } } \ No newline at end of file diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java index 57eb3db4..0b392678 100644 --- a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java @@ -76,6 +76,7 @@ private void bind(FuseOperations.Operation operation) { case INIT -> fuse_operations.init$set(fuseOps, fuse_operations.init.allocate(this::init, fuseScope).address()); case ACCESS -> fuse_operations.access$set(fuseOps, fuse_operations.access.allocate(this::access, fuseScope).address()); case CHMOD -> fuse_operations.chmod$set(fuseOps, fuse_operations.chmod.allocate(this::chmod, fuseScope).address()); + case CHOWN -> fuse_operations.chown$set(fuseOps, fuse_operations.chown.allocate(this::chown, fuseScope).address()); case CREATE -> fuse_operations.create$set(fuseOps, fuse_operations.create.allocate(this::create, fuseScope).address()); case DESTROY -> fuse_operations.destroy$set(fuseOps, fuse_operations.destroy.allocate(this::destroy, fuseScope).address()); case GET_ATTR -> fuse_operations.getattr$set(fuseOps, fuse_operations.getattr.allocate(this::getattr, fuseScope).address()); @@ -119,6 +120,13 @@ private int chmod(MemoryAddress path, int mode, MemoryAddress fi) { } } + @VisibleForTesting + int chown(MemoryAddress path, int uid, int gid, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.chown(path.getUtf8String(0), uid, gid, new FileInfoImpl(fi, scope)); + } + } + private int create(MemoryAddress path, int mode, MemoryAddress fi) { try (var scope = MemorySession.openConfined()) { return delegate.create(path.getUtf8String(0), mode, new FileInfoImpl(fi, scope)); diff --git a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java index 931f729c..774b688e 100644 --- a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java +++ b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java @@ -186,4 +186,18 @@ public void testUtimens(long sec0, long nsec0, long sec1, long nsec1) { } } + @Test + @DisplayName("chown") + public void testChown() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).chown(Mockito.eq("/foo"), Mockito.eq(42), Mockito.eq(1337), Mockito.any()); + + var result = fuseImpl.chown(path.address(), 42, 1337, fi.address()); + + Assertions.assertEquals(42, result); + } + } + } \ No newline at end of file diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java index 61dc604a..1449c949 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java @@ -78,6 +78,7 @@ private void bind(FuseOperations.Operation operation) { case INIT -> fuse_operations.init$set(fuseOps, fuse_operations.init.allocate(this::init, fuseScope).address()); case ACCESS -> fuse_operations.access$set(fuseOps, fuse_operations.access.allocate(this::access, fuseScope).address()); case CHMOD -> fuse_operations.chmod$set(fuseOps, fuse_operations.chmod.allocate(this::chmod, fuseScope).address()); + case CHOWN -> fuse_operations.chown$set(fuseOps, fuse_operations.chown.allocate(this::chown, fuseScope).address()); case CREATE -> fuse_operations.create$set(fuseOps, fuse_operations.create.allocate(this::create, fuseScope).address()); case DESTROY -> fuse_operations.destroy$set(fuseOps, fuse_operations.destroy.allocate(this::destroy, fuseScope).address()); case GET_ATTR -> { @@ -121,6 +122,11 @@ private int chmod(MemoryAddress path, short mode) { return delegate.chmod(path.getUtf8String(0), mode, null); } + @VisibleForTesting + int chown(MemoryAddress path, int uid, int gid) { + return delegate.chown(path.getUtf8String(0), uid, gid, null); + } + private int create(MemoryAddress path, short mode, MemoryAddress fi) { try (var scope = MemorySession.openConfined()) { return delegate.create(path.getUtf8String(0), mode, new FileInfoImpl(fi, scope)); diff --git a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseImplTest.java b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseImplTest.java index 9e4140d4..81ff5343 100644 --- a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseImplTest.java +++ b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseImplTest.java @@ -212,4 +212,17 @@ public void testFtruncate() { } + @Test + @DisplayName("chown") + public void testChown() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + Mockito.doReturn(42).when(fuseOps).chown("/foo", 42, 1337, null); + + var result = fuseImpl.chown(path.address(), 42, 1337); + + Assertions.assertEquals(42, result); + } + } + } \ No newline at end of file diff --git a/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseImpl.java index 750374c3..1b3293de 100644 --- a/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseImpl.java @@ -120,6 +120,7 @@ private void bind(FuseOperations.Operation operation) { case INIT -> fuse3_operations.init$set(fuseOps, fuse3_operations.init.allocate(this::init, fuseScope).address()); case ACCESS -> fuse3_operations.access$set(fuseOps, MemoryAddress.NULL); case CHMOD -> fuse3_operations.chmod$set(fuseOps, fuse3_operations.chmod.allocate(this::chmod, fuseScope).address()); + case CHOWN -> fuse3_operations.chown$set(fuseOps, fuse3_operations.chown.allocate(this::chown, fuseScope).address()); case CREATE -> fuse3_operations.create$set(fuseOps, fuse3_operations.create.allocate(this::create, fuseScope).address()); case DESTROY -> fuse3_operations.destroy$set(fuseOps, fuse3_operations.destroy.allocate(this::destroy, fuseScope).address()); case GET_ATTR -> fuse3_operations.getattr$set(fuseOps, fuse3_operations.getattr.allocate(this::getattr, fuseScope).address()); @@ -159,6 +160,13 @@ private int chmod(MemoryAddress path, int mode, MemoryAddress fi) { } } + @VisibleForTesting + int chown(MemoryAddress path, int uid, int gid, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.chown(path.getUtf8String(0), uid, gid, new FileInfoImpl(fi, scope)); + } + } + private int create(MemoryAddress path, int mode, MemoryAddress fi) { try (var scope = MemorySession.openConfined()) { return delegate.create(path.getUtf8String(0), mode, new FileInfoImpl(fi, scope)); diff --git a/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseImplTest.java b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseImplTest.java index 5f6a3bb5..f7209a35 100644 --- a/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseImplTest.java +++ b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseImplTest.java @@ -244,6 +244,20 @@ public void testTruncate() { } } + @Test + @DisplayName("chown") + public void testChown() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse3_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).chown(Mockito.eq("/foo"), Mockito.eq(42), Mockito.eq(1337), Mockito.any()); + + var result = fuseImpl.chown(path.address(), 42, 1337, fi.address()); + + Assertions.assertEquals(42, result); + } + } + private static ArgumentMatcher usesSameMemorySegement(MemorySegment expected) { return obj -> { if (obj instanceof FileInfoImpl fiImpl) { From f29fb6ceae2c8349e875286c13ae0ff7a61a1fe0 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 18 Oct 2022 16:55:09 +0200 Subject: [PATCH 33/41] mark chown as supported [ci skip] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 00c1c90c..99433e95 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Not all [`fuse_operations`](https://libfuse.github.io/doxygen/structfuse__operat | rename | :white_check_mark: | | link | :x: | | chmod | :white_check_mark: | -| chown | :x: | +| chown | :white_check_mark: | | truncate | :white_check_mark: | | ~ftruncate~ | use truncate | | ~utime~ | use utimens | From ab252e957447993665dd91b0d7e51d78ecf6ddd3 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 18 Oct 2022 17:26:14 +0200 Subject: [PATCH 34/41] add `flush`, `fsync`, `fsyncdir` support --- README.md | 6 +-- .../cryptomator/jfuse/api/FuseOperations.java | 3 ++ .../jfuse/linux/aarch64/FuseImpl.java | 24 ++++++++++ .../jfuse/linux/aarch64/FuseImplTest.java | 48 +++++++++++++++++++ .../jfuse/linux/amd64/FuseImpl.java | 24 ++++++++++ .../jfuse/linux/amd64/FuseImplTest.java | 48 +++++++++++++++++++ .../org/cryptomator/jfuse/mac/FuseImpl.java | 24 ++++++++++ .../cryptomator/jfuse/mac/FuseImplTest.java | 48 +++++++++++++++++++ .../org/cryptomator/jfuse/win/FuseImpl.java | 24 ++++++++++ .../cryptomator/jfuse/win/FuseImplTest.java | 48 +++++++++++++++++++ 10 files changed, 294 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 00c1c90c..cff59b96 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,9 @@ Not all [`fuse_operations`](https://libfuse.github.io/doxygen/structfuse__operat | read | :white_check_mark: | | write | :white_check_mark: | | statfs | :white_check_mark: | -| flush | :x: | +| flush | :white_check_mark: | | release | :white_check_mark: | -| fsync | :x: | +| fsync | :white_check_mark: | | setxattr | :x: | | getxattr | :x: | | listxattr | :x: | @@ -49,7 +49,7 @@ Not all [`fuse_operations`](https://libfuse.github.io/doxygen/structfuse__operat | opendir | :white_check_mark: | | readdir | :white_check_mark: | | releasedir | :white_check_mark: | -| fsyncdir | :x: | +| fsyncdir | :white_check_mark: | | init | :white_check_mark: | | destroy | :white_check_mark: | | access | :white_check_mark: (ignored on Windows) | diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java index 1cec1b9c..fcdff0db 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/FuseOperations.java @@ -18,6 +18,9 @@ enum Operation { CHMOD, CREATE, DESTROY, + FLUSH, + FSYNC, + FSYNCDIR, GET_ATTR, INIT, MKDIR, diff --git a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java index a8e1edeb..e1ccb69e 100644 --- a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java +++ b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/FuseImpl.java @@ -78,6 +78,9 @@ private void bind(FuseOperations.Operation operation) { case CHMOD -> fuse_operations.chmod$set(fuseOps, fuse_operations.chmod.allocate(this::chmod, fuseScope).address()); case CREATE -> fuse_operations.create$set(fuseOps, fuse_operations.create.allocate(this::create, fuseScope).address()); case DESTROY -> fuse_operations.destroy$set(fuseOps, fuse_operations.destroy.allocate(this::destroy, fuseScope).address()); + case FLUSH -> fuse_operations.flush$set(fuseOps, fuse_operations.flush.allocate(this::flush, fuseScope).address()); + case FSYNC -> fuse_operations.fsync$set(fuseOps, fuse_operations.fsync.allocate(this::fsync, fuseScope).address()); + case FSYNCDIR -> fuse_operations.fsyncdir$set(fuseOps, fuse_operations.fsyncdir.allocate(this::fsyncdir, fuseScope).address()); case GET_ATTR -> fuse_operations.getattr$set(fuseOps, fuse_operations.getattr.allocate(this::getattr, fuseScope).address()); case MKDIR -> fuse_operations.mkdir$set(fuseOps, fuse_operations.mkdir.allocate(this::mkdir, fuseScope).address()); case OPEN -> fuse_operations.open$set(fuseOps, fuse_operations.open.allocate(this::open, fuseScope).address()); @@ -129,6 +132,27 @@ private void destroy(MemoryAddress addr) { delegate.destroy(); } + @VisibleForTesting + int flush(MemoryAddress path, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.flush(path.getUtf8String(0), new FileInfoImpl(fi, scope)); + } + } + + @VisibleForTesting + int fsync(MemoryAddress path, int datasync, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.fsync(path.getUtf8String(0), datasync, new FileInfoImpl(fi, scope)); + } + } + + @VisibleForTesting + int fsyncdir(MemoryAddress path, int datasync, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.fsyncdir(path.getUtf8String(0), datasync, new FileInfoImpl(fi, scope)); + } + } + private int getattr(MemoryAddress path, MemoryAddress stat, MemoryAddress fi) { try (var scope = MemorySession.openConfined()) { return delegate.getattr(path.getUtf8String(0), new StatImpl(stat, scope), new FileInfoImpl(fi, scope)); diff --git a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java index a0fb328b..7917c5c6 100644 --- a/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java +++ b/jfuse-linux-aarch64/src/test/java/org/cryptomator/jfuse/linux/aarch64/FuseImplTest.java @@ -122,6 +122,54 @@ public void testParseArgs() { } } + @Nested + @DisplayName("flush/fsync/fsyncdir") + public class FlushFsyncFsyncdir { + + @Test + @DisplayName("flush(\"/foo\", fi)") + public void testFlush() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).flush(Mockito.eq("/foo"), Mockito.any()); + + var result = fuseImpl.flush(path.address(), fi.address()); + + Assertions.assertEquals(42, result); + } + } + + @Test + @DisplayName("fsync(\"/foo\", 1, fi)") + public void testFsync() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).fsync(Mockito.eq("/foo"), Mockito.eq(1), Mockito.any()); + + var result = fuseImpl.fsync(path.address(), 1, fi.address()); + + Assertions.assertEquals(42, result); + } + } + + @Test + @DisplayName("fsyncdir(\"/foo\", 1, fi)") + public void testFsyncdir() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).fsyncdir(Mockito.eq("/foo"), Mockito.eq(1), Mockito.any()); + + var result = fuseImpl.fsyncdir(path.address(), 1, fi.address()); + + Assertions.assertEquals(42, result); + } + } + + } + @DisplayName("init() sets fuse_conn_info.wants |= FUSE_CAP_READDIRPLUS") @Test public void testInit() { diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java index 57eb3db4..df8cd9f7 100644 --- a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/FuseImpl.java @@ -78,6 +78,9 @@ private void bind(FuseOperations.Operation operation) { case CHMOD -> fuse_operations.chmod$set(fuseOps, fuse_operations.chmod.allocate(this::chmod, fuseScope).address()); case CREATE -> fuse_operations.create$set(fuseOps, fuse_operations.create.allocate(this::create, fuseScope).address()); case DESTROY -> fuse_operations.destroy$set(fuseOps, fuse_operations.destroy.allocate(this::destroy, fuseScope).address()); + case FLUSH -> fuse_operations.flush$set(fuseOps, fuse_operations.flush.allocate(this::flush, fuseScope).address()); + case FSYNC -> fuse_operations.fsync$set(fuseOps, fuse_operations.fsync.allocate(this::fsync, fuseScope).address()); + case FSYNCDIR -> fuse_operations.fsyncdir$set(fuseOps, fuse_operations.fsyncdir.allocate(this::fsyncdir, fuseScope).address()); case GET_ATTR -> fuse_operations.getattr$set(fuseOps, fuse_operations.getattr.allocate(this::getattr, fuseScope).address()); case MKDIR -> fuse_operations.mkdir$set(fuseOps, fuse_operations.mkdir.allocate(this::mkdir, fuseScope).address()); case OPEN -> fuse_operations.open$set(fuseOps, fuse_operations.open.allocate(this::open, fuseScope).address()); @@ -129,6 +132,27 @@ private void destroy(MemoryAddress addr) { delegate.destroy(); } + @VisibleForTesting + int flush(MemoryAddress path, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.flush(path.getUtf8String(0), new FileInfoImpl(fi, scope)); + } + } + + @VisibleForTesting + int fsync(MemoryAddress path, int datasync, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.fsync(path.getUtf8String(0), datasync, new FileInfoImpl(fi, scope)); + } + } + + @VisibleForTesting + int fsyncdir(MemoryAddress path, int datasync, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.fsyncdir(path.getUtf8String(0), datasync, new FileInfoImpl(fi, scope)); + } + } + private int getattr(MemoryAddress path, MemoryAddress stat, MemoryAddress fi) { try (var scope = MemorySession.openConfined()) { return delegate.getattr(path.getUtf8String(0), new StatImpl(stat, scope), new FileInfoImpl(fi, scope)); diff --git a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java index 931f729c..76dda1ce 100644 --- a/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java +++ b/jfuse-linux-amd64/src/test/java/org/cryptomator/jfuse/linux/amd64/FuseImplTest.java @@ -122,6 +122,54 @@ public void testParseArgs() { } } + @Nested + @DisplayName("flush/fsync/fsyncdir") + public class FlushFsyncFsyncdir { + + @Test + @DisplayName("flush(\"/foo\", fi)") + public void testFlush() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).flush(Mockito.eq("/foo"), Mockito.any()); + + var result = fuseImpl.flush(path.address(), fi.address()); + + Assertions.assertEquals(42, result); + } + } + + @Test + @DisplayName("fsync(\"/foo\", 1, fi)") + public void testFsync() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).fsync(Mockito.eq("/foo"), Mockito.eq(1), Mockito.any()); + + var result = fuseImpl.fsync(path.address(), 1, fi.address()); + + Assertions.assertEquals(42, result); + } + } + + @Test + @DisplayName("fsyncdir(\"/foo\", 1, fi)") + public void testFsyncdir() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).fsyncdir(Mockito.eq("/foo"), Mockito.eq(1), Mockito.any()); + + var result = fuseImpl.fsyncdir(path.address(), 1, fi.address()); + + Assertions.assertEquals(42, result); + } + } + + } + @DisplayName("init() sets fuse_conn_info.wants |= FUSE_CAP_READDIRPLUS") @Test public void testInit() { diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java index 61dc604a..dfd83895 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseImpl.java @@ -80,6 +80,9 @@ private void bind(FuseOperations.Operation operation) { case CHMOD -> fuse_operations.chmod$set(fuseOps, fuse_operations.chmod.allocate(this::chmod, fuseScope).address()); case CREATE -> fuse_operations.create$set(fuseOps, fuse_operations.create.allocate(this::create, fuseScope).address()); case DESTROY -> fuse_operations.destroy$set(fuseOps, fuse_operations.destroy.allocate(this::destroy, fuseScope).address()); + case FLUSH -> fuse_operations.flush$set(fuseOps, fuse_operations.flush.allocate(this::flush, fuseScope).address()); + case FSYNC -> fuse_operations.fsync$set(fuseOps, fuse_operations.fsync.allocate(this::fsync, fuseScope).address()); + case FSYNCDIR -> fuse_operations.fsyncdir$set(fuseOps, fuse_operations.fsyncdir.allocate(this::fsyncdir, fuseScope).address()); case GET_ATTR -> { fuse_operations.getattr$set(fuseOps, fuse_operations.getattr.allocate(this::getattr, fuseScope).address()); fuse_operations.fgetattr$set(fuseOps, fuse_operations.fgetattr.allocate(this::fgetattr, fuseScope).address()); @@ -131,6 +134,27 @@ private void destroy(MemoryAddress addr) { delegate.destroy(); } + @VisibleForTesting + int flush(MemoryAddress path, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.flush(path.getUtf8String(0), new FileInfoImpl(fi, scope)); + } + } + + @VisibleForTesting + int fsync(MemoryAddress path, int datasync, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.fsync(path.getUtf8String(0), datasync, new FileInfoImpl(fi, scope)); + } + } + + @VisibleForTesting + int fsyncdir(MemoryAddress path, int datasync, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.fsyncdir(path.getUtf8String(0), datasync, new FileInfoImpl(fi, scope)); + } + } + @VisibleForTesting int getattr(MemoryAddress path, MemoryAddress stat) { try (var scope = MemorySession.openConfined()) { diff --git a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseImplTest.java b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseImplTest.java index 9e4140d4..36111c2e 100644 --- a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseImplTest.java +++ b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseImplTest.java @@ -101,6 +101,54 @@ public void testParseArgs() { } } + @Nested + @DisplayName("flush/fsync/fsyncdir") + public class FlushFsyncFsyncdir { + + @Test + @DisplayName("flush(\"/foo\", fi)") + public void testFlush() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).flush(Mockito.eq("/foo"), Mockito.any()); + + var result = fuseImpl.flush(path.address(), fi.address()); + + Assertions.assertEquals(42, result); + } + } + + @Test + @DisplayName("fsync(\"/foo\", 1, fi)") + public void testFsync() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).fsync(Mockito.eq("/foo"), Mockito.eq(1), Mockito.any()); + + var result = fuseImpl.fsync(path.address(), 1, fi.address()); + + Assertions.assertEquals(42, result); + } + } + + @Test + @DisplayName("fsyncdir(\"/foo\", 1, fi)") + public void testFsyncdir() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).fsyncdir(Mockito.eq("/foo"), Mockito.eq(1), Mockito.any()); + + var result = fuseImpl.fsyncdir(path.address(), 1, fi.address()); + + Assertions.assertEquals(42, result); + } + } + + } + @Nested @DisplayName("utimens") public class Utimens { diff --git a/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseImpl.java b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseImpl.java index 750374c3..0828af15 100644 --- a/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseImpl.java +++ b/jfuse-win/src/main/java/org/cryptomator/jfuse/win/FuseImpl.java @@ -122,6 +122,9 @@ private void bind(FuseOperations.Operation operation) { case CHMOD -> fuse3_operations.chmod$set(fuseOps, fuse3_operations.chmod.allocate(this::chmod, fuseScope).address()); case CREATE -> fuse3_operations.create$set(fuseOps, fuse3_operations.create.allocate(this::create, fuseScope).address()); case DESTROY -> fuse3_operations.destroy$set(fuseOps, fuse3_operations.destroy.allocate(this::destroy, fuseScope).address()); + case FLUSH -> fuse3_operations.flush$set(fuseOps, fuse3_operations.flush.allocate(this::flush, fuseScope).address()); + case FSYNC -> fuse3_operations.fsync$set(fuseOps, fuse3_operations.fsync.allocate(this::fsync, fuseScope).address()); + case FSYNCDIR -> fuse3_operations.fsyncdir$set(fuseOps, fuse3_operations.fsyncdir.allocate(this::fsyncdir, fuseScope).address()); case GET_ATTR -> fuse3_operations.getattr$set(fuseOps, fuse3_operations.getattr.allocate(this::getattr, fuseScope).address()); case MKDIR -> fuse3_operations.mkdir$set(fuseOps, fuse3_operations.mkdir.allocate(this::mkdir, fuseScope).address()); case OPEN -> fuse3_operations.open$set(fuseOps, fuse3_operations.open.allocate(this::open, fuseScope).address()); @@ -169,6 +172,27 @@ private void destroy(MemoryAddress addr) { delegate.destroy(); } + @VisibleForTesting + int flush(MemoryAddress path, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.flush(path.getUtf8String(0), new FileInfoImpl(fi, scope)); + } + } + + @VisibleForTesting + int fsync(MemoryAddress path, int datasync, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.fsync(path.getUtf8String(0), datasync, new FileInfoImpl(fi, scope)); + } + } + + @VisibleForTesting + int fsyncdir(MemoryAddress path, int datasync, MemoryAddress fi) { + try (var scope = MemorySession.openConfined()) { + return delegate.fsyncdir(path.getUtf8String(0), datasync, new FileInfoImpl(fi, scope)); + } + } + @VisibleForTesting int getattr(MemoryAddress path, MemoryAddress stat, MemoryAddress fi) { try (var scope = MemorySession.openConfined()) { diff --git a/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseImplTest.java b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseImplTest.java index 5f6a3bb5..80adec5d 100644 --- a/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseImplTest.java +++ b/jfuse-win/src/test/java/org/cryptomator/jfuse/win/FuseImplTest.java @@ -170,6 +170,54 @@ public void testParseArgs() { } } + @Nested + @DisplayName("flush/fsync/fsyncdir") + public class FlushFsyncFsyncdir { + + @Test + @DisplayName("flush(\"/foo\", fi)") + public void testFlush() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse3_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).flush(Mockito.eq("/foo"), Mockito.any()); + + var result = fuseImpl.flush(path.address(), fi.address()); + + Assertions.assertEquals(42, result); + } + } + + @Test + @DisplayName("fsync(\"/foo\", 1, fi)") + public void testFsync() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse3_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).fsync(Mockito.eq("/foo"), Mockito.eq(1), Mockito.any()); + + var result = fuseImpl.fsync(path.address(), 1, fi.address()); + + Assertions.assertEquals(42, result); + } + } + + @Test + @DisplayName("fsyncdir(\"/foo\", 1, fi)") + public void testFsyncdir() { + try (var scope = MemorySession.openConfined()) { + var path = scope.allocateUtf8String("/foo"); + var fi = fuse3_file_info.allocate(scope); + Mockito.doReturn(42).when(fuseOps).fsyncdir(Mockito.eq("/foo"), Mockito.eq(1), Mockito.any()); + + var result = fuseImpl.fsyncdir(path.address(), 1, fi.address()); + + Assertions.assertEquals(42, result); + } + } + + } + @DisplayName("init() sets fuse_conn_info.wants |= FUSE_CAP_READDIRPLUS") @Test public void testInit() { From 68bb2530ed9a44c879e29581b89ca5d361fed817 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 18 Oct 2022 17:34:43 +0200 Subject: [PATCH 35/41] badges! [ci skip] --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 00c1c90c..f0ad5c98 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ [![Build](https://github.com/cryptomator/jfuse/actions/workflows/build.yml/badge.svg)](https://github.com/cryptomator/jfuse/actions/workflows/build.yml) +[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=cryptomator_jfuse&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=cryptomator_jfuse) +[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=cryptomator_jfuse&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=cryptomator_jfuse) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=cryptomator_jfuse&metric=coverage)](https://sonarcloud.io/summary/new_code?id=cryptomator_jfuse) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cryptomator_jfuse&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=cryptomator_jfuse) # jFUSE From fc8d240b8ccdc5ef63312dc6c913e65ffd630557 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Tue, 18 Oct 2022 17:47:44 +0200 Subject: [PATCH 36/41] add flush/fsync/fsyncdir to mirror example --- .../examples/AbstractMirrorFileSystem.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java b/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java index 16458027..01c19897 100644 --- a/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java +++ b/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java @@ -73,6 +73,9 @@ public Set supportedOperations() { FuseOperations.Operation.ACCESS, FuseOperations.Operation.CREATE, FuseOperations.Operation.DESTROY, + FuseOperations.Operation.FLUSH, + FuseOperations.Operation.FSYNC, + FuseOperations.Operation.FSYNCDIR, FuseOperations.Operation.GET_ATTR, FuseOperations.Operation.MKDIR, FuseOperations.Operation.OPEN_DIR, @@ -434,4 +437,40 @@ public void destroy() { }); } + @Override + public int flush(String path, FileInfo fi) { + LOG.trace("flush {}", path); + var fc = openFiles.get(fi.getFh()); + if (fc == null) { + return -errno.ebadf(); + } + try { + fc.force(false); + return 0; + } catch (IOException e) { + return -errno.eio(); + } + } + + @Override + public int fsync(String path, int datasync, FileInfo fi) { + LOG.trace("fsync {}", path); + var fc = openFiles.get(fi.getFh()); + if (fc == null) { + return -errno.ebadf(); + } + try { + fc.force(datasync != 0); + return 0; + } catch (IOException e) { + return -errno.eio(); + } + } + + @Override + public int fsyncdir(String path, int datasync, FileInfo fi) { + LOG.trace("fsyncdir {}", path); + // no-op: this quick and dirty impl doesn't open/close dirs + return 0; + } } From fd83214b189a4e02fd0e7897c6f6cbd9918c69df Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 19 Oct 2022 10:51:35 +0200 Subject: [PATCH 37/41] removed unused imports [ci skip] --- jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java | 1 - .../java/org/cryptomator/jfuse/linux/aarch64/DirFillerImpl.java | 2 -- .../main/java/org/cryptomator/jfuse/linux/aarch64/StatImpl.java | 1 - .../java/org/cryptomator/jfuse/linux/amd64/DirFillerImpl.java | 2 -- .../main/java/org/cryptomator/jfuse/linux/amd64/StatImpl.java | 1 - jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatImpl.java | 1 - 6 files changed, 8 deletions(-) diff --git a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java index d075165c..dc75c331 100644 --- a/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java +++ b/jfuse-api/src/main/java/org/cryptomator/jfuse/api/Fuse.java @@ -2,7 +2,6 @@ import org.jetbrains.annotations.Blocking; -import org.jetbrains.annotations.BlockingExecutor; import org.jetbrains.annotations.MustBeInvokedByOverriders; import java.lang.foreign.MemorySession; diff --git a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/DirFillerImpl.java b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/DirFillerImpl.java index f1a8a503..a4d329d1 100644 --- a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/DirFillerImpl.java +++ b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/DirFillerImpl.java @@ -3,12 +3,10 @@ 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.fuse_h; import org.cryptomator.jfuse.linux.aarch64.extr.stat; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySession; -import java.util.Set; import java.util.function.Consumer; record DirFillerImpl(MemoryAddress buf, fuse_fill_dir_t callback, MemorySession scope) implements DirFiller { diff --git a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/StatImpl.java b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/StatImpl.java index 35be683d..6ec2dc57 100644 --- a/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/StatImpl.java +++ b/jfuse-linux-aarch64/src/main/java/org/cryptomator/jfuse/linux/aarch64/StatImpl.java @@ -4,7 +4,6 @@ import org.cryptomator.jfuse.api.Stat; import org.cryptomator.jfuse.api.TimeSpec; import org.cryptomator.jfuse.linux.aarch64.extr.stat; -import org.cryptomator.jfuse.linux.aarch64.extr.stat_h; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySegment; diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/DirFillerImpl.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/DirFillerImpl.java index 03256697..428398ba 100644 --- a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/DirFillerImpl.java +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/DirFillerImpl.java @@ -3,12 +3,10 @@ import org.cryptomator.jfuse.api.DirFiller; import org.cryptomator.jfuse.api.Stat; import org.cryptomator.jfuse.linux.amd64.extr.fuse_fill_dir_t; -import org.cryptomator.jfuse.linux.amd64.extr.fuse_h; import org.cryptomator.jfuse.linux.amd64.extr.stat; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySession; -import java.util.Set; import java.util.function.Consumer; record DirFillerImpl(MemoryAddress buf, fuse_fill_dir_t callback, MemorySession scope) implements DirFiller { diff --git a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/StatImpl.java b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/StatImpl.java index ad68f710..990c4afa 100644 --- a/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/StatImpl.java +++ b/jfuse-linux-amd64/src/main/java/org/cryptomator/jfuse/linux/amd64/StatImpl.java @@ -3,7 +3,6 @@ import org.cryptomator.jfuse.api.Stat; import org.cryptomator.jfuse.api.TimeSpec; import org.cryptomator.jfuse.linux.amd64.extr.stat; -import org.cryptomator.jfuse.linux.amd64.extr.stat_h; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySegment; diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatImpl.java index e4e0af51..58ffb3fd 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatImpl.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatImpl.java @@ -3,7 +3,6 @@ import org.cryptomator.jfuse.api.Stat; import org.cryptomator.jfuse.api.TimeSpec; import org.cryptomator.jfuse.mac.extr.stat; -import org.cryptomator.jfuse.mac.extr.stat_h; import java.lang.foreign.MemoryAddress; import java.lang.foreign.MemorySegment; From b83d2444fb78daec7bdcc40b8a1cb29683c4c322 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 19 Oct 2022 10:55:45 +0200 Subject: [PATCH 38/41] see https://github.com/cryptomator/jfuse/pull/21#discussion_r999111358 [ci skip] --- .../cryptomator/jfuse/examples/AbstractMirrorFileSystem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java b/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java index 01c19897..8d89698f 100644 --- a/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java +++ b/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/AbstractMirrorFileSystem.java @@ -460,7 +460,7 @@ public int fsync(String path, int datasync, FileInfo fi) { return -errno.ebadf(); } try { - fc.force(datasync != 0); + fc.force(datasync == 0); return 0; } catch (IOException e) { return -errno.eio(); From 1a8890bf30292f6f24dfc7e3ceb382df4c37369f Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 19 Oct 2022 14:26:17 +0200 Subject: [PATCH 39/41] generate proper javadoc for aggregator module --- jfuse/pom.xml | 37 +++++++++------------------- jfuse/src/main/java/module-info.java | 5 +++- pom.xml | 4 ++- 3 files changed, 18 insertions(+), 28 deletions(-) diff --git a/jfuse/pom.xml b/jfuse/pom.xml index a03b43d4..468f7d5d 100644 --- a/jfuse/pom.xml +++ b/jfuse/pom.xml @@ -47,34 +47,19 @@ org.apache.maven.plugins maven-javadoc-plugin - - true + + + + + + + + true + + org.cryptomator:* + - - org.apache.maven.plugins - maven-jar-plugin - - - default-jar - package - - jar - - - - - javadoc-jar - package - - jar - - - javadoc - - - - diff --git a/jfuse/src/main/java/module-info.java b/jfuse/src/main/java/module-info.java index f519bde6..946a3f28 100644 --- a/jfuse/src/main/java/module-info.java +++ b/jfuse/src/main/java/module-info.java @@ -1,5 +1,5 @@ /** - * This is just an aggregator module. Please refer to the API module. + * This is just an aggregator module. Please refer to the {@link org.cryptomator.jfuse.api/ API module}. */ module org.cryptomator.jfuse { requires transitive org.cryptomator.jfuse.api; @@ -8,4 +8,7 @@ requires org.cryptomator.jfuse.linux.amd64; requires org.cryptomator.jfuse.mac; requires org.cryptomator.jfuse.win; + + // required for maven-javadoc-plugin to work: + requires static org.jetbrains.annotations; } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 079d450f..6aaf3d9f 100644 --- a/pom.xml +++ b/pom.xml @@ -171,7 +171,9 @@ *.extr 19 - --enable-preview + + + From 31519b327203fa6efb56b314921834c1b5a46b43 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 19 Oct 2022 14:44:45 +0200 Subject: [PATCH 40/41] updated Maven module metadata [ci skip] --- jfuse-tests/pom.xml | 2 +- jfuse/pom.xml | 6 +++--- pom.xml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jfuse-tests/pom.xml b/jfuse-tests/pom.xml index d00f34af..a4d7411f 100644 --- a/jfuse-tests/pom.xml +++ b/jfuse-tests/pom.xml @@ -9,7 +9,7 @@ 4.0.0 jfuse-tests - jFUSE Tests + jFUSE Integration Tests Benchmark and Integration Tests diff --git a/jfuse/pom.xml b/jfuse/pom.xml index 468f7d5d..136b1a77 100644 --- a/jfuse/pom.xml +++ b/jfuse/pom.xml @@ -9,9 +9,9 @@ 4.0.0 jfuse - jFUSE - Java bindings for FUSE using foreign functions & memory API - https://github.com/cryptomator/jfuse/ + jFUSE Implementations + Aggregator project that contains the public API and all common implementations of jFUSE. + https://github.com/cryptomator/jfuse/tree/develop/jfuse diff --git a/pom.xml b/pom.xml index 6aaf3d9f..cc3d94fd 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ jfuse-parent pom 0.3.0-SNAPSHOT - jFUSE Parent + jFUSE Java bindings for FUSE using foreign functions & memory API https://github.com/cryptomator/jfuse From 661ae258615427c698e5e1680a2c0dbf38b94b08 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Wed, 19 Oct 2022 14:45:17 +0200 Subject: [PATCH 41/41] preparing relese 0.3.0 --- jfuse-api/pom.xml | 2 +- jfuse-examples/pom.xml | 2 +- jfuse-linux-aarch64/pom.xml | 2 +- jfuse-linux-amd64/pom.xml | 2 +- jfuse-mac/pom.xml | 2 +- jfuse-tests/pom.xml | 2 +- jfuse-win/pom.xml | 2 +- jfuse/pom.xml | 2 +- pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/jfuse-api/pom.xml b/jfuse-api/pom.xml index 7da42d19..c77600ef 100644 --- a/jfuse-api/pom.xml +++ b/jfuse-api/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.0-SNAPSHOT + 0.3.0 4.0.0 jfuse-api diff --git a/jfuse-examples/pom.xml b/jfuse-examples/pom.xml index 2f0b414c..3e697d2e 100644 --- a/jfuse-examples/pom.xml +++ b/jfuse-examples/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.0-SNAPSHOT + 0.3.0 4.0.0 jfuse-examples diff --git a/jfuse-linux-aarch64/pom.xml b/jfuse-linux-aarch64/pom.xml index f345e90c..44d2484a 100644 --- a/jfuse-linux-aarch64/pom.xml +++ b/jfuse-linux-aarch64/pom.xml @@ -5,7 +5,7 @@ jfuse-parent org.cryptomator - 0.3.0-SNAPSHOT + 0.3.0 4.0.0 jfuse-linux-aarch64 diff --git a/jfuse-linux-amd64/pom.xml b/jfuse-linux-amd64/pom.xml index bbffcc11..80fe6845 100644 --- a/jfuse-linux-amd64/pom.xml +++ b/jfuse-linux-amd64/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.0-SNAPSHOT + 0.3.0 4.0.0 jfuse-linux-amd64 diff --git a/jfuse-mac/pom.xml b/jfuse-mac/pom.xml index 37dadbdb..cace94a3 100644 --- a/jfuse-mac/pom.xml +++ b/jfuse-mac/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.0-SNAPSHOT + 0.3.0 4.0.0 jfuse-mac diff --git a/jfuse-tests/pom.xml b/jfuse-tests/pom.xml index a4d7411f..1b29041f 100644 --- a/jfuse-tests/pom.xml +++ b/jfuse-tests/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.0-SNAPSHOT + 0.3.0 4.0.0 jfuse-tests diff --git a/jfuse-win/pom.xml b/jfuse-win/pom.xml index afb28f2f..3271f5d3 100644 --- a/jfuse-win/pom.xml +++ b/jfuse-win/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.0-SNAPSHOT + 0.3.0 4.0.0 jfuse-win diff --git a/jfuse/pom.xml b/jfuse/pom.xml index 136b1a77..c03b0145 100644 --- a/jfuse/pom.xml +++ b/jfuse/pom.xml @@ -5,7 +5,7 @@ org.cryptomator jfuse-parent - 0.3.0-SNAPSHOT + 0.3.0 4.0.0 jfuse diff --git a/pom.xml b/pom.xml index cc3d94fd..e2449969 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.cryptomator jfuse-parent pom - 0.3.0-SNAPSHOT + 0.3.0 jFUSE Java bindings for FUSE using foreign functions & memory API https://github.com/cryptomator/jfuse