From 7968ea6464867a3277f9c31a80860488f4a41b0f Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Mon, 9 Feb 2026 20:07:57 +0100 Subject: [PATCH 1/3] migrate to libfuse3 --- .../jfuse/examples/PosixMirrorFileSystem.java | 2 +- jfuse-mac/pom.xml | 37 +- .../cryptomator/jfuse/mac/DirFillerImpl.java | 6 +- .../cryptomator/jfuse/mac/FileInfoImpl.java | 15 +- .../org/cryptomator/jfuse/mac/FuseArgs.java | 31 +- .../cryptomator/jfuse/mac/FuseConfigImpl.java | 120 ++ .../jfuse/mac/FuseConnInfoImpl.java | 36 +- .../jfuse/mac/FuseConnInfoImpl317.java | 43 + .../cryptomator/jfuse/mac/FuseFunctions.java | 86 + .../org/cryptomator/jfuse/mac/FuseImpl.java | 93 +- .../cryptomator/jfuse/mac/FuseMountImpl.java | 19 +- .../cryptomator/jfuse/mac/FuseNewHelper.java | 80 + .../cryptomator/jfuse/mac/MacFuseBuilder.java | 14 +- .../org/cryptomator/jfuse/mac/StatImpl.java | 3 +- .../cryptomator/jfuse/mac/StatvfsImpl.java | 3 +- .../cryptomator/jfuse/mac/TimeSpecImpl.java | 2 +- .../jfuse/mac/extr/fuse/fuse_h.java | 454 ----- .../mac/extr/{fuse => fuse3}/fuse_args.java | 6 +- .../jfuse/mac/extr/fuse3/fuse_config.java | 1494 +++++++++++++++++ .../extr/{fuse => fuse3}/fuse_conn_info.java | 347 +++- .../extr/{fuse => fuse3}/fuse_file_info.java | 284 +++- .../extr/{fuse => fuse3}/fuse_fill_dir_t.java | 16 +- .../jfuse/mac/extr/fuse3/fuse_h.java | 819 +++++++++ .../mac/extr/fuse3/fuse_loop_config_v1.java | 173 ++ .../extr/{fuse => fuse3}/fuse_operations.java | 944 +++++------ .../jfuse/mac/extr/{fuse => fuse3}/stat.java | 6 +- .../mac/extr/{fuse => fuse3}/statvfs.java | 6 +- .../mac/extr/{fuse => fuse3}/timespec.java | 6 +- .../fuse3_lowlevel/fuse_cmdline_opts.java | 542 ++++++ .../extr/fuse3_lowlevel/fuse_lowlevel_h.java | 72 + .../jfuse/mac/FileInfoImplTest.java | 2 +- .../jfuse/mac/FuseConnInfoImpl317Test.java | 99 ++ .../jfuse/mac/FuseConnInfoImplTest.java | 8 +- .../cryptomator/jfuse/mac/FuseImplTest.java | 176 +- .../cryptomator/jfuse/mac/StatImplTest.java | 2 +- .../jfuse/mac/StatvfsImplTest.java | 2 +- .../jfuse/mac/TimeSpecImplTest.java | 2 +- 37 files changed, 4707 insertions(+), 1343 deletions(-) create mode 100644 jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConfigImpl.java create mode 100644 jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl317.java create mode 100644 jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseFunctions.java create mode 100644 jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseNewHelper.java delete mode 100644 jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_h.java rename jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/{fuse => fuse3}/fuse_args.java (98%) create mode 100644 jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_config.java rename jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/{fuse => fuse3}/fuse_conn_info.java (63%) rename jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/{fuse => fuse3}/fuse_file_info.java (51%) rename jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/{fuse => fuse3}/fuse_fill_dir_t.java (87%) create mode 100644 jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_h.java create mode 100644 jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_loop_config_v1.java rename jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/{fuse => fuse3}/fuse_operations.java (89%) rename jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/{fuse => fuse3}/stat.java (99%) rename jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/{fuse => fuse3}/statvfs.java (99%) rename jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/{fuse => fuse3}/timespec.java (97%) create mode 100644 jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3_lowlevel/fuse_cmdline_opts.java create mode 100644 jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3_lowlevel/fuse_lowlevel_h.java create mode 100644 jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl317Test.java diff --git a/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/PosixMirrorFileSystem.java b/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/PosixMirrorFileSystem.java index 0e5eeb51..4d084dd1 100644 --- a/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/PosixMirrorFileSystem.java +++ b/jfuse-examples/src/main/java/org/cryptomator/jfuse/examples/PosixMirrorFileSystem.java @@ -37,7 +37,7 @@ public static void main(String[] args) { } try (var fuse = builder.build(new PosixMirrorFileSystem(mirrored, builder.errno()))) { LOG.info("Mounting at {}...", mountPoint); - fuse.mount("jfuse", mountPoint, "-s"); + fuse.mount("jfuse", mountPoint, "-s", "-obackend=fskit"); LOG.info("Mounted to {}.", mountPoint); LOG.info("Enter a anything to unmount..."); System.in.read(); diff --git a/jfuse-mac/pom.xml b/jfuse-mac/pom.xml index 33a32e88..4be0d1bb 100644 --- a/jfuse-mac/pom.xml +++ b/jfuse-mac/pom.xml @@ -71,7 +71,7 @@ ${project.build.sourceDirectory}/org/cryptomator/jfuse/mac/extr - *.java + **/*.java false @@ -94,18 +94,23 @@ sources - ${project.parent.basedir}/libfuse2/include/fuse.h - org.cryptomator.jfuse.mac.extr.fuse + ${project.parent.basedir}/libfuse3/include/fuse.h + org.cryptomator.jfuse.mac.extr.fuse3 fuse_h _FILE_OFFSET_BITS=64 - FUSE_USE_VERSION=29 + FUSE_USE_VERSION=317 - fuse_parse_cmdline + fuse_version + fuse_lib_help fuse_mount - fuse_new + fuse_get_session fuse_loop + fuse_loop_cfg_create + fuse_loop_cfg_set_clone_fd + fuse_loop_cfg_set_max_threads + fuse_loop_cfg_destroy fuse_loop_mt fuse_exit fuse_unmount @@ -121,7 +126,27 @@ statvfs timespec fuse_conn_info + fuse_config fuse_args + fuse_loop_config_v1 + + + + + jextract-fuse-lowlevel + + sources + + + ${project.parent.basedir}/libfuse3/include/fuse_lowlevel.h + org.cryptomator.jfuse.mac.extr.fuse3_lowlevel + fuse_lowlevel_h + + _FILE_OFFSET_BITS=64 + FUSE_USE_VERSION=317 + + + fuse_cmdline_opts diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/DirFillerImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/DirFillerImpl.java index b167517b..1599fe34 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/DirFillerImpl.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/DirFillerImpl.java @@ -2,8 +2,8 @@ import org.cryptomator.jfuse.api.DirFiller; import org.cryptomator.jfuse.api.Stat; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_fill_dir_t; -import org.cryptomator.jfuse.mac.extr.fuse.stat; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_fill_dir_t; +import org.cryptomator.jfuse.mac.extr.fuse3.stat; import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; @@ -15,7 +15,7 @@ record DirFillerImpl(MemorySegment buf, MemorySegment callback, Arena arena) imp public int fill(String name, Consumer statFiller, long offset, int flags) { var statSegment = stat.allocate(arena); statFiller.accept(new StatImpl(statSegment)); - return fuse_fill_dir_t.invoke(callback, buf, arena.allocateFrom(name), statSegment, offset); + return fuse_fill_dir_t.invoke(callback, buf, arena.allocateFrom(name), statSegment, offset, flags); } } \ No newline at end of file diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FileInfoImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FileInfoImpl.java index fd5d5729..ceee5437 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FileInfoImpl.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FileInfoImpl.java @@ -2,9 +2,9 @@ import org.cryptomator.jfuse.api.FileInfo; import org.cryptomator.jfuse.mac.extr.fcntl.fcntl_h; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_file_info; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_file_info; +import org.jetbrains.annotations.Nullable; -import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; import java.nio.file.StandardOpenOption; import java.util.EnumSet; @@ -22,6 +22,17 @@ record FileInfoImpl(MemorySegment segment) implements FileInfo { private static final int O_SYNC = fcntl_h.O_SYNC(); private static final int O_DSYNC = fcntl_h.O_DSYNC(); + /** + * Null-safe factory method to map native memory to an {@link FileInfo} object + * + * @param address the {@link MemorySegment} representing the starting address + * @return an {@link FileInfo} object or {@code null} if {@code address} is a NULL pointer + */ + @Nullable + public static FileInfoImpl ofNullable(MemorySegment address) { + return MemorySegment.NULL.equals(address) ? null : new FileInfoImpl(address); + } + @Override public long getFh() { return fuse_file_info.fh(segment); diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseArgs.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseArgs.java index 94c090da..d35216fb 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseArgs.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseArgs.java @@ -1,11 +1,12 @@ package org.cryptomator.jfuse.mac; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_args; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_args; +import org.cryptomator.jfuse.mac.extr.fuse3_lowlevel.fuse_cmdline_opts; import java.lang.foreign.MemorySegment; import java.lang.foreign.ValueLayout; -record FuseArgs(MemorySegment args, MemorySegment mountPoint, boolean multiThreaded) { +record FuseArgs(MemorySegment args, MemorySegment cmdLineOpts) { @Override public String toString() { @@ -16,8 +17,30 @@ public String toString() { var cString = argv.getAtIndex(ValueLayout.ADDRESS, i).reinterpret(Long.MAX_VALUE); sb.append("arg[").append(i).append("] = ").append(cString.getString(0)).append(", "); } - sb.append("mountPoint = ").append(mountPoint.getString(0)).append(", "); - sb.append("multiThreaded = ").append(multiThreaded); + sb.append("mountPoint = ").append(mountPoint().getString(0)); + sb.append("debug = ").append(fuse_cmdline_opts.debug(cmdLineOpts)); + sb.append("singlethreaded = ").append(!multithreaded()); return sb.toString(); } + + public MemorySegment mountPoint() { + return fuse_cmdline_opts.mountpoint(cmdLineOpts); + } + + public boolean multithreaded() { + return fuse_cmdline_opts.singlethread(cmdLineOpts) == 0; + } + + public int cloneFd() { + return fuse_cmdline_opts.clone_fd(cmdLineOpts); + } + + public int maxIdleThreads() { + return fuse_cmdline_opts.max_idle_threads(cmdLineOpts); + } + + public int maxThreads() { + return fuse_cmdline_opts.max_threads(cmdLineOpts); + } + } diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConfigImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConfigImpl.java new file mode 100644 index 00000000..c1becdd5 --- /dev/null +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConfigImpl.java @@ -0,0 +1,120 @@ +package org.cryptomator.jfuse.mac; + +import org.cryptomator.jfuse.api.FuseConfig; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_config; + +import java.lang.foreign.MemorySegment; + +record FuseConfigImpl(MemorySegment segment) implements FuseConfig { + + @Override + public int setGid() { + return fuse_config.set_gid(segment); + } + + @Override + public int gid() { + return fuse_config.gid(segment); + } + + @Override + public int setUid() { + return fuse_config.set_uid(segment); + } + + @Override + public int uid() { + return fuse_config.uid(segment); + } + + @Override + public int setMode() { + return fuse_config.set_mode(segment); + } + + @Override + public int umask() { + return fuse_config.umask(segment); + } + + @Override + public double entryTimeout() { + return fuse_config.entry_timeout(segment); + } + + @Override + public double negativeTimeout() { + return fuse_config.negative_timeout(segment); + } + + @Override + public double attrTimeout() { + return fuse_config.attr_timeout(segment); + } + + @Override + public int intr() { + return fuse_config.intr(segment); + } + + @Override + public int intrSignal() { + return fuse_config.intr_signal(segment); + } + + @Override + public int remember() { + return fuse_config.remember(segment); + } + + @Override + public int hardRemove() { + return fuse_config.hard_remove(segment); + } + + @Override + public int useIno() { + return fuse_config.use_ino(segment); + } + + @Override + public int readdirIno() { + return fuse_config.readdir_ino(segment); + } + + @Override + public int directIo() { + return fuse_config.direct_io(segment); + } + + @Override + public int kernelCache() { + return fuse_config.kernel_cache(segment); + } + + @Override + public int autoCache() { + return fuse_config.auto_cache(segment); + } + + @Override + public int acAttrTimeoutSet() { + return fuse_config.ac_attr_timeout_set(segment); + } + + @Override + public double acAttrTimeout() { + return fuse_config.ac_attr_timeout(segment); + } + + @Override + public int nullpathOk() { + return fuse_config.nullpath_ok(segment); + } + + @Override + public int noRofdFlush() { + return fuse_config.no_rofd_flush(segment); + } + +} diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl.java index 4ccacdb9..7489117e 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl.java @@ -1,12 +1,22 @@ package org.cryptomator.jfuse.mac; import org.cryptomator.jfuse.api.FuseConnInfo; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_conn_info; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_conn_info; -import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; -record FuseConnInfoImpl(MemorySegment segment) implements FuseConnInfo { +class FuseConnInfoImpl implements FuseConnInfo { + + protected final MemorySegment segment; + + FuseConnInfoImpl(MemorySegment segment) { + this.segment = segment; + } + + //mimic record behaviour + public MemorySegment segment() { + return segment; + } @Override public int protoMajor() { @@ -17,6 +27,7 @@ public int protoMajor() { public int protoMinor() { return fuse_conn_info.proto_minor(segment); } + @Override public int capable() { return fuse_conn_info.capable(segment); @@ -26,6 +37,7 @@ public int capable() { public int want() { return fuse_conn_info.want(segment); } + @Override public void setWant(int wanted) { fuse_conn_info.want(segment, wanted); @@ -41,6 +53,16 @@ public void setMaxWrite(int maxWrite) { fuse_conn_info.max_write(segment, maxWrite); } + @Override + public int maxRead() { + return fuse_conn_info.max_read(segment); + } + + @Override + public void setMaxRead(int maxRead) { + fuse_conn_info.max_read(segment, maxRead); + } + @Override public int maxReadahead() { return fuse_conn_info.max_readahead(segment); @@ -72,13 +94,13 @@ public void setCongestionThreshold(int congestionThreshold) { } @Override - public int asyncRead() { - return fuse_conn_info.async_read(segment); + public int timeGran() { + return fuse_conn_info.time_gran(segment); } @Override - public void setAsyncRead(int asyncRead) { - fuse_conn_info.async_read(segment, asyncRead); + public void setTimeGran(int timeGran) { + fuse_conn_info.time_gran(segment, timeGran); } } diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl317.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl317.java new file mode 100644 index 00000000..62672378 --- /dev/null +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl317.java @@ -0,0 +1,43 @@ +package org.cryptomator.jfuse.mac; + +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_conn_info; + +import java.lang.foreign.MemorySegment; + +class FuseConnInfoImpl317 extends FuseConnInfoImpl { + + FuseConnInfoImpl317(MemorySegment segment) { + super(segment); + } + + @Override + public long capableExt() { + return fuse_conn_info.capable_ext(segment); + } + + @Override + public long wantExt() { + return fuse_conn_info.want_ext(segment); + } + + @Override + public void setWantExt(long wantExt) { + fuse_conn_info.want_ext(segment, wantExt); + } + + @Override + public boolean setFeatureFlag(long flag) { + return FuseFunctions.fuse_set_feature_flag(segment, flag); + } + + @Override + public void unsetFeatureFlag(long flag) { + FuseFunctions.fuse_unset_feature_flag(segment, flag); + } + + @Override + public boolean getFeatureFlag(long flag) { + return FuseFunctions.fuse_get_feature_flag(segment, flag); + } + +} diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseFunctions.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseFunctions.java new file mode 100644 index 00000000..c28965d9 --- /dev/null +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseFunctions.java @@ -0,0 +1,86 @@ +package org.cryptomator.jfuse.mac; + +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.SymbolLookup; +import java.lang.invoke.MethodHandle; +import java.util.Optional; + +import static java.lang.foreign.ValueLayout.ADDRESS; +import static java.lang.foreign.ValueLayout.JAVA_INT; +import static java.lang.foreign.ValueLayout.JAVA_LONG; + +/** + * These method references can not be jextract'ed, partly due to jextract not being able to understand {@code #define}, + * partly due to slight differences in the FUSE API, which applies a versioning scheme via dlvsym, that Panama's default + * {@link SymbolLookup} doesn't support. + */ +class FuseFunctions { + + // see https://github.com/libfuse/libfuse/blob/fuse-3.12.0/include/fuse_lowlevel.h#L1892-L1923 + private static final FunctionDescriptor PARSE_CMDLINE_DESCRIPTOR = FunctionDescriptor.of(JAVA_INT, ADDRESS, ADDRESS); + //https://github.com/libfuse/libfuse/blob/fuse-3.17.4/lib/fuse_lowlevel.c#L2035 + private static final FunctionDescriptor SET_FEATURE_FLAG_DESCRIPTOR = FunctionDescriptor.of(JAVA_INT, ADDRESS, JAVA_LONG); + private static final FunctionDescriptor UNSET_FEATURE_FLAG_DESCRIPTOR = FunctionDescriptor.ofVoid(ADDRESS, JAVA_LONG); + private static final FunctionDescriptor GET_FEATURE_FLAG_DESCRIPTOR = FunctionDescriptor.of(JAVA_INT, ADDRESS, JAVA_LONG); + + private final MethodHandle fuse_parse_cmdline; + private final Optional fuse_set_feature_flag; + private final Optional fuse_unset_feature_flag; + private final Optional fuse_get_feature_flag; + + private FuseFunctions() { + var lookup = SymbolLookup.loaderLookup(); + var linker = Linker.nativeLinker(); + this.fuse_parse_cmdline = lookup.find("fuse_parse_cmdline") + .map(symbol -> linker.downcallHandle(symbol, PARSE_CMDLINE_DESCRIPTOR)) + .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol fuse_parse_cmdline")); + this.fuse_set_feature_flag = lookup.find("fuse_set_feature_flag") + .map(symbol -> linker.downcallHandle(symbol, SET_FEATURE_FLAG_DESCRIPTOR)); + this.fuse_unset_feature_flag = lookup.find("fuse_unset_feature_flag") + .map(symbol -> linker.downcallHandle(symbol, UNSET_FEATURE_FLAG_DESCRIPTOR)); + this.fuse_get_feature_flag = lookup.find("fuse_get_feature_flag") + .map(symbol -> linker.downcallHandle(symbol, GET_FEATURE_FLAG_DESCRIPTOR)); + } + + private static class Holder { + private static final FuseFunctions INSTANCE = new FuseFunctions(); + } + + public static int fuse_parse_cmdline(MemorySegment args, MemorySegment opts) { + try { + return (int) Holder.INSTANCE.fuse_parse_cmdline.invokeExact(args, opts); + } catch (Throwable e) { + throw new AssertionError("should not reach here", e); + } + } + + public static boolean fuse_set_feature_flag(MemorySegment fuse_conn_info, long flag) throws UnsupportedOperationException { + var method = Holder.INSTANCE.fuse_set_feature_flag.orElseThrow(() -> new UnsupportedOperationException("The loaded fuse library does not implement fuse_set_feature_flag")); + try { + return ((int) method.invokeExact(fuse_conn_info, flag)) != 0; + } catch (Throwable e) { + throw new AssertionError("should not reach here", e); + } + } + + public static void fuse_unset_feature_flag(MemorySegment fuse_conn_info, long flag) throws UnsupportedOperationException { + var method = Holder.INSTANCE.fuse_unset_feature_flag.orElseThrow(() -> new UnsupportedOperationException("The loaded fuse library does not implement fuse_unset_feature_flag")); + try { + method.invokeExact(fuse_conn_info, flag); + } catch (Throwable e) { + throw new AssertionError("should not reach here", e); + } + } + + public static boolean fuse_get_feature_flag(MemorySegment fuse_conn_info, long flag) throws UnsupportedOperationException { + var method = Holder.INSTANCE.fuse_get_feature_flag.orElseThrow(() -> new UnsupportedOperationException("The loaded fuse library does not implement fuse_get_feature_flag")); + try { + return ((int) method.invokeExact(fuse_conn_info, flag)) != 0; + } catch (Throwable e) { + throw new AssertionError("should not reach here", e); + } + } + +} 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 047ae6f0..3a29c356 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 @@ -1,14 +1,16 @@ package org.cryptomator.jfuse.mac; import org.cryptomator.jfuse.api.Fuse; +import org.cryptomator.jfuse.api.FuseConnInfo; import org.cryptomator.jfuse.api.FuseMount; import org.cryptomator.jfuse.api.FuseMountFailedException; import org.cryptomator.jfuse.api.FuseOperations; import org.cryptomator.jfuse.api.util.MemoryUtils; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_args; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_h; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_operations; -import org.cryptomator.jfuse.mac.extr.fuse.timespec; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_args; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_h; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_operations; +import org.cryptomator.jfuse.mac.extr.fuse3.timespec; +import org.cryptomator.jfuse.mac.extr.fuse3_lowlevel.fuse_cmdline_opts; import org.cryptomator.jfuse.mac.extr.stat.stat_h; import org.jetbrains.annotations.VisibleForTesting; @@ -17,8 +19,6 @@ import java.lang.foreign.ValueLayout; import java.util.List; -import static java.lang.foreign.ValueLayout.JAVA_INT; - final class FuseImpl extends Fuse { public FuseImpl(FuseOperations fuseOperations) { @@ -28,16 +28,20 @@ public FuseImpl(FuseOperations fuseOperations) { @Override protected FuseMount mount(List args) throws FuseMountFailedException { var fuseArgs = parseArgs(args); - var ch = fuse_h.fuse_mount(fuseArgs.mountPoint(), fuseArgs.args()); - if (MemorySegment.NULL.equals(ch)) { + var fuse = createFuseFS(fuseArgs); + if (fuse_h.fuse_mount(fuse, fuseArgs.mountPoint()) != 0) { throw new FuseMountFailedException("fuse_mount failed"); } - var fuse = fuse_h.fuse_new(ch, fuseArgs.args(), fuseOperationsStruct, fuseOperationsStruct.byteSize(), MemorySegment.NULL); + return new FuseMountImpl(fuse, fuseArgs); + } + + @VisibleForTesting + MemorySegment createFuseFS(FuseArgs fuseArgs) throws FuseMountFailedException { + var fuse = FuseNewHelper.getInstance().fuse_new(fuseArgs.args(), fuseOperationsStruct, fuseOperationsStruct.byteSize(), MemorySegment.NULL); if (MemorySegment.NULL.equals(fuse)) { - fuse_h.fuse_unmount(fuseArgs.mountPoint(), ch); throw new FuseMountFailedException("fuse_new failed"); } - return new FuseMountImpl(fuse, ch, fuseArgs); + return fuse; } @VisibleForTesting @@ -54,16 +58,16 @@ FuseArgs parseArgs(List cmdLineArgs) throws IllegalArgumentException { fuse_args.argv(args, argv); fuse_args.allocated(args, 0); - var multithreaded = fuseArena.allocate(JAVA_INT, 1); - var foreground = fuseArena.allocate(JAVA_INT, 1); - var mountPointPtr = fuseArena.allocate(ValueLayout.ADDRESS); - int parseResult = fuse_h.fuse_parse_cmdline(args, mountPointPtr, multithreaded, foreground); + var opts = fuse_cmdline_opts.allocate(fuseArena); + int parseResult = FuseFunctions.fuse_parse_cmdline(args, opts); if (parseResult != 0) { throw new IllegalArgumentException("fuse_parse_cmdline failed to parse " + String.join(" ", cmdLineArgs)); } - var isMultiThreaded = multithreaded.get(JAVA_INT, 0) == 1; - var mountPoint = mountPointPtr.get(ValueLayout.ADDRESS, 0).reinterpret(Long.MAX_VALUE); // unbounded - return new FuseArgs(args, mountPoint, isMultiThreaded); + if (fuse_cmdline_opts.show_help(opts) == 1) { + fuse_h.fuse_lib_help(args); + throw new IllegalArgumentException("Flags contained -h or --help. Processing cancelled after printing help"); + } + return new FuseArgs(args, opts); } @Override @@ -78,10 +82,7 @@ protected void bind(FuseOperations.Operation operation) { case FLUSH -> fuse_operations.flush(fuseOperationsStruct, fuse_operations.flush.allocate(this::flush, fuseArena)); case FSYNC -> fuse_operations.fsync(fuseOperationsStruct, fuse_operations.fsync.allocate(this::fsync, fuseArena)); case FSYNCDIR -> fuse_operations.fsyncdir(fuseOperationsStruct, fuse_operations.fsyncdir.allocate(this::fsyncdir, fuseArena)); - case GET_ATTR -> { - fuse_operations.getattr(fuseOperationsStruct, fuse_operations.getattr.allocate(this::getattr, fuseArena)); - fuse_operations.fgetattr(fuseOperationsStruct, fuse_operations.fgetattr.allocate(this::fgetattr, fuseArena)); - } + case GET_ATTR -> fuse_operations.getattr(fuseOperationsStruct, fuse_operations.getattr.allocate(this::getattr, fuseArena)); case GET_XATTR -> fuse_operations.getxattr(fuseOperationsStruct, fuse_operations.getxattr.allocate(this::getxattr, fuseArena)); case LIST_XATTR -> fuse_operations.listxattr(fuseOperationsStruct, fuse_operations.listxattr.allocate(this::listxattr, fuseArena)); case MKDIR -> fuse_operations.mkdir(fuseOperationsStruct, fuse_operations.mkdir.allocate(this::mkdir, fuseArena)); @@ -98,18 +99,24 @@ protected void bind(FuseOperations.Operation operation) { case SET_XATTR -> fuse_operations.setxattr(fuseOperationsStruct, fuse_operations.setxattr.allocate(this::setxattr, fuseArena)); case STATFS -> fuse_operations.statfs(fuseOperationsStruct, fuse_operations.statfs.allocate(this::statfs, fuseArena)); case SYMLINK -> fuse_operations.symlink(fuseOperationsStruct, fuse_operations.symlink.allocate(this::symlink, fuseArena)); - case TRUNCATE -> { - fuse_operations.truncate(fuseOperationsStruct, fuse_operations.truncate.allocate(this::truncate, fuseArena)); - fuse_operations.ftruncate(fuseOperationsStruct, fuse_operations.ftruncate.allocate(this::ftruncate, fuseArena)); - } + case TRUNCATE -> fuse_operations.truncate(fuseOperationsStruct, fuse_operations.truncate.allocate(this::truncate, fuseArena)); case UNLINK -> fuse_operations.unlink(fuseOperationsStruct, fuse_operations.unlink.allocate(this::unlink, fuseArena)); case UTIMENS -> fuse_operations.utimens(fuseOperationsStruct, fuse_operations.utimens.allocate(this::utimens, fuseArena)); case WRITE -> fuse_operations.write(fuseOperationsStruct, fuse_operations.write.allocate(this::write, fuseArena)); } } - private MemorySegment init(MemorySegment conn) { - fuseOperations.init(new FuseConnInfoImpl(conn), null); + @VisibleForTesting + MemorySegment init(MemorySegment conn, MemorySegment cfg) { + var connInfo = new FuseConnInfoImpl(conn); + if (fuse_h.fuse_version() >= 317) { + connInfo = new FuseConnInfoImpl317(conn); + connInfo.setFeatureFlag(FuseConnInfo.FUSE_CAP_READDIRPLUS); + } else { + connInfo.setWant(connInfo.want() | FuseConnInfo.FUSE_CAP_READDIRPLUS); + } + var config = new FuseConfigImpl(cfg); + fuseOperations.init(connInfo, config); return MemorySegment.NULL; } @@ -117,13 +124,13 @@ private int access(MemorySegment path, int mask) { return fuseOperations.access(path.getString(0), mask); } - private int chmod(MemorySegment path, short mode) { - return fuseOperations.chmod(path.getString(0), mode, null); + private int chmod(MemorySegment path, short mode, MemorySegment fi) { + return fuseOperations.chmod(path.getString(0), mode, FileInfoImpl.ofNullable(fi)); } @VisibleForTesting - int chown(MemorySegment path, int uid, int gid) { - return fuseOperations.chown(path.getString(0), uid, gid, null); + int chown(MemorySegment path, int uid, int gid, MemorySegment fi) { + return fuseOperations.chown(path.getString(0), uid, gid, FileInfoImpl.ofNullable(fi)); } private int create(MemorySegment path, short mode, MemorySegment fi) { @@ -150,8 +157,8 @@ int fsyncdir(MemorySegment path, int datasync, MemorySegment fi) { } @VisibleForTesting - int getattr(MemorySegment path, MemorySegment stat) { - return fuseOperations.getattr(path.getString(0), new StatImpl(stat), null); + int getattr(MemorySegment path, MemorySegment stat, MemorySegment fi) { + return fuseOperations.getattr(path.getString(0), new StatImpl(stat), FileInfoImpl.ofNullable(fi)); } @VisibleForTesting @@ -199,9 +206,9 @@ private int read(MemorySegment path, MemorySegment buf, long size, long offset, return fuseOperations.read(path.getString(0), buffer, size, offset, new FileInfoImpl(fi)); } - private int readdir(MemorySegment path, MemorySegment buf, MemorySegment filler, long offset, MemorySegment fi) { + private int readdir(MemorySegment path, MemorySegment buf, MemorySegment filler, long offset, MemorySegment fi, int flags) { try (var arena = Arena.ofConfined()) { - return fuseOperations.readdir(path.getString(0), new DirFillerImpl(buf, filler, arena), offset, new FileInfoImpl(fi), 0); + return fuseOperations.readdir(path.getString(0), new DirFillerImpl(buf, filler, arena), offset, new FileInfoImpl(fi), flags); } } @@ -218,8 +225,8 @@ private int releasedir(MemorySegment path, MemorySegment fi) { return fuseOperations.releasedir(MemoryUtils.toUtf8StringOrNull(path), new FileInfoImpl(fi)); } - private int rename(MemorySegment oldpath, MemorySegment newpath) { - return fuseOperations.rename(oldpath.getString(0), newpath.getString(0), 0); + private int rename(MemorySegment oldpath, MemorySegment newpath, int flags) { + return fuseOperations.rename(oldpath.getString(0), newpath.getString(0), flags); } private int rmdir(MemorySegment path) { @@ -235,8 +242,8 @@ private int symlink(MemorySegment linkname, MemorySegment target) { } @VisibleForTesting - int truncate(MemorySegment path, long size) { - return fuseOperations.truncate(path.getString(0), size, null); + int truncate(MemorySegment path, long size, MemorySegment fi) { + return fuseOperations.truncate(path.getString(0), size, FileInfoImpl.ofNullable(fi)); } @VisibleForTesting @@ -249,7 +256,7 @@ private int unlink(MemorySegment path) { } @VisibleForTesting - int utimens(MemorySegment path, MemorySegment times) { + int utimens(MemorySegment path, MemorySegment times, MemorySegment fi) { try (var arena = Arena.ofConfined()) { if (MemorySegment.NULL.equals(times)) { // set both times to current time @@ -257,11 +264,11 @@ int utimens(MemorySegment path, MemorySegment times) { timespec.tv_sec(segment, 0); timespec.tv_nsec(segment, stat_h.UTIME_NOW()); var time = new TimeSpecImpl(segment); - return fuseOperations.utimens(path.getString(0), time, time, null); + return fuseOperations.utimens(path.getString(0), time, time, FileInfoImpl.ofNullable(fi)); } else { var time0 = timespec.asSlice(times, 0); var time1 = timespec.asSlice(times, 1); - return fuseOperations.utimens(path.getString(0), new TimeSpecImpl(time0), new TimeSpecImpl(time1), null); + return fuseOperations.utimens(path.getString(0), new TimeSpecImpl(time0), new TimeSpecImpl(time1), FileInfoImpl.ofNullable(fi)); } } } diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseMountImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseMountImpl.java index 2de3cbab..64c9c2ac 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseMountImpl.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseMountImpl.java @@ -1,25 +1,32 @@ package org.cryptomator.jfuse.mac; import org.cryptomator.jfuse.api.FuseMount; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_h; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_h; import java.lang.foreign.MemorySegment; -record FuseMountImpl(MemorySegment fuse, MemorySegment ch, FuseArgs args) implements FuseMount { +record FuseMountImpl(MemorySegment fuse, FuseArgs fuseArgs) implements FuseMount { @Override public int loop() { - if (args.multiThreaded()) { - return fuse_h.fuse_loop_mt(fuse); - } else { + if (!fuseArgs.multithreaded()) { return fuse_h.fuse_loop(fuse); + } else { + var loopCfg = fuse_h.fuse_loop_cfg_create(); + try { + fuse_h.fuse_loop_cfg_set_clone_fd(loopCfg, fuseArgs.cloneFd()); + fuse_h.fuse_loop_cfg_set_max_threads(loopCfg, fuseArgs.maxThreads()); + return fuse_h.fuse_loop_mt(fuse, loopCfg); + } finally { + fuse_h.fuse_loop_cfg_destroy(loopCfg); + } } } @Override public void unmount() { fuse_h.fuse_exit(fuse); - fuse_h.fuse_unmount(args.mountPoint(), ch); + fuse_h.fuse_unmount(fuse); } @Override diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseNewHelper.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseNewHelper.java new file mode 100644 index 00000000..261d95de --- /dev/null +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/FuseNewHelper.java @@ -0,0 +1,80 @@ +package org.cryptomator.jfuse.mac; + +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_h; + +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.SymbolLookup; +import java.lang.foreign.ValueLayout; +import java.lang.invoke.MethodHandle; +import java.util.concurrent.atomic.AtomicReference; + +/** + * Helper class to call fuse_new + *

+ * This class is necessary due to changes in libfuse 3.17.1 and onwards: The function {@code fuse_new} is _not_ available anymore as unversioned symbol. + * One can call the function either by also specifying the version or call the unversioned symbol {@code fuse_new_31}. + *

+ * Versioned symbols require a custom SymbolLookup (see PR #117), but libraries loaded via {@link System#loadLibrary(String)} cannot be accessed. + * Hence, this would require to _always_ set the libPath, loosing compatiblity to more exotic linux OSs with custom lib locations. + * To circumvent this issue, we call {@code fuse_version} to decide which (unversioned) symbol name we have to use. + */ +public class FuseNewHelper { + + private static final AtomicReference INSTANCE = new AtomicReference<>(null); + private static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup().or(Linker.nativeLinker().defaultLookup()); + private static final FunctionDescriptor DESC = FunctionDescriptor.of( + fuse_h.C_POINTER, + fuse_h.C_POINTER, + fuse_h.C_POINTER, + fuse_h.C_LONG, + fuse_h.C_POINTER + ); + + private final MethodHandle fuse_new; + + private FuseNewHelper(String symbolName) { + this.fuse_new = Linker.nativeLinker().downcallHandle( + findOrThrow(symbolName), + DESC); + } + + public MemorySegment fuse_new(MemorySegment args, MemorySegment op, long op_size, MemorySegment private_data) { + try { + return (MemorySegment) fuse_new.invokeExact(args, op, op_size, private_data); + } catch (Throwable ex) { + throw new AssertionError("should not reach here", ex); + } + } + + public synchronized static FuseNewHelper getInstance() { + if (INSTANCE.get() == null) { + INSTANCE.set(createInstance()); + } + return INSTANCE.get(); + } + + private static FuseNewHelper createInstance() throws IllegalStateException { + if (getLibVersion() < 317) { + return new FuseNewHelper("fuse_new"); + } else { + return new FuseNewHelper("fuse_new_31"); + } + } + + private static int getLibVersion() { + var fuse_versionSymbol = SymbolLookup.loaderLookup().find("fuse_version").orElseThrow(); + var fuse_versionMethodHandle = Linker.nativeLinker().downcallHandle(fuse_versionSymbol, FunctionDescriptor.of(ValueLayout.JAVA_INT)); + try { + return (int) fuse_versionMethodHandle.invokeExact(); + } catch (Throwable e) { + throw new RuntimeException("Failed to call native method fuse_version", e); + } + } + + private static MemorySegment findOrThrow(String symbol) { + return SYMBOL_LOOKUP.find(symbol) + .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol)); + } +} diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/MacFuseBuilder.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/MacFuseBuilder.java index b9304eb8..a32bf6e1 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/MacFuseBuilder.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/MacFuseBuilder.java @@ -15,8 +15,7 @@ @SupportedPlatform(os = OperatingSystem.MAC, arch = Architecture.ARM64) public class MacFuseBuilder implements FuseBuilder { - private static final String DEFAULT_MACFUSE_LIBNAME = "fuse"; - private static final String DEFAULT_FUSET_LIBNAMNE = "fuse-t"; + private static final String DEFAULT_MACFUSE_LIBNAME = "fuse3"; private static final Errno ERRNO = new MacErrno(); private String libraryPath; @@ -41,16 +40,7 @@ public Fuse build(FuseOperations fuseOperations) throws UnsatisfiedLinkError { if (libraryPath != null) { System.load(libraryPath); } else { - try { - System.loadLibrary(DEFAULT_MACFUSE_LIBNAME); - } catch (UnsatisfiedLinkError errorLoadingMacFuse) { - try { - System.loadLibrary(DEFAULT_FUSET_LIBNAMNE); - } catch (UnsatisfiedLinkError errorLoadingFuseT) { - errorLoadingFuseT.addSuppressed(errorLoadingMacFuse); - throw errorLoadingFuseT; - } - } + System.loadLibrary(DEFAULT_MACFUSE_LIBNAME); } return new FuseImpl(fuseOperations); } 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 57c2f7b6..a560c4c3 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 @@ -2,9 +2,8 @@ import org.cryptomator.jfuse.api.Stat; import org.cryptomator.jfuse.api.TimeSpec; -import org.cryptomator.jfuse.mac.extr.fuse.stat; +import org.cryptomator.jfuse.mac.extr.fuse3.stat; -import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; record StatImpl(MemorySegment segment) implements Stat { diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatvfsImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatvfsImpl.java index b437bdf5..1926f4d4 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatvfsImpl.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/StatvfsImpl.java @@ -1,9 +1,8 @@ package org.cryptomator.jfuse.mac; import org.cryptomator.jfuse.api.Statvfs; -import org.cryptomator.jfuse.mac.extr.fuse.statvfs; +import org.cryptomator.jfuse.mac.extr.fuse3.statvfs; -import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; record StatvfsImpl(MemorySegment segment) implements Statvfs { diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/TimeSpecImpl.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/TimeSpecImpl.java index 38cf85ef..33b15662 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/TimeSpecImpl.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/TimeSpecImpl.java @@ -2,7 +2,7 @@ import org.cryptomator.jfuse.api.TimeSpec; import org.cryptomator.jfuse.mac.extr.stat.stat_h; -import org.cryptomator.jfuse.mac.extr.fuse.timespec; +import org.cryptomator.jfuse.mac.extr.fuse3.timespec; import java.lang.foreign.MemorySegment; import java.time.Instant; diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_h.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_h.java deleted file mode 100644 index d65651ef..00000000 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_h.java +++ /dev/null @@ -1,454 +0,0 @@ -// Generated by jextract - -package org.cryptomator.jfuse.mac.extr.fuse; - -import java.lang.invoke.*; -import java.lang.foreign.*; -import java.nio.ByteOrder; -import java.util.*; -import java.util.function.*; -import java.util.stream.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -public class fuse_h { - - fuse_h() { - // Should not be called directly - } - - static final Arena LIBRARY_ARENA = Arena.ofAuto(); - static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls"); - - static void traceDowncall(String name, Object... args) { - String traceArgs = Arrays.stream(args) - .map(Object::toString) - .collect(Collectors.joining(", ")); - System.out.printf("%s(%s)\n", name, traceArgs); - } - - static MemorySegment findOrThrow(String symbol) { - return SYMBOL_LOOKUP.find(symbol) - .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol)); - } - - static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { - try { - return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType()); - } catch (ReflectiveOperationException ex) { - throw new AssertionError(ex); - } - } - - static MemoryLayout align(MemoryLayout layout, long align) { - return switch (layout) { - case PaddingLayout p -> p; - case ValueLayout v -> v.withByteAlignment(align); - case GroupLayout g -> { - MemoryLayout[] alignedMembers = g.memberLayouts().stream() - .map(m -> align(m, align)).toArray(MemoryLayout[]::new); - yield g instanceof StructLayout ? - MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers); - } - case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align)); - }; - } - - static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup() - .or(Linker.nativeLinker().defaultLookup()); - - public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; - public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; - public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT; - public static final ValueLayout.OfInt C_INT = ValueLayout.JAVA_INT; - public static final ValueLayout.OfLong C_LONG_LONG = ValueLayout.JAVA_LONG; - public static final ValueLayout.OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT; - public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; - public static final AddressLayout C_POINTER = ValueLayout.ADDRESS - .withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, JAVA_BYTE)); - public static final ValueLayout.OfLong C_LONG = ValueLayout.JAVA_LONG; - - private static class fuse_mount { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - fuse_h.C_POINTER, - fuse_h.C_POINTER, - fuse_h.C_POINTER - ); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle( - fuse_h.findOrThrow("fuse_mount"), - DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args) - * } - */ - public static FunctionDescriptor fuse_mount$descriptor() { - return fuse_mount.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args) - * } - */ - public static MethodHandle fuse_mount$handle() { - return fuse_mount.HANDLE; - } - /** - * {@snippet lang=c : - * struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args) - * } - */ - public static MemorySegment fuse_mount(MemorySegment mountpoint, MemorySegment args) { - var mh$ = fuse_mount.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fuse_mount", mountpoint, args); - } - return (MemorySegment)mh$.invokeExact(mountpoint, args); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fuse_unmount { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - fuse_h.C_POINTER, - fuse_h.C_POINTER - ); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle( - fuse_h.findOrThrow("fuse_unmount"), - DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void fuse_unmount(const char *mountpoint, struct fuse_chan *ch) - * } - */ - public static FunctionDescriptor fuse_unmount$descriptor() { - return fuse_unmount.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void fuse_unmount(const char *mountpoint, struct fuse_chan *ch) - * } - */ - public static MethodHandle fuse_unmount$handle() { - return fuse_unmount.HANDLE; - } - /** - * {@snippet lang=c : - * void fuse_unmount(const char *mountpoint, struct fuse_chan *ch) - * } - */ - public static void fuse_unmount(MemorySegment mountpoint, MemorySegment ch) { - var mh$ = fuse_unmount.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fuse_unmount", mountpoint, ch); - } - mh$.invokeExact(mountpoint, ch); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fuse_parse_cmdline { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - fuse_h.C_INT, - fuse_h.C_POINTER, - fuse_h.C_POINTER, - fuse_h.C_POINTER, - fuse_h.C_POINTER - ); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle( - fuse_h.findOrThrow("fuse_parse_cmdline"), - DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fuse_parse_cmdline(struct fuse_args *args, char **mountpoint, int *multithreaded, int *foreground) - * } - */ - public static FunctionDescriptor fuse_parse_cmdline$descriptor() { - return fuse_parse_cmdline.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fuse_parse_cmdline(struct fuse_args *args, char **mountpoint, int *multithreaded, int *foreground) - * } - */ - public static MethodHandle fuse_parse_cmdline$handle() { - return fuse_parse_cmdline.HANDLE; - } - /** - * {@snippet lang=c : - * int fuse_parse_cmdline(struct fuse_args *args, char **mountpoint, int *multithreaded, int *foreground) - * } - */ - public static int fuse_parse_cmdline(MemorySegment args, MemorySegment mountpoint, MemorySegment multithreaded, MemorySegment foreground) { - var mh$ = fuse_parse_cmdline.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fuse_parse_cmdline", args, mountpoint, multithreaded, foreground); - } - return (int)mh$.invokeExact(args, mountpoint, multithreaded, foreground); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fuse_new { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - fuse_h.C_POINTER, - fuse_h.C_POINTER, - fuse_h.C_POINTER, - fuse_h.C_POINTER, - fuse_h.C_LONG, - fuse_h.C_POINTER - ); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle( - fuse_h.findOrThrow("fuse_new"), - DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *user_data) - * } - */ - public static FunctionDescriptor fuse_new$descriptor() { - return fuse_new.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *user_data) - * } - */ - public static MethodHandle fuse_new$handle() { - return fuse_new.HANDLE; - } - /** - * {@snippet lang=c : - * struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args, const struct fuse_operations *op, size_t op_size, void *user_data) - * } - */ - public static MemorySegment fuse_new(MemorySegment ch, MemorySegment args, MemorySegment op, long op_size, MemorySegment user_data) { - var mh$ = fuse_new.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fuse_new", ch, args, op, op_size, user_data); - } - return (MemorySegment)mh$.invokeExact(ch, args, op, op_size, user_data); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fuse_destroy { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - fuse_h.C_POINTER - ); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle( - fuse_h.findOrThrow("fuse_destroy"), - DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void fuse_destroy(struct fuse *f) - * } - */ - public static FunctionDescriptor fuse_destroy$descriptor() { - return fuse_destroy.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void fuse_destroy(struct fuse *f) - * } - */ - public static MethodHandle fuse_destroy$handle() { - return fuse_destroy.HANDLE; - } - /** - * {@snippet lang=c : - * void fuse_destroy(struct fuse *f) - * } - */ - public static void fuse_destroy(MemorySegment f) { - var mh$ = fuse_destroy.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fuse_destroy", f); - } - mh$.invokeExact(f); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fuse_loop { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - fuse_h.C_INT, - fuse_h.C_POINTER - ); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle( - fuse_h.findOrThrow("fuse_loop"), - DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fuse_loop(struct fuse *f) - * } - */ - public static FunctionDescriptor fuse_loop$descriptor() { - return fuse_loop.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fuse_loop(struct fuse *f) - * } - */ - public static MethodHandle fuse_loop$handle() { - return fuse_loop.HANDLE; - } - /** - * {@snippet lang=c : - * int fuse_loop(struct fuse *f) - * } - */ - public static int fuse_loop(MemorySegment f) { - var mh$ = fuse_loop.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fuse_loop", f); - } - return (int)mh$.invokeExact(f); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fuse_exit { - public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( - fuse_h.C_POINTER - ); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle( - fuse_h.findOrThrow("fuse_exit"), - DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * void fuse_exit(struct fuse *f) - * } - */ - public static FunctionDescriptor fuse_exit$descriptor() { - return fuse_exit.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * void fuse_exit(struct fuse *f) - * } - */ - public static MethodHandle fuse_exit$handle() { - return fuse_exit.HANDLE; - } - /** - * {@snippet lang=c : - * void fuse_exit(struct fuse *f) - * } - */ - public static void fuse_exit(MemorySegment f) { - var mh$ = fuse_exit.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fuse_exit", f); - } - mh$.invokeExact(f); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class fuse_loop_mt { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - fuse_h.C_INT, - fuse_h.C_POINTER - ); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle( - fuse_h.findOrThrow("fuse_loop_mt"), - DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * int fuse_loop_mt(struct fuse *f) - * } - */ - public static FunctionDescriptor fuse_loop_mt$descriptor() { - return fuse_loop_mt.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * int fuse_loop_mt(struct fuse *f) - * } - */ - public static MethodHandle fuse_loop_mt$handle() { - return fuse_loop_mt.HANDLE; - } - /** - * {@snippet lang=c : - * int fuse_loop_mt(struct fuse *f) - * } - */ - public static int fuse_loop_mt(MemorySegment f) { - var mh$ = fuse_loop_mt.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("fuse_loop_mt", f); - } - return (int)mh$.invokeExact(f); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_args.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_args.java similarity index 98% rename from jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_args.java rename to jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_args.java index 6efabf63..7932cd60 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_args.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_args.java @@ -1,6 +1,6 @@ // Generated by jextract -package org.cryptomator.jfuse.mac.extr.fuse; +package org.cryptomator.jfuse.mac.extr.fuse3; import java.lang.invoke.*; import java.lang.foreign.*; @@ -203,7 +203,7 @@ public static MemorySegment allocateArray(long elementCount, SegmentAllocator al } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { @@ -211,7 +211,7 @@ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consume } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code elementCount * layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_config.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_config.java new file mode 100644 index 00000000..0c5f8797 --- /dev/null +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_config.java @@ -0,0 +1,1494 @@ +// Generated by jextract + +package org.cryptomator.jfuse.mac.extr.fuse3; + +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + +/** + * {@snippet lang=c : + * struct fuse_config { + * int32_t set_gid; + * uint32_t gid; + * int32_t set_uid; + * uint32_t uid; + * int32_t set_mode; + * uint32_t umask; + * double entry_timeout; + * double negative_timeout; + * double attr_timeout; + * int32_t intr; + * int32_t intr_signal; + * int32_t remember; + * int32_t hard_remove; + * int32_t use_ino; + * int32_t readdir_ino; + * int32_t direct_io; + * int32_t kernel_cache; + * int32_t auto_cache; + * int32_t ac_attr_timeout_set; + * double ac_attr_timeout; + * int32_t nullpath_ok; + * int32_t show_help; + * char *modules; + * int32_t debug; + * uint32_t fmask; + * uint32_t dmask; + * int32_t no_rofd_flush; + * int32_t parallel_direct_writes; + * uint32_t flags; + * uint64_t reserved[48]; + * } + * } + */ +public class fuse_config { + + fuse_config() { + // Should not be called directly + } + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + fuse_h.C_INT.withName("set_gid"), + fuse_h.C_INT.withName("gid"), + fuse_h.C_INT.withName("set_uid"), + fuse_h.C_INT.withName("uid"), + fuse_h.C_INT.withName("set_mode"), + fuse_h.C_INT.withName("umask"), + fuse_h.C_DOUBLE.withName("entry_timeout"), + fuse_h.C_DOUBLE.withName("negative_timeout"), + fuse_h.C_DOUBLE.withName("attr_timeout"), + fuse_h.C_INT.withName("intr"), + fuse_h.C_INT.withName("intr_signal"), + fuse_h.C_INT.withName("remember"), + fuse_h.C_INT.withName("hard_remove"), + fuse_h.C_INT.withName("use_ino"), + fuse_h.C_INT.withName("readdir_ino"), + fuse_h.C_INT.withName("direct_io"), + fuse_h.C_INT.withName("kernel_cache"), + fuse_h.C_INT.withName("auto_cache"), + fuse_h.C_INT.withName("ac_attr_timeout_set"), + fuse_h.C_DOUBLE.withName("ac_attr_timeout"), + fuse_h.C_INT.withName("nullpath_ok"), + fuse_h.C_INT.withName("show_help"), + fuse_h.C_POINTER.withName("modules"), + fuse_h.C_INT.withName("debug"), + fuse_h.C_INT.withName("fmask"), + fuse_h.C_INT.withName("dmask"), + fuse_h.C_INT.withName("no_rofd_flush"), + fuse_h.C_INT.withName("parallel_direct_writes"), + fuse_h.C_INT.withName("flags"), + MemoryLayout.sequenceLayout(48, fuse_h.C_LONG_LONG).withName("reserved") + ).withName("fuse_config"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfInt set_gid$LAYOUT = (OfInt)$LAYOUT.select(groupElement("set_gid")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t set_gid + * } + */ + public static final OfInt set_gid$layout() { + return set_gid$LAYOUT; + } + + private static final long set_gid$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t set_gid + * } + */ + public static final long set_gid$offset() { + return set_gid$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t set_gid + * } + */ + public static int set_gid(MemorySegment struct) { + return struct.get(set_gid$LAYOUT, set_gid$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t set_gid + * } + */ + public static void set_gid(MemorySegment struct, int fieldValue) { + struct.set(set_gid$LAYOUT, set_gid$OFFSET, fieldValue); + } + + private static final OfInt gid$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gid")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint32_t gid + * } + */ + public static final OfInt gid$layout() { + return gid$LAYOUT; + } + + private static final long gid$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * uint32_t gid + * } + */ + public static final long gid$offset() { + return gid$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint32_t gid + * } + */ + public static int gid(MemorySegment struct) { + return struct.get(gid$LAYOUT, gid$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint32_t gid + * } + */ + public static void gid(MemorySegment struct, int fieldValue) { + struct.set(gid$LAYOUT, gid$OFFSET, fieldValue); + } + + private static final OfInt set_uid$LAYOUT = (OfInt)$LAYOUT.select(groupElement("set_uid")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t set_uid + * } + */ + public static final OfInt set_uid$layout() { + return set_uid$LAYOUT; + } + + private static final long set_uid$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t set_uid + * } + */ + public static final long set_uid$offset() { + return set_uid$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t set_uid + * } + */ + public static int set_uid(MemorySegment struct) { + return struct.get(set_uid$LAYOUT, set_uid$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t set_uid + * } + */ + public static void set_uid(MemorySegment struct, int fieldValue) { + struct.set(set_uid$LAYOUT, set_uid$OFFSET, fieldValue); + } + + private static final OfInt uid$LAYOUT = (OfInt)$LAYOUT.select(groupElement("uid")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint32_t uid + * } + */ + public static final OfInt uid$layout() { + return uid$LAYOUT; + } + + private static final long uid$OFFSET = 12; + + /** + * Offset for field: + * {@snippet lang=c : + * uint32_t uid + * } + */ + public static final long uid$offset() { + return uid$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint32_t uid + * } + */ + public static int uid(MemorySegment struct) { + return struct.get(uid$LAYOUT, uid$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint32_t uid + * } + */ + public static void uid(MemorySegment struct, int fieldValue) { + struct.set(uid$LAYOUT, uid$OFFSET, fieldValue); + } + + private static final OfInt set_mode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("set_mode")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t set_mode + * } + */ + public static final OfInt set_mode$layout() { + return set_mode$LAYOUT; + } + + private static final long set_mode$OFFSET = 16; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t set_mode + * } + */ + public static final long set_mode$offset() { + return set_mode$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t set_mode + * } + */ + public static int set_mode(MemorySegment struct) { + return struct.get(set_mode$LAYOUT, set_mode$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t set_mode + * } + */ + public static void set_mode(MemorySegment struct, int fieldValue) { + struct.set(set_mode$LAYOUT, set_mode$OFFSET, fieldValue); + } + + private static final OfInt umask$LAYOUT = (OfInt)$LAYOUT.select(groupElement("umask")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint32_t umask + * } + */ + public static final OfInt umask$layout() { + return umask$LAYOUT; + } + + private static final long umask$OFFSET = 20; + + /** + * Offset for field: + * {@snippet lang=c : + * uint32_t umask + * } + */ + public static final long umask$offset() { + return umask$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint32_t umask + * } + */ + public static int umask(MemorySegment struct) { + return struct.get(umask$LAYOUT, umask$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint32_t umask + * } + */ + public static void umask(MemorySegment struct, int fieldValue) { + struct.set(umask$LAYOUT, umask$OFFSET, fieldValue); + } + + private static final OfDouble entry_timeout$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("entry_timeout")); + + /** + * Layout for field: + * {@snippet lang=c : + * double entry_timeout + * } + */ + public static final OfDouble entry_timeout$layout() { + return entry_timeout$LAYOUT; + } + + private static final long entry_timeout$OFFSET = 24; + + /** + * Offset for field: + * {@snippet lang=c : + * double entry_timeout + * } + */ + public static final long entry_timeout$offset() { + return entry_timeout$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * double entry_timeout + * } + */ + public static double entry_timeout(MemorySegment struct) { + return struct.get(entry_timeout$LAYOUT, entry_timeout$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * double entry_timeout + * } + */ + public static void entry_timeout(MemorySegment struct, double fieldValue) { + struct.set(entry_timeout$LAYOUT, entry_timeout$OFFSET, fieldValue); + } + + private static final OfDouble negative_timeout$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("negative_timeout")); + + /** + * Layout for field: + * {@snippet lang=c : + * double negative_timeout + * } + */ + public static final OfDouble negative_timeout$layout() { + return negative_timeout$LAYOUT; + } + + private static final long negative_timeout$OFFSET = 32; + + /** + * Offset for field: + * {@snippet lang=c : + * double negative_timeout + * } + */ + public static final long negative_timeout$offset() { + return negative_timeout$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * double negative_timeout + * } + */ + public static double negative_timeout(MemorySegment struct) { + return struct.get(negative_timeout$LAYOUT, negative_timeout$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * double negative_timeout + * } + */ + public static void negative_timeout(MemorySegment struct, double fieldValue) { + struct.set(negative_timeout$LAYOUT, negative_timeout$OFFSET, fieldValue); + } + + private static final OfDouble attr_timeout$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("attr_timeout")); + + /** + * Layout for field: + * {@snippet lang=c : + * double attr_timeout + * } + */ + public static final OfDouble attr_timeout$layout() { + return attr_timeout$LAYOUT; + } + + private static final long attr_timeout$OFFSET = 40; + + /** + * Offset for field: + * {@snippet lang=c : + * double attr_timeout + * } + */ + public static final long attr_timeout$offset() { + return attr_timeout$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * double attr_timeout + * } + */ + public static double attr_timeout(MemorySegment struct) { + return struct.get(attr_timeout$LAYOUT, attr_timeout$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * double attr_timeout + * } + */ + public static void attr_timeout(MemorySegment struct, double fieldValue) { + struct.set(attr_timeout$LAYOUT, attr_timeout$OFFSET, fieldValue); + } + + private static final OfInt intr$LAYOUT = (OfInt)$LAYOUT.select(groupElement("intr")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t intr + * } + */ + public static final OfInt intr$layout() { + return intr$LAYOUT; + } + + private static final long intr$OFFSET = 48; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t intr + * } + */ + public static final long intr$offset() { + return intr$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t intr + * } + */ + public static int intr(MemorySegment struct) { + return struct.get(intr$LAYOUT, intr$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t intr + * } + */ + public static void intr(MemorySegment struct, int fieldValue) { + struct.set(intr$LAYOUT, intr$OFFSET, fieldValue); + } + + private static final OfInt intr_signal$LAYOUT = (OfInt)$LAYOUT.select(groupElement("intr_signal")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t intr_signal + * } + */ + public static final OfInt intr_signal$layout() { + return intr_signal$LAYOUT; + } + + private static final long intr_signal$OFFSET = 52; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t intr_signal + * } + */ + public static final long intr_signal$offset() { + return intr_signal$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t intr_signal + * } + */ + public static int intr_signal(MemorySegment struct) { + return struct.get(intr_signal$LAYOUT, intr_signal$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t intr_signal + * } + */ + public static void intr_signal(MemorySegment struct, int fieldValue) { + struct.set(intr_signal$LAYOUT, intr_signal$OFFSET, fieldValue); + } + + private static final OfInt remember$LAYOUT = (OfInt)$LAYOUT.select(groupElement("remember")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t remember + * } + */ + public static final OfInt remember$layout() { + return remember$LAYOUT; + } + + private static final long remember$OFFSET = 56; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t remember + * } + */ + public static final long remember$offset() { + return remember$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t remember + * } + */ + public static int remember(MemorySegment struct) { + return struct.get(remember$LAYOUT, remember$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t remember + * } + */ + public static void remember(MemorySegment struct, int fieldValue) { + struct.set(remember$LAYOUT, remember$OFFSET, fieldValue); + } + + private static final OfInt hard_remove$LAYOUT = (OfInt)$LAYOUT.select(groupElement("hard_remove")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t hard_remove + * } + */ + public static final OfInt hard_remove$layout() { + return hard_remove$LAYOUT; + } + + private static final long hard_remove$OFFSET = 60; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t hard_remove + * } + */ + public static final long hard_remove$offset() { + return hard_remove$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t hard_remove + * } + */ + public static int hard_remove(MemorySegment struct) { + return struct.get(hard_remove$LAYOUT, hard_remove$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t hard_remove + * } + */ + public static void hard_remove(MemorySegment struct, int fieldValue) { + struct.set(hard_remove$LAYOUT, hard_remove$OFFSET, fieldValue); + } + + private static final OfInt use_ino$LAYOUT = (OfInt)$LAYOUT.select(groupElement("use_ino")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t use_ino + * } + */ + public static final OfInt use_ino$layout() { + return use_ino$LAYOUT; + } + + private static final long use_ino$OFFSET = 64; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t use_ino + * } + */ + public static final long use_ino$offset() { + return use_ino$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t use_ino + * } + */ + public static int use_ino(MemorySegment struct) { + return struct.get(use_ino$LAYOUT, use_ino$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t use_ino + * } + */ + public static void use_ino(MemorySegment struct, int fieldValue) { + struct.set(use_ino$LAYOUT, use_ino$OFFSET, fieldValue); + } + + private static final OfInt readdir_ino$LAYOUT = (OfInt)$LAYOUT.select(groupElement("readdir_ino")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t readdir_ino + * } + */ + public static final OfInt readdir_ino$layout() { + return readdir_ino$LAYOUT; + } + + private static final long readdir_ino$OFFSET = 68; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t readdir_ino + * } + */ + public static final long readdir_ino$offset() { + return readdir_ino$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t readdir_ino + * } + */ + public static int readdir_ino(MemorySegment struct) { + return struct.get(readdir_ino$LAYOUT, readdir_ino$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t readdir_ino + * } + */ + public static void readdir_ino(MemorySegment struct, int fieldValue) { + struct.set(readdir_ino$LAYOUT, readdir_ino$OFFSET, fieldValue); + } + + private static final OfInt direct_io$LAYOUT = (OfInt)$LAYOUT.select(groupElement("direct_io")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t direct_io + * } + */ + public static final OfInt direct_io$layout() { + return direct_io$LAYOUT; + } + + private static final long direct_io$OFFSET = 72; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t direct_io + * } + */ + public static final long direct_io$offset() { + return direct_io$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t direct_io + * } + */ + public static int direct_io(MemorySegment struct) { + return struct.get(direct_io$LAYOUT, direct_io$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t direct_io + * } + */ + public static void direct_io(MemorySegment struct, int fieldValue) { + struct.set(direct_io$LAYOUT, direct_io$OFFSET, fieldValue); + } + + private static final OfInt kernel_cache$LAYOUT = (OfInt)$LAYOUT.select(groupElement("kernel_cache")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t kernel_cache + * } + */ + public static final OfInt kernel_cache$layout() { + return kernel_cache$LAYOUT; + } + + private static final long kernel_cache$OFFSET = 76; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t kernel_cache + * } + */ + public static final long kernel_cache$offset() { + return kernel_cache$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t kernel_cache + * } + */ + public static int kernel_cache(MemorySegment struct) { + return struct.get(kernel_cache$LAYOUT, kernel_cache$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t kernel_cache + * } + */ + public static void kernel_cache(MemorySegment struct, int fieldValue) { + struct.set(kernel_cache$LAYOUT, kernel_cache$OFFSET, fieldValue); + } + + private static final OfInt auto_cache$LAYOUT = (OfInt)$LAYOUT.select(groupElement("auto_cache")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t auto_cache + * } + */ + public static final OfInt auto_cache$layout() { + return auto_cache$LAYOUT; + } + + private static final long auto_cache$OFFSET = 80; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t auto_cache + * } + */ + public static final long auto_cache$offset() { + return auto_cache$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t auto_cache + * } + */ + public static int auto_cache(MemorySegment struct) { + return struct.get(auto_cache$LAYOUT, auto_cache$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t auto_cache + * } + */ + public static void auto_cache(MemorySegment struct, int fieldValue) { + struct.set(auto_cache$LAYOUT, auto_cache$OFFSET, fieldValue); + } + + private static final OfInt ac_attr_timeout_set$LAYOUT = (OfInt)$LAYOUT.select(groupElement("ac_attr_timeout_set")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t ac_attr_timeout_set + * } + */ + public static final OfInt ac_attr_timeout_set$layout() { + return ac_attr_timeout_set$LAYOUT; + } + + private static final long ac_attr_timeout_set$OFFSET = 84; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t ac_attr_timeout_set + * } + */ + public static final long ac_attr_timeout_set$offset() { + return ac_attr_timeout_set$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t ac_attr_timeout_set + * } + */ + public static int ac_attr_timeout_set(MemorySegment struct) { + return struct.get(ac_attr_timeout_set$LAYOUT, ac_attr_timeout_set$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t ac_attr_timeout_set + * } + */ + public static void ac_attr_timeout_set(MemorySegment struct, int fieldValue) { + struct.set(ac_attr_timeout_set$LAYOUT, ac_attr_timeout_set$OFFSET, fieldValue); + } + + private static final OfDouble ac_attr_timeout$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("ac_attr_timeout")); + + /** + * Layout for field: + * {@snippet lang=c : + * double ac_attr_timeout + * } + */ + public static final OfDouble ac_attr_timeout$layout() { + return ac_attr_timeout$LAYOUT; + } + + private static final long ac_attr_timeout$OFFSET = 88; + + /** + * Offset for field: + * {@snippet lang=c : + * double ac_attr_timeout + * } + */ + public static final long ac_attr_timeout$offset() { + return ac_attr_timeout$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * double ac_attr_timeout + * } + */ + public static double ac_attr_timeout(MemorySegment struct) { + return struct.get(ac_attr_timeout$LAYOUT, ac_attr_timeout$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * double ac_attr_timeout + * } + */ + public static void ac_attr_timeout(MemorySegment struct, double fieldValue) { + struct.set(ac_attr_timeout$LAYOUT, ac_attr_timeout$OFFSET, fieldValue); + } + + private static final OfInt nullpath_ok$LAYOUT = (OfInt)$LAYOUT.select(groupElement("nullpath_ok")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t nullpath_ok + * } + */ + public static final OfInt nullpath_ok$layout() { + return nullpath_ok$LAYOUT; + } + + private static final long nullpath_ok$OFFSET = 96; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t nullpath_ok + * } + */ + public static final long nullpath_ok$offset() { + return nullpath_ok$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t nullpath_ok + * } + */ + public static int nullpath_ok(MemorySegment struct) { + return struct.get(nullpath_ok$LAYOUT, nullpath_ok$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t nullpath_ok + * } + */ + public static void nullpath_ok(MemorySegment struct, int fieldValue) { + struct.set(nullpath_ok$LAYOUT, nullpath_ok$OFFSET, fieldValue); + } + + private static final OfInt show_help$LAYOUT = (OfInt)$LAYOUT.select(groupElement("show_help")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t show_help + * } + */ + public static final OfInt show_help$layout() { + return show_help$LAYOUT; + } + + private static final long show_help$OFFSET = 100; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t show_help + * } + */ + public static final long show_help$offset() { + return show_help$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t show_help + * } + */ + public static int show_help(MemorySegment struct) { + return struct.get(show_help$LAYOUT, show_help$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t show_help + * } + */ + public static void show_help(MemorySegment struct, int fieldValue) { + struct.set(show_help$LAYOUT, show_help$OFFSET, fieldValue); + } + + private static final AddressLayout modules$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("modules")); + + /** + * Layout for field: + * {@snippet lang=c : + * char *modules + * } + */ + public static final AddressLayout modules$layout() { + return modules$LAYOUT; + } + + private static final long modules$OFFSET = 104; + + /** + * Offset for field: + * {@snippet lang=c : + * char *modules + * } + */ + public static final long modules$offset() { + return modules$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * char *modules + * } + */ + public static MemorySegment modules(MemorySegment struct) { + return struct.get(modules$LAYOUT, modules$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * char *modules + * } + */ + public static void modules(MemorySegment struct, MemorySegment fieldValue) { + struct.set(modules$LAYOUT, modules$OFFSET, fieldValue); + } + + private static final OfInt debug$LAYOUT = (OfInt)$LAYOUT.select(groupElement("debug")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t debug + * } + */ + public static final OfInt debug$layout() { + return debug$LAYOUT; + } + + private static final long debug$OFFSET = 112; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t debug + * } + */ + public static final long debug$offset() { + return debug$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t debug + * } + */ + public static int debug(MemorySegment struct) { + return struct.get(debug$LAYOUT, debug$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t debug + * } + */ + public static void debug(MemorySegment struct, int fieldValue) { + struct.set(debug$LAYOUT, debug$OFFSET, fieldValue); + } + + private static final OfInt fmask$LAYOUT = (OfInt)$LAYOUT.select(groupElement("fmask")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint32_t fmask + * } + */ + public static final OfInt fmask$layout() { + return fmask$LAYOUT; + } + + private static final long fmask$OFFSET = 116; + + /** + * Offset for field: + * {@snippet lang=c : + * uint32_t fmask + * } + */ + public static final long fmask$offset() { + return fmask$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint32_t fmask + * } + */ + public static int fmask(MemorySegment struct) { + return struct.get(fmask$LAYOUT, fmask$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint32_t fmask + * } + */ + public static void fmask(MemorySegment struct, int fieldValue) { + struct.set(fmask$LAYOUT, fmask$OFFSET, fieldValue); + } + + private static final OfInt dmask$LAYOUT = (OfInt)$LAYOUT.select(groupElement("dmask")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint32_t dmask + * } + */ + public static final OfInt dmask$layout() { + return dmask$LAYOUT; + } + + private static final long dmask$OFFSET = 120; + + /** + * Offset for field: + * {@snippet lang=c : + * uint32_t dmask + * } + */ + public static final long dmask$offset() { + return dmask$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint32_t dmask + * } + */ + public static int dmask(MemorySegment struct) { + return struct.get(dmask$LAYOUT, dmask$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint32_t dmask + * } + */ + public static void dmask(MemorySegment struct, int fieldValue) { + struct.set(dmask$LAYOUT, dmask$OFFSET, fieldValue); + } + + private static final OfInt no_rofd_flush$LAYOUT = (OfInt)$LAYOUT.select(groupElement("no_rofd_flush")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t no_rofd_flush + * } + */ + public static final OfInt no_rofd_flush$layout() { + return no_rofd_flush$LAYOUT; + } + + private static final long no_rofd_flush$OFFSET = 124; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t no_rofd_flush + * } + */ + public static final long no_rofd_flush$offset() { + return no_rofd_flush$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t no_rofd_flush + * } + */ + public static int no_rofd_flush(MemorySegment struct) { + return struct.get(no_rofd_flush$LAYOUT, no_rofd_flush$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t no_rofd_flush + * } + */ + public static void no_rofd_flush(MemorySegment struct, int fieldValue) { + struct.set(no_rofd_flush$LAYOUT, no_rofd_flush$OFFSET, fieldValue); + } + + private static final OfInt parallel_direct_writes$LAYOUT = (OfInt)$LAYOUT.select(groupElement("parallel_direct_writes")); + + /** + * Layout for field: + * {@snippet lang=c : + * int32_t parallel_direct_writes + * } + */ + public static final OfInt parallel_direct_writes$layout() { + return parallel_direct_writes$LAYOUT; + } + + private static final long parallel_direct_writes$OFFSET = 128; + + /** + * Offset for field: + * {@snippet lang=c : + * int32_t parallel_direct_writes + * } + */ + public static final long parallel_direct_writes$offset() { + return parallel_direct_writes$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int32_t parallel_direct_writes + * } + */ + public static int parallel_direct_writes(MemorySegment struct) { + return struct.get(parallel_direct_writes$LAYOUT, parallel_direct_writes$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int32_t parallel_direct_writes + * } + */ + public static void parallel_direct_writes(MemorySegment struct, int fieldValue) { + struct.set(parallel_direct_writes$LAYOUT, parallel_direct_writes$OFFSET, fieldValue); + } + + private static final OfInt flags$LAYOUT = (OfInt)$LAYOUT.select(groupElement("flags")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint32_t flags + * } + */ + public static final OfInt flags$layout() { + return flags$LAYOUT; + } + + private static final long flags$OFFSET = 132; + + /** + * Offset for field: + * {@snippet lang=c : + * uint32_t flags + * } + */ + public static final long flags$offset() { + return flags$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint32_t flags + * } + */ + public static int flags(MemorySegment struct) { + return struct.get(flags$LAYOUT, flags$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint32_t flags + * } + */ + public static void flags(MemorySegment struct, int fieldValue) { + struct.set(flags$LAYOUT, flags$OFFSET, fieldValue); + } + + private static final SequenceLayout reserved$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("reserved")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint64_t reserved[48] + * } + */ + public static final SequenceLayout reserved$layout() { + return reserved$LAYOUT; + } + + private static final long reserved$OFFSET = 136; + + /** + * Offset for field: + * {@snippet lang=c : + * uint64_t reserved[48] + * } + */ + public static final long reserved$offset() { + return reserved$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint64_t reserved[48] + * } + */ + public static MemorySegment reserved(MemorySegment struct) { + return struct.asSlice(reserved$OFFSET, reserved$LAYOUT.byteSize()); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint64_t reserved[48] + * } + */ + public static void reserved(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, reserved$OFFSET, reserved$LAYOUT.byteSize()); + } + + private static long[] reserved$DIMS = { 48 }; + + /** + * Dimensions for array field: + * {@snippet lang=c : + * uint64_t reserved[48] + * } + */ + public static long[] reserved$dimensions() { + return reserved$DIMS; + } + private static final VarHandle reserved$ELEM_HANDLE = reserved$LAYOUT.varHandle(sequenceElement()); + + /** + * Indexed getter for field: + * {@snippet lang=c : + * uint64_t reserved[48] + * } + */ + public static long reserved(MemorySegment struct, long index0) { + return (long)reserved$ELEM_HANDLE.get(struct, 0L, index0); + } + + /** + * Indexed setter for field: + * {@snippet lang=c : + * uint64_t reserved[48] + * } + */ + public static void reserved(MemorySegment struct, long index0, long fieldValue) { + reserved$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); + } + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); + } + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { + return reinterpret(addr, 1, arena, cleanup); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); + } +} + diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_conn_info.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_conn_info.java similarity index 63% rename from jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_conn_info.java rename to jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_conn_info.java index e8299176..d24c8b51 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_conn_info.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_conn_info.java @@ -1,6 +1,6 @@ // Generated by jextract -package org.cryptomator.jfuse.mac.extr.fuse; +package org.cryptomator.jfuse.mac.extr.fuse3; import java.lang.invoke.*; import java.lang.foreign.*; @@ -15,16 +15,22 @@ /** * {@snippet lang=c : * struct fuse_conn_info { - * unsigned int proto_major; - * unsigned int proto_minor; - * unsigned int async_read; - * unsigned int max_write; - * unsigned int max_readahead; - * unsigned int capable; - * unsigned int want; - * unsigned int max_background; - * unsigned int congestion_threshold; - * unsigned int reserved[23]; + * uint32_t proto_major; + * uint32_t proto_minor; + * uint32_t max_write; + * uint32_t max_read; + * uint32_t max_readahead; + * uint32_t capable; + * uint32_t want; + * uint32_t max_background; + * uint32_t congestion_threshold; + * uint32_t time_gran; + * uint32_t max_backing_stack_depth; + * uint32_t no_interrupt : 1; + * uint32_t padding : 31; + * uint64_t capable_ext; + * uint64_t want_ext; + * uint32_t reserved[16]; * } * } */ @@ -37,14 +43,19 @@ public class fuse_conn_info { private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( fuse_h.C_INT.withName("proto_major"), fuse_h.C_INT.withName("proto_minor"), - fuse_h.C_INT.withName("async_read"), fuse_h.C_INT.withName("max_write"), + fuse_h.C_INT.withName("max_read"), fuse_h.C_INT.withName("max_readahead"), fuse_h.C_INT.withName("capable"), fuse_h.C_INT.withName("want"), fuse_h.C_INT.withName("max_background"), fuse_h.C_INT.withName("congestion_threshold"), - MemoryLayout.sequenceLayout(23, fuse_h.C_INT).withName("reserved") + fuse_h.C_INT.withName("time_gran"), + fuse_h.C_INT.withName("max_backing_stack_depth"), + MemoryLayout.paddingLayout(4), + fuse_h.C_LONG_LONG.withName("capable_ext"), + fuse_h.C_LONG_LONG.withName("want_ext"), + MemoryLayout.sequenceLayout(16, fuse_h.C_INT).withName("reserved") ).withName("fuse_conn_info"); /** @@ -59,7 +70,7 @@ public static final GroupLayout layout() { /** * Layout for field: * {@snippet lang=c : - * unsigned int proto_major + * uint32_t proto_major * } */ public static final OfInt proto_major$layout() { @@ -71,7 +82,7 @@ public static final GroupLayout layout() { /** * Offset for field: * {@snippet lang=c : - * unsigned int proto_major + * uint32_t proto_major * } */ public static final long proto_major$offset() { @@ -81,7 +92,7 @@ public static final GroupLayout layout() { /** * Getter for field: * {@snippet lang=c : - * unsigned int proto_major + * uint32_t proto_major * } */ public static int proto_major(MemorySegment struct) { @@ -91,7 +102,7 @@ public static int proto_major(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * unsigned int proto_major + * uint32_t proto_major * } */ public static void proto_major(MemorySegment struct, int fieldValue) { @@ -103,7 +114,7 @@ public static void proto_major(MemorySegment struct, int fieldValue) { /** * Layout for field: * {@snippet lang=c : - * unsigned int proto_minor + * uint32_t proto_minor * } */ public static final OfInt proto_minor$layout() { @@ -115,7 +126,7 @@ public static void proto_major(MemorySegment struct, int fieldValue) { /** * Offset for field: * {@snippet lang=c : - * unsigned int proto_minor + * uint32_t proto_minor * } */ public static final long proto_minor$offset() { @@ -125,7 +136,7 @@ public static void proto_major(MemorySegment struct, int fieldValue) { /** * Getter for field: * {@snippet lang=c : - * unsigned int proto_minor + * uint32_t proto_minor * } */ public static int proto_minor(MemorySegment struct) { @@ -135,99 +146,99 @@ public static int proto_minor(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * unsigned int proto_minor + * uint32_t proto_minor * } */ public static void proto_minor(MemorySegment struct, int fieldValue) { struct.set(proto_minor$LAYOUT, proto_minor$OFFSET, fieldValue); } - private static final OfInt async_read$LAYOUT = (OfInt)$LAYOUT.select(groupElement("async_read")); + private static final OfInt max_write$LAYOUT = (OfInt)$LAYOUT.select(groupElement("max_write")); /** * Layout for field: * {@snippet lang=c : - * unsigned int async_read + * uint32_t max_write * } */ - public static final OfInt async_read$layout() { - return async_read$LAYOUT; + public static final OfInt max_write$layout() { + return max_write$LAYOUT; } - private static final long async_read$OFFSET = 8; + private static final long max_write$OFFSET = 8; /** * Offset for field: * {@snippet lang=c : - * unsigned int async_read + * uint32_t max_write * } */ - public static final long async_read$offset() { - return async_read$OFFSET; + public static final long max_write$offset() { + return max_write$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * unsigned int async_read + * uint32_t max_write * } */ - public static int async_read(MemorySegment struct) { - return struct.get(async_read$LAYOUT, async_read$OFFSET); + public static int max_write(MemorySegment struct) { + return struct.get(max_write$LAYOUT, max_write$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * unsigned int async_read + * uint32_t max_write * } */ - public static void async_read(MemorySegment struct, int fieldValue) { - struct.set(async_read$LAYOUT, async_read$OFFSET, fieldValue); + public static void max_write(MemorySegment struct, int fieldValue) { + struct.set(max_write$LAYOUT, max_write$OFFSET, fieldValue); } - private static final OfInt max_write$LAYOUT = (OfInt)$LAYOUT.select(groupElement("max_write")); + private static final OfInt max_read$LAYOUT = (OfInt)$LAYOUT.select(groupElement("max_read")); /** * Layout for field: * {@snippet lang=c : - * unsigned int max_write + * uint32_t max_read * } */ - public static final OfInt max_write$layout() { - return max_write$LAYOUT; + public static final OfInt max_read$layout() { + return max_read$LAYOUT; } - private static final long max_write$OFFSET = 12; + private static final long max_read$OFFSET = 12; /** * Offset for field: * {@snippet lang=c : - * unsigned int max_write + * uint32_t max_read * } */ - public static final long max_write$offset() { - return max_write$OFFSET; + public static final long max_read$offset() { + return max_read$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * unsigned int max_write + * uint32_t max_read * } */ - public static int max_write(MemorySegment struct) { - return struct.get(max_write$LAYOUT, max_write$OFFSET); + public static int max_read(MemorySegment struct) { + return struct.get(max_read$LAYOUT, max_read$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * unsigned int max_write + * uint32_t max_read * } */ - public static void max_write(MemorySegment struct, int fieldValue) { - struct.set(max_write$LAYOUT, max_write$OFFSET, fieldValue); + public static void max_read(MemorySegment struct, int fieldValue) { + struct.set(max_read$LAYOUT, max_read$OFFSET, fieldValue); } private static final OfInt max_readahead$LAYOUT = (OfInt)$LAYOUT.select(groupElement("max_readahead")); @@ -235,7 +246,7 @@ public static void max_write(MemorySegment struct, int fieldValue) { /** * Layout for field: * {@snippet lang=c : - * unsigned int max_readahead + * uint32_t max_readahead * } */ public static final OfInt max_readahead$layout() { @@ -247,7 +258,7 @@ public static void max_write(MemorySegment struct, int fieldValue) { /** * Offset for field: * {@snippet lang=c : - * unsigned int max_readahead + * uint32_t max_readahead * } */ public static final long max_readahead$offset() { @@ -257,7 +268,7 @@ public static void max_write(MemorySegment struct, int fieldValue) { /** * Getter for field: * {@snippet lang=c : - * unsigned int max_readahead + * uint32_t max_readahead * } */ public static int max_readahead(MemorySegment struct) { @@ -267,7 +278,7 @@ public static int max_readahead(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * unsigned int max_readahead + * uint32_t max_readahead * } */ public static void max_readahead(MemorySegment struct, int fieldValue) { @@ -279,7 +290,7 @@ public static void max_readahead(MemorySegment struct, int fieldValue) { /** * Layout for field: * {@snippet lang=c : - * unsigned int capable + * uint32_t capable * } */ public static final OfInt capable$layout() { @@ -291,7 +302,7 @@ public static void max_readahead(MemorySegment struct, int fieldValue) { /** * Offset for field: * {@snippet lang=c : - * unsigned int capable + * uint32_t capable * } */ public static final long capable$offset() { @@ -301,7 +312,7 @@ public static void max_readahead(MemorySegment struct, int fieldValue) { /** * Getter for field: * {@snippet lang=c : - * unsigned int capable + * uint32_t capable * } */ public static int capable(MemorySegment struct) { @@ -311,7 +322,7 @@ public static int capable(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * unsigned int capable + * uint32_t capable * } */ public static void capable(MemorySegment struct, int fieldValue) { @@ -323,7 +334,7 @@ public static void capable(MemorySegment struct, int fieldValue) { /** * Layout for field: * {@snippet lang=c : - * unsigned int want + * uint32_t want * } */ public static final OfInt want$layout() { @@ -335,7 +346,7 @@ public static void capable(MemorySegment struct, int fieldValue) { /** * Offset for field: * {@snippet lang=c : - * unsigned int want + * uint32_t want * } */ public static final long want$offset() { @@ -345,7 +356,7 @@ public static void capable(MemorySegment struct, int fieldValue) { /** * Getter for field: * {@snippet lang=c : - * unsigned int want + * uint32_t want * } */ public static int want(MemorySegment struct) { @@ -355,7 +366,7 @@ public static int want(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * unsigned int want + * uint32_t want * } */ public static void want(MemorySegment struct, int fieldValue) { @@ -367,7 +378,7 @@ public static void want(MemorySegment struct, int fieldValue) { /** * Layout for field: * {@snippet lang=c : - * unsigned int max_background + * uint32_t max_background * } */ public static final OfInt max_background$layout() { @@ -379,7 +390,7 @@ public static void want(MemorySegment struct, int fieldValue) { /** * Offset for field: * {@snippet lang=c : - * unsigned int max_background + * uint32_t max_background * } */ public static final long max_background$offset() { @@ -389,7 +400,7 @@ public static void want(MemorySegment struct, int fieldValue) { /** * Getter for field: * {@snippet lang=c : - * unsigned int max_background + * uint32_t max_background * } */ public static int max_background(MemorySegment struct) { @@ -399,7 +410,7 @@ public static int max_background(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * unsigned int max_background + * uint32_t max_background * } */ public static void max_background(MemorySegment struct, int fieldValue) { @@ -411,7 +422,7 @@ public static void max_background(MemorySegment struct, int fieldValue) { /** * Layout for field: * {@snippet lang=c : - * unsigned int congestion_threshold + * uint32_t congestion_threshold * } */ public static final OfInt congestion_threshold$layout() { @@ -423,7 +434,7 @@ public static void max_background(MemorySegment struct, int fieldValue) { /** * Offset for field: * {@snippet lang=c : - * unsigned int congestion_threshold + * uint32_t congestion_threshold * } */ public static final long congestion_threshold$offset() { @@ -433,7 +444,7 @@ public static void max_background(MemorySegment struct, int fieldValue) { /** * Getter for field: * {@snippet lang=c : - * unsigned int congestion_threshold + * uint32_t congestion_threshold * } */ public static int congestion_threshold(MemorySegment struct) { @@ -443,31 +454,207 @@ public static int congestion_threshold(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * unsigned int congestion_threshold + * uint32_t congestion_threshold * } */ public static void congestion_threshold(MemorySegment struct, int fieldValue) { struct.set(congestion_threshold$LAYOUT, congestion_threshold$OFFSET, fieldValue); } + private static final OfInt time_gran$LAYOUT = (OfInt)$LAYOUT.select(groupElement("time_gran")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint32_t time_gran + * } + */ + public static final OfInt time_gran$layout() { + return time_gran$LAYOUT; + } + + private static final long time_gran$OFFSET = 36; + + /** + * Offset for field: + * {@snippet lang=c : + * uint32_t time_gran + * } + */ + public static final long time_gran$offset() { + return time_gran$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint32_t time_gran + * } + */ + public static int time_gran(MemorySegment struct) { + return struct.get(time_gran$LAYOUT, time_gran$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint32_t time_gran + * } + */ + public static void time_gran(MemorySegment struct, int fieldValue) { + struct.set(time_gran$LAYOUT, time_gran$OFFSET, fieldValue); + } + + private static final OfInt max_backing_stack_depth$LAYOUT = (OfInt)$LAYOUT.select(groupElement("max_backing_stack_depth")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint32_t max_backing_stack_depth + * } + */ + public static final OfInt max_backing_stack_depth$layout() { + return max_backing_stack_depth$LAYOUT; + } + + private static final long max_backing_stack_depth$OFFSET = 40; + + /** + * Offset for field: + * {@snippet lang=c : + * uint32_t max_backing_stack_depth + * } + */ + public static final long max_backing_stack_depth$offset() { + return max_backing_stack_depth$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint32_t max_backing_stack_depth + * } + */ + public static int max_backing_stack_depth(MemorySegment struct) { + return struct.get(max_backing_stack_depth$LAYOUT, max_backing_stack_depth$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint32_t max_backing_stack_depth + * } + */ + public static void max_backing_stack_depth(MemorySegment struct, int fieldValue) { + struct.set(max_backing_stack_depth$LAYOUT, max_backing_stack_depth$OFFSET, fieldValue); + } + + private static final OfLong capable_ext$LAYOUT = (OfLong)$LAYOUT.select(groupElement("capable_ext")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint64_t capable_ext + * } + */ + public static final OfLong capable_ext$layout() { + return capable_ext$LAYOUT; + } + + private static final long capable_ext$OFFSET = 48; + + /** + * Offset for field: + * {@snippet lang=c : + * uint64_t capable_ext + * } + */ + public static final long capable_ext$offset() { + return capable_ext$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint64_t capable_ext + * } + */ + public static long capable_ext(MemorySegment struct) { + return struct.get(capable_ext$LAYOUT, capable_ext$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint64_t capable_ext + * } + */ + public static void capable_ext(MemorySegment struct, long fieldValue) { + struct.set(capable_ext$LAYOUT, capable_ext$OFFSET, fieldValue); + } + + private static final OfLong want_ext$LAYOUT = (OfLong)$LAYOUT.select(groupElement("want_ext")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint64_t want_ext + * } + */ + public static final OfLong want_ext$layout() { + return want_ext$LAYOUT; + } + + private static final long want_ext$OFFSET = 56; + + /** + * Offset for field: + * {@snippet lang=c : + * uint64_t want_ext + * } + */ + public static final long want_ext$offset() { + return want_ext$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint64_t want_ext + * } + */ + public static long want_ext(MemorySegment struct) { + return struct.get(want_ext$LAYOUT, want_ext$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint64_t want_ext + * } + */ + public static void want_ext(MemorySegment struct, long fieldValue) { + struct.set(want_ext$LAYOUT, want_ext$OFFSET, fieldValue); + } + private static final SequenceLayout reserved$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("reserved")); /** * Layout for field: * {@snippet lang=c : - * unsigned int reserved[23] + * uint32_t reserved[16] * } */ public static final SequenceLayout reserved$layout() { return reserved$LAYOUT; } - private static final long reserved$OFFSET = 36; + private static final long reserved$OFFSET = 64; /** * Offset for field: * {@snippet lang=c : - * unsigned int reserved[23] + * uint32_t reserved[16] * } */ public static final long reserved$offset() { @@ -477,7 +664,7 @@ public static void congestion_threshold(MemorySegment struct, int fieldValue) { /** * Getter for field: * {@snippet lang=c : - * unsigned int reserved[23] + * uint32_t reserved[16] * } */ public static MemorySegment reserved(MemorySegment struct) { @@ -487,19 +674,19 @@ public static MemorySegment reserved(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * unsigned int reserved[23] + * uint32_t reserved[16] * } */ public static void reserved(MemorySegment struct, MemorySegment fieldValue) { MemorySegment.copy(fieldValue, 0L, struct, reserved$OFFSET, reserved$LAYOUT.byteSize()); } - private static long[] reserved$DIMS = { 23 }; + private static long[] reserved$DIMS = { 16 }; /** * Dimensions for array field: * {@snippet lang=c : - * unsigned int reserved[23] + * uint32_t reserved[16] * } */ public static long[] reserved$dimensions() { @@ -510,7 +697,7 @@ public static void reserved(MemorySegment struct, MemorySegment fieldValue) { /** * Indexed getter for field: * {@snippet lang=c : - * unsigned int reserved[23] + * uint32_t reserved[16] * } */ public static int reserved(MemorySegment struct, long index0) { @@ -520,7 +707,7 @@ public static int reserved(MemorySegment struct, long index0) { /** * Indexed setter for field: * {@snippet lang=c : - * unsigned int reserved[23] + * uint32_t reserved[16] * } */ public static void reserved(MemorySegment struct, long index0, int fieldValue) { @@ -556,7 +743,7 @@ public static MemorySegment allocateArray(long elementCount, SegmentAllocator al } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { @@ -564,7 +751,7 @@ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consume } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code elementCount * layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_file_info.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_file_info.java similarity index 51% rename from jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_file_info.java rename to jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_file_info.java index 6e6e72b9..11a0a610 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_file_info.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_file_info.java @@ -1,6 +1,6 @@ // Generated by jextract -package org.cryptomator.jfuse.mac.extr.fuse; +package org.cryptomator.jfuse.mac.extr.fuse3; import java.lang.invoke.*; import java.lang.foreign.*; @@ -15,17 +15,25 @@ /** * {@snippet lang=c : * struct fuse_file_info { - * int flags; - * unsigned long fh_old; - * int writepage; - * unsigned int direct_io : 1; - * unsigned int keep_cache : 1; - * unsigned int flush : 1; - * unsigned int nonseekable : 1; - * unsigned int flock_release : 1; - * unsigned int padding : 27; + * int32_t flags; + * uint32_t writepage : 1; + * uint32_t direct_io : 1; + * uint32_t keep_cache : 1; + * uint32_t flush : 1; + * uint32_t nonseekable : 1; + * uint32_t flock_release : 1; + * uint32_t cache_readdir : 1; + * uint32_t noflush : 1; + * uint32_t parallel_direct_writes : 1; + * uint32_t padding : 23; + * uint32_t padding2 : 32; + * uint32_t padding3 : 32; * uint64_t fh; * uint64_t lock_owner; + * uint32_t poll_events; + * int32_t backing_id; + * uint64_t compat_flags; + * uint64_t reserved[2]; * } * } */ @@ -37,12 +45,13 @@ public class fuse_file_info { private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( fuse_h.C_INT.withName("flags"), - MemoryLayout.paddingLayout(4), - fuse_h.C_LONG.withName("fh_old"), - fuse_h.C_INT.withName("writepage"), - MemoryLayout.paddingLayout(4), + MemoryLayout.paddingLayout(12), fuse_h.C_LONG_LONG.withName("fh"), - fuse_h.C_LONG_LONG.withName("lock_owner") + fuse_h.C_LONG_LONG.withName("lock_owner"), + fuse_h.C_INT.withName("poll_events"), + fuse_h.C_INT.withName("backing_id"), + fuse_h.C_LONG_LONG.withName("compat_flags"), + MemoryLayout.sequenceLayout(2, fuse_h.C_LONG_LONG).withName("reserved") ).withName("fuse_file_info"); /** @@ -57,7 +66,7 @@ public static final GroupLayout layout() { /** * Layout for field: * {@snippet lang=c : - * int flags + * int32_t flags * } */ public static final OfInt flags$layout() { @@ -69,7 +78,7 @@ public static final GroupLayout layout() { /** * Offset for field: * {@snippet lang=c : - * int flags + * int32_t flags * } */ public static final long flags$offset() { @@ -79,7 +88,7 @@ public static final GroupLayout layout() { /** * Getter for field: * {@snippet lang=c : - * int flags + * int32_t flags * } */ public static int flags(MemorySegment struct) { @@ -89,187 +98,308 @@ public static int flags(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * int flags + * int32_t flags * } */ public static void flags(MemorySegment struct, int fieldValue) { struct.set(flags$LAYOUT, flags$OFFSET, fieldValue); } - private static final OfLong fh_old$LAYOUT = (OfLong)$LAYOUT.select(groupElement("fh_old")); + private static final OfLong fh$LAYOUT = (OfLong)$LAYOUT.select(groupElement("fh")); /** * Layout for field: * {@snippet lang=c : - * unsigned long fh_old + * uint64_t fh * } */ - public static final OfLong fh_old$layout() { - return fh_old$LAYOUT; + public static final OfLong fh$layout() { + return fh$LAYOUT; } - private static final long fh_old$OFFSET = 8; + private static final long fh$OFFSET = 16; /** * Offset for field: * {@snippet lang=c : - * unsigned long fh_old + * uint64_t fh * } */ - public static final long fh_old$offset() { - return fh_old$OFFSET; + public static final long fh$offset() { + return fh$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * unsigned long fh_old + * uint64_t fh * } */ - public static long fh_old(MemorySegment struct) { - return struct.get(fh_old$LAYOUT, fh_old$OFFSET); + public static long fh(MemorySegment struct) { + return struct.get(fh$LAYOUT, fh$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * unsigned long fh_old + * uint64_t fh * } */ - public static void fh_old(MemorySegment struct, long fieldValue) { - struct.set(fh_old$LAYOUT, fh_old$OFFSET, fieldValue); + public static void fh(MemorySegment struct, long fieldValue) { + struct.set(fh$LAYOUT, fh$OFFSET, fieldValue); } - private static final OfInt writepage$LAYOUT = (OfInt)$LAYOUT.select(groupElement("writepage")); + private static final OfLong lock_owner$LAYOUT = (OfLong)$LAYOUT.select(groupElement("lock_owner")); /** * Layout for field: * {@snippet lang=c : - * int writepage + * uint64_t lock_owner * } */ - public static final OfInt writepage$layout() { - return writepage$LAYOUT; + public static final OfLong lock_owner$layout() { + return lock_owner$LAYOUT; } - private static final long writepage$OFFSET = 16; + private static final long lock_owner$OFFSET = 24; /** * Offset for field: * {@snippet lang=c : - * int writepage + * uint64_t lock_owner * } */ - public static final long writepage$offset() { - return writepage$OFFSET; + public static final long lock_owner$offset() { + return lock_owner$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int writepage + * uint64_t lock_owner * } */ - public static int writepage(MemorySegment struct) { - return struct.get(writepage$LAYOUT, writepage$OFFSET); + public static long lock_owner(MemorySegment struct) { + return struct.get(lock_owner$LAYOUT, lock_owner$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int writepage + * uint64_t lock_owner * } */ - public static void writepage(MemorySegment struct, int fieldValue) { - struct.set(writepage$LAYOUT, writepage$OFFSET, fieldValue); + public static void lock_owner(MemorySegment struct, long fieldValue) { + struct.set(lock_owner$LAYOUT, lock_owner$OFFSET, fieldValue); } - private static final OfLong fh$LAYOUT = (OfLong)$LAYOUT.select(groupElement("fh")); + private static final OfInt poll_events$LAYOUT = (OfInt)$LAYOUT.select(groupElement("poll_events")); /** * Layout for field: * {@snippet lang=c : - * uint64_t fh + * uint32_t poll_events * } */ - public static final OfLong fh$layout() { - return fh$LAYOUT; + public static final OfInt poll_events$layout() { + return poll_events$LAYOUT; } - private static final long fh$OFFSET = 24; + private static final long poll_events$OFFSET = 32; /** * Offset for field: * {@snippet lang=c : - * uint64_t fh + * uint32_t poll_events * } */ - public static final long fh$offset() { - return fh$OFFSET; + public static final long poll_events$offset() { + return poll_events$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * uint64_t fh + * uint32_t poll_events * } */ - public static long fh(MemorySegment struct) { - return struct.get(fh$LAYOUT, fh$OFFSET); + public static int poll_events(MemorySegment struct) { + return struct.get(poll_events$LAYOUT, poll_events$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * uint64_t fh + * uint32_t poll_events * } */ - public static void fh(MemorySegment struct, long fieldValue) { - struct.set(fh$LAYOUT, fh$OFFSET, fieldValue); + public static void poll_events(MemorySegment struct, int fieldValue) { + struct.set(poll_events$LAYOUT, poll_events$OFFSET, fieldValue); } - private static final OfLong lock_owner$LAYOUT = (OfLong)$LAYOUT.select(groupElement("lock_owner")); + private static final OfInt backing_id$LAYOUT = (OfInt)$LAYOUT.select(groupElement("backing_id")); /** * Layout for field: * {@snippet lang=c : - * uint64_t lock_owner + * int32_t backing_id * } */ - public static final OfLong lock_owner$layout() { - return lock_owner$LAYOUT; + public static final OfInt backing_id$layout() { + return backing_id$LAYOUT; } - private static final long lock_owner$OFFSET = 32; + private static final long backing_id$OFFSET = 36; /** * Offset for field: * {@snippet lang=c : - * uint64_t lock_owner + * int32_t backing_id * } */ - public static final long lock_owner$offset() { - return lock_owner$OFFSET; + public static final long backing_id$offset() { + return backing_id$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * uint64_t lock_owner + * int32_t backing_id * } */ - public static long lock_owner(MemorySegment struct) { - return struct.get(lock_owner$LAYOUT, lock_owner$OFFSET); + public static int backing_id(MemorySegment struct) { + return struct.get(backing_id$LAYOUT, backing_id$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * uint64_t lock_owner + * int32_t backing_id * } */ - public static void lock_owner(MemorySegment struct, long fieldValue) { - struct.set(lock_owner$LAYOUT, lock_owner$OFFSET, fieldValue); + public static void backing_id(MemorySegment struct, int fieldValue) { + struct.set(backing_id$LAYOUT, backing_id$OFFSET, fieldValue); + } + + private static final OfLong compat_flags$LAYOUT = (OfLong)$LAYOUT.select(groupElement("compat_flags")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint64_t compat_flags + * } + */ + public static final OfLong compat_flags$layout() { + return compat_flags$LAYOUT; + } + + private static final long compat_flags$OFFSET = 40; + + /** + * Offset for field: + * {@snippet lang=c : + * uint64_t compat_flags + * } + */ + public static final long compat_flags$offset() { + return compat_flags$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint64_t compat_flags + * } + */ + public static long compat_flags(MemorySegment struct) { + return struct.get(compat_flags$LAYOUT, compat_flags$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint64_t compat_flags + * } + */ + public static void compat_flags(MemorySegment struct, long fieldValue) { + struct.set(compat_flags$LAYOUT, compat_flags$OFFSET, fieldValue); + } + + private static final SequenceLayout reserved$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("reserved")); + + /** + * Layout for field: + * {@snippet lang=c : + * uint64_t reserved[2] + * } + */ + public static final SequenceLayout reserved$layout() { + return reserved$LAYOUT; + } + + private static final long reserved$OFFSET = 48; + + /** + * Offset for field: + * {@snippet lang=c : + * uint64_t reserved[2] + * } + */ + public static final long reserved$offset() { + return reserved$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * uint64_t reserved[2] + * } + */ + public static MemorySegment reserved(MemorySegment struct) { + return struct.asSlice(reserved$OFFSET, reserved$LAYOUT.byteSize()); + } + + /** + * Setter for field: + * {@snippet lang=c : + * uint64_t reserved[2] + * } + */ + public static void reserved(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, reserved$OFFSET, reserved$LAYOUT.byteSize()); + } + + private static long[] reserved$DIMS = { 2 }; + + /** + * Dimensions for array field: + * {@snippet lang=c : + * uint64_t reserved[2] + * } + */ + public static long[] reserved$dimensions() { + return reserved$DIMS; + } + private static final VarHandle reserved$ELEM_HANDLE = reserved$LAYOUT.varHandle(sequenceElement()); + + /** + * Indexed getter for field: + * {@snippet lang=c : + * uint64_t reserved[2] + * } + */ + public static long reserved(MemorySegment struct, long index0) { + return (long)reserved$ELEM_HANDLE.get(struct, 0L, index0); + } + + /** + * Indexed setter for field: + * {@snippet lang=c : + * uint64_t reserved[2] + * } + */ + public static void reserved(MemorySegment struct, long index0, long fieldValue) { + reserved$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); } /** @@ -301,7 +431,7 @@ public static MemorySegment allocateArray(long elementCount, SegmentAllocator al } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { @@ -309,7 +439,7 @@ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consume } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code elementCount * layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_fill_dir_t.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_fill_dir_t.java similarity index 87% rename from jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_fill_dir_t.java rename to jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_fill_dir_t.java index c86e6ad3..4f6edb28 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_fill_dir_t.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_fill_dir_t.java @@ -1,6 +1,6 @@ // Generated by jextract -package org.cryptomator.jfuse.mac.extr.fuse; +package org.cryptomator.jfuse.mac.extr.fuse3; import java.lang.invoke.*; import java.lang.foreign.*; @@ -33,7 +33,10 @@ * __uint32_t st_gen; * __int32_t st_lspare; * __int64_t st_qspare[2]; - * } *, off_t) + * } *, off_t, enum fuse_fill_dir_flags { + * FUSE_FILL_DIR_DEFAULTS = 0, + * FUSE_FILL_DIR_PLUS = (1 << 1) + * }) * } */ public class fuse_fill_dir_t { @@ -46,7 +49,7 @@ public class fuse_fill_dir_t { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment buf, MemorySegment name, MemorySegment stbuf, long off); + int apply(MemorySegment buf, MemorySegment name, MemorySegment stbuf, long off, int flags); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( @@ -54,7 +57,8 @@ public interface Function { fuse_h.C_POINTER, fuse_h.C_POINTER, fuse_h.C_POINTER, - fuse_h.C_LONG_LONG + fuse_h.C_LONG_LONG, + fuse_h.C_INT ); /** @@ -79,9 +83,9 @@ public static MemorySegment allocate(fuse_fill_dir_t.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment buf, MemorySegment name, MemorySegment stbuf, long off) { + public static int invoke(MemorySegment funcPtr,MemorySegment buf, MemorySegment name, MemorySegment stbuf, long off, int flags) { try { - return (int) DOWN$MH.invokeExact(funcPtr, buf, name, stbuf, off); + return (int) DOWN$MH.invokeExact(funcPtr, buf, name, stbuf, off, flags); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_h.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_h.java new file mode 100644 index 00000000..23d706db --- /dev/null +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_h.java @@ -0,0 +1,819 @@ +// Generated by jextract + +package org.cryptomator.jfuse.mac.extr.fuse3; + +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + +public class fuse_h { + + fuse_h() { + // Should not be called directly + } + + static final Arena LIBRARY_ARENA = Arena.ofAuto(); + static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls"); + + static void traceDowncall(String name, Object... args) { + String traceArgs = Arrays.stream(args) + .map(Object::toString) + .collect(Collectors.joining(", ")); + System.out.printf("%s(%s)\n", name, traceArgs); + } + + static MemorySegment findOrThrow(String symbol) { + return SYMBOL_LOOKUP.find(symbol) + .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol)); + } + + static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { + try { + return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType()); + } catch (ReflectiveOperationException ex) { + throw new AssertionError(ex); + } + } + + static MemoryLayout align(MemoryLayout layout, long align) { + return switch (layout) { + case PaddingLayout p -> p; + case ValueLayout v -> v.withByteAlignment(align); + case GroupLayout g -> { + MemoryLayout[] alignedMembers = g.memberLayouts().stream() + .map(m -> align(m, align)).toArray(MemoryLayout[]::new); + yield g instanceof StructLayout ? + MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers); + } + case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align)); + }; + } + + static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup() + .or(Linker.nativeLinker().defaultLookup()); + + public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; + public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; + public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT; + public static final ValueLayout.OfInt C_INT = ValueLayout.JAVA_INT; + public static final ValueLayout.OfLong C_LONG_LONG = ValueLayout.JAVA_LONG; + public static final ValueLayout.OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT; + public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; + public static final AddressLayout C_POINTER = ValueLayout.ADDRESS + .withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, JAVA_BYTE)); + public static final ValueLayout.OfLong C_LONG = ValueLayout.JAVA_LONG; + + private static class fuse_version { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + fuse_h.C_INT ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_version"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int fuse_version() + * } + */ + public static FunctionDescriptor fuse_version$descriptor() { + return fuse_version.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * int fuse_version() + * } + */ + public static MethodHandle fuse_version$handle() { + return fuse_version.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int fuse_version() + * } + */ + public static MemorySegment fuse_version$address() { + return fuse_version.ADDR; + } + + /** + * {@snippet lang=c : + * int fuse_version() + * } + */ + public static int fuse_version() { + var mh$ = fuse_version.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_version"); + } + return (int)mh$.invokeExact(); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_loop_cfg_create { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + fuse_h.C_POINTER ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_loop_cfg_create"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * struct fuse_loop_config *fuse_loop_cfg_create() + * } + */ + public static FunctionDescriptor fuse_loop_cfg_create$descriptor() { + return fuse_loop_cfg_create.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * struct fuse_loop_config *fuse_loop_cfg_create() + * } + */ + public static MethodHandle fuse_loop_cfg_create$handle() { + return fuse_loop_cfg_create.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * struct fuse_loop_config *fuse_loop_cfg_create() + * } + */ + public static MemorySegment fuse_loop_cfg_create$address() { + return fuse_loop_cfg_create.ADDR; + } + + /** + * {@snippet lang=c : + * struct fuse_loop_config *fuse_loop_cfg_create() + * } + */ + public static MemorySegment fuse_loop_cfg_create() { + var mh$ = fuse_loop_cfg_create.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_loop_cfg_create"); + } + return (MemorySegment)mh$.invokeExact(); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_loop_cfg_destroy { + public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( + fuse_h.C_POINTER + ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_loop_cfg_destroy"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * void fuse_loop_cfg_destroy(struct fuse_loop_config *config) + * } + */ + public static FunctionDescriptor fuse_loop_cfg_destroy$descriptor() { + return fuse_loop_cfg_destroy.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * void fuse_loop_cfg_destroy(struct fuse_loop_config *config) + * } + */ + public static MethodHandle fuse_loop_cfg_destroy$handle() { + return fuse_loop_cfg_destroy.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * void fuse_loop_cfg_destroy(struct fuse_loop_config *config) + * } + */ + public static MemorySegment fuse_loop_cfg_destroy$address() { + return fuse_loop_cfg_destroy.ADDR; + } + + /** + * {@snippet lang=c : + * void fuse_loop_cfg_destroy(struct fuse_loop_config *config) + * } + */ + public static void fuse_loop_cfg_destroy(MemorySegment config) { + var mh$ = fuse_loop_cfg_destroy.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_loop_cfg_destroy", config); + } + mh$.invokeExact(config); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_loop_cfg_set_max_threads { + public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( + fuse_h.C_POINTER, + fuse_h.C_INT + ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_loop_cfg_set_max_threads"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * void fuse_loop_cfg_set_max_threads(struct fuse_loop_config *config, unsigned int value) + * } + */ + public static FunctionDescriptor fuse_loop_cfg_set_max_threads$descriptor() { + return fuse_loop_cfg_set_max_threads.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * void fuse_loop_cfg_set_max_threads(struct fuse_loop_config *config, unsigned int value) + * } + */ + public static MethodHandle fuse_loop_cfg_set_max_threads$handle() { + return fuse_loop_cfg_set_max_threads.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * void fuse_loop_cfg_set_max_threads(struct fuse_loop_config *config, unsigned int value) + * } + */ + public static MemorySegment fuse_loop_cfg_set_max_threads$address() { + return fuse_loop_cfg_set_max_threads.ADDR; + } + + /** + * {@snippet lang=c : + * void fuse_loop_cfg_set_max_threads(struct fuse_loop_config *config, unsigned int value) + * } + */ + public static void fuse_loop_cfg_set_max_threads(MemorySegment config, int value) { + var mh$ = fuse_loop_cfg_set_max_threads.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_loop_cfg_set_max_threads", config, value); + } + mh$.invokeExact(config, value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_loop_cfg_set_clone_fd { + public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( + fuse_h.C_POINTER, + fuse_h.C_INT + ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_loop_cfg_set_clone_fd"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * void fuse_loop_cfg_set_clone_fd(struct fuse_loop_config *config, unsigned int value) + * } + */ + public static FunctionDescriptor fuse_loop_cfg_set_clone_fd$descriptor() { + return fuse_loop_cfg_set_clone_fd.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * void fuse_loop_cfg_set_clone_fd(struct fuse_loop_config *config, unsigned int value) + * } + */ + public static MethodHandle fuse_loop_cfg_set_clone_fd$handle() { + return fuse_loop_cfg_set_clone_fd.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * void fuse_loop_cfg_set_clone_fd(struct fuse_loop_config *config, unsigned int value) + * } + */ + public static MemorySegment fuse_loop_cfg_set_clone_fd$address() { + return fuse_loop_cfg_set_clone_fd.ADDR; + } + + /** + * {@snippet lang=c : + * void fuse_loop_cfg_set_clone_fd(struct fuse_loop_config *config, unsigned int value) + * } + */ + public static void fuse_loop_cfg_set_clone_fd(MemorySegment config, int value) { + var mh$ = fuse_loop_cfg_set_clone_fd.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_loop_cfg_set_clone_fd", config, value); + } + mh$.invokeExact(config, value); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_lib_help { + public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( + fuse_h.C_POINTER + ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_lib_help"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * void fuse_lib_help(struct fuse_args *args) + * } + */ + public static FunctionDescriptor fuse_lib_help$descriptor() { + return fuse_lib_help.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * void fuse_lib_help(struct fuse_args *args) + * } + */ + public static MethodHandle fuse_lib_help$handle() { + return fuse_lib_help.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * void fuse_lib_help(struct fuse_args *args) + * } + */ + public static MemorySegment fuse_lib_help$address() { + return fuse_lib_help.ADDR; + } + + /** + * {@snippet lang=c : + * void fuse_lib_help(struct fuse_args *args) + * } + */ + public static void fuse_lib_help(MemorySegment args) { + var mh$ = fuse_lib_help.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_lib_help", args); + } + mh$.invokeExact(args); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_mount { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + fuse_h.C_INT, + fuse_h.C_POINTER, + fuse_h.C_POINTER + ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_mount"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int fuse_mount(struct fuse *f, const char *mountpoint) + * } + */ + public static FunctionDescriptor fuse_mount$descriptor() { + return fuse_mount.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * int fuse_mount(struct fuse *f, const char *mountpoint) + * } + */ + public static MethodHandle fuse_mount$handle() { + return fuse_mount.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int fuse_mount(struct fuse *f, const char *mountpoint) + * } + */ + public static MemorySegment fuse_mount$address() { + return fuse_mount.ADDR; + } + + /** + * {@snippet lang=c : + * int fuse_mount(struct fuse *f, const char *mountpoint) + * } + */ + public static int fuse_mount(MemorySegment f, MemorySegment mountpoint) { + var mh$ = fuse_mount.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_mount", f, mountpoint); + } + return (int)mh$.invokeExact(f, mountpoint); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_unmount { + public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( + fuse_h.C_POINTER + ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_unmount"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * void fuse_unmount(struct fuse *f) + * } + */ + public static FunctionDescriptor fuse_unmount$descriptor() { + return fuse_unmount.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * void fuse_unmount(struct fuse *f) + * } + */ + public static MethodHandle fuse_unmount$handle() { + return fuse_unmount.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * void fuse_unmount(struct fuse *f) + * } + */ + public static MemorySegment fuse_unmount$address() { + return fuse_unmount.ADDR; + } + + /** + * {@snippet lang=c : + * void fuse_unmount(struct fuse *f) + * } + */ + public static void fuse_unmount(MemorySegment f) { + var mh$ = fuse_unmount.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_unmount", f); + } + mh$.invokeExact(f); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_destroy { + public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( + fuse_h.C_POINTER + ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_destroy"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * void fuse_destroy(struct fuse *f) + * } + */ + public static FunctionDescriptor fuse_destroy$descriptor() { + return fuse_destroy.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * void fuse_destroy(struct fuse *f) + * } + */ + public static MethodHandle fuse_destroy$handle() { + return fuse_destroy.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * void fuse_destroy(struct fuse *f) + * } + */ + public static MemorySegment fuse_destroy$address() { + return fuse_destroy.ADDR; + } + + /** + * {@snippet lang=c : + * void fuse_destroy(struct fuse *f) + * } + */ + public static void fuse_destroy(MemorySegment f) { + var mh$ = fuse_destroy.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_destroy", f); + } + mh$.invokeExact(f); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_loop { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + fuse_h.C_INT, + fuse_h.C_POINTER + ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_loop"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int fuse_loop(struct fuse *f) + * } + */ + public static FunctionDescriptor fuse_loop$descriptor() { + return fuse_loop.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * int fuse_loop(struct fuse *f) + * } + */ + public static MethodHandle fuse_loop$handle() { + return fuse_loop.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int fuse_loop(struct fuse *f) + * } + */ + public static MemorySegment fuse_loop$address() { + return fuse_loop.ADDR; + } + + /** + * {@snippet lang=c : + * int fuse_loop(struct fuse *f) + * } + */ + public static int fuse_loop(MemorySegment f) { + var mh$ = fuse_loop.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_loop", f); + } + return (int)mh$.invokeExact(f); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_exit { + public static final FunctionDescriptor DESC = FunctionDescriptor.ofVoid( + fuse_h.C_POINTER + ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_exit"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * void fuse_exit(struct fuse *f) + * } + */ + public static FunctionDescriptor fuse_exit$descriptor() { + return fuse_exit.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * void fuse_exit(struct fuse *f) + * } + */ + public static MethodHandle fuse_exit$handle() { + return fuse_exit.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * void fuse_exit(struct fuse *f) + * } + */ + public static MemorySegment fuse_exit$address() { + return fuse_exit.ADDR; + } + + /** + * {@snippet lang=c : + * void fuse_exit(struct fuse *f) + * } + */ + public static void fuse_exit(MemorySegment f) { + var mh$ = fuse_exit.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_exit", f); + } + mh$.invokeExact(f); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_loop_mt { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + fuse_h.C_INT, + fuse_h.C_POINTER, + fuse_h.C_POINTER + ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_loop_mt"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * int fuse_loop_mt(struct fuse *f, struct fuse_loop_config *config) + * } + */ + public static FunctionDescriptor fuse_loop_mt$descriptor() { + return fuse_loop_mt.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * int fuse_loop_mt(struct fuse *f, struct fuse_loop_config *config) + * } + */ + public static MethodHandle fuse_loop_mt$handle() { + return fuse_loop_mt.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * int fuse_loop_mt(struct fuse *f, struct fuse_loop_config *config) + * } + */ + public static MemorySegment fuse_loop_mt$address() { + return fuse_loop_mt.ADDR; + } + + /** + * {@snippet lang=c : + * int fuse_loop_mt(struct fuse *f, struct fuse_loop_config *config) + * } + */ + public static int fuse_loop_mt(MemorySegment f, MemorySegment config) { + var mh$ = fuse_loop_mt.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_loop_mt", f, config); + } + return (int)mh$.invokeExact(f, config); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } + + private static class fuse_get_session { + public static final FunctionDescriptor DESC = FunctionDescriptor.of( + fuse_h.C_POINTER, + fuse_h.C_POINTER + ); + + public static final MemorySegment ADDR = fuse_h.findOrThrow("fuse_get_session"); + + public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); + } + + /** + * Function descriptor for: + * {@snippet lang=c : + * struct fuse_session *fuse_get_session(struct fuse *f) + * } + */ + public static FunctionDescriptor fuse_get_session$descriptor() { + return fuse_get_session.DESC; + } + + /** + * Downcall method handle for: + * {@snippet lang=c : + * struct fuse_session *fuse_get_session(struct fuse *f) + * } + */ + public static MethodHandle fuse_get_session$handle() { + return fuse_get_session.HANDLE; + } + + /** + * Address for: + * {@snippet lang=c : + * struct fuse_session *fuse_get_session(struct fuse *f) + * } + */ + public static MemorySegment fuse_get_session$address() { + return fuse_get_session.ADDR; + } + + /** + * {@snippet lang=c : + * struct fuse_session *fuse_get_session(struct fuse *f) + * } + */ + public static MemorySegment fuse_get_session(MemorySegment f) { + var mh$ = fuse_get_session.HANDLE; + try { + if (TRACE_DOWNCALLS) { + traceDowncall("fuse_get_session", f); + } + return (MemorySegment)mh$.invokeExact(f); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} + diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_loop_config_v1.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_loop_config_v1.java new file mode 100644 index 00000000..3d5760b9 --- /dev/null +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_loop_config_v1.java @@ -0,0 +1,173 @@ +// Generated by jextract + +package org.cryptomator.jfuse.mac.extr.fuse3; + +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + +/** + * {@snippet lang=c : + * struct fuse_loop_config_v1 { + * int clone_fd; + * unsigned int max_idle_threads; + * } + * } + */ +public class fuse_loop_config_v1 { + + fuse_loop_config_v1() { + // Should not be called directly + } + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + fuse_h.C_INT.withName("clone_fd"), + fuse_h.C_INT.withName("max_idle_threads") + ).withName("fuse_loop_config_v1"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfInt clone_fd$LAYOUT = (OfInt)$LAYOUT.select(groupElement("clone_fd")); + + /** + * Layout for field: + * {@snippet lang=c : + * int clone_fd + * } + */ + public static final OfInt clone_fd$layout() { + return clone_fd$LAYOUT; + } + + private static final long clone_fd$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * int clone_fd + * } + */ + public static final long clone_fd$offset() { + return clone_fd$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int clone_fd + * } + */ + public static int clone_fd(MemorySegment struct) { + return struct.get(clone_fd$LAYOUT, clone_fd$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int clone_fd + * } + */ + public static void clone_fd(MemorySegment struct, int fieldValue) { + struct.set(clone_fd$LAYOUT, clone_fd$OFFSET, fieldValue); + } + + private static final OfInt max_idle_threads$LAYOUT = (OfInt)$LAYOUT.select(groupElement("max_idle_threads")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned int max_idle_threads + * } + */ + public static final OfInt max_idle_threads$layout() { + return max_idle_threads$LAYOUT; + } + + private static final long max_idle_threads$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned int max_idle_threads + * } + */ + public static final long max_idle_threads$offset() { + return max_idle_threads$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * unsigned int max_idle_threads + * } + */ + public static int max_idle_threads(MemorySegment struct) { + return struct.get(max_idle_threads$LAYOUT, max_idle_threads$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * unsigned int max_idle_threads + * } + */ + public static void max_idle_threads(MemorySegment struct, int fieldValue) { + struct.set(max_idle_threads$LAYOUT, max_idle_threads$OFFSET, fieldValue); + } + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); + } + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { + return reinterpret(addr, 1, arena, cleanup); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); + } +} + diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_operations.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_operations.java similarity index 89% rename from jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_operations.java rename to jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_operations.java index a282e5ee..56fc46fe 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/fuse_operations.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/fuse_operations.java @@ -1,6 +1,6 @@ // Generated by jextract -package org.cryptomator.jfuse.mac.extr.fuse; +package org.cryptomator.jfuse.mac.extr.fuse3; import java.lang.invoke.*; import java.lang.foreign.*; @@ -15,20 +15,18 @@ /** * {@snippet lang=c : * struct fuse_operations { - * int (*getattr)(const char *, struct stat *); + * int (*getattr)(const char *, struct stat *, struct fuse_file_info *); * int (*readlink)(const char *, char *, size_t); - * int (*getdir)(const char *, fuse_dirh_t, fuse_dirfil_t); * int (*mknod)(const char *, mode_t, dev_t); * int (*mkdir)(const char *, mode_t); * int (*unlink)(const char *); * int (*rmdir)(const char *); * int (*symlink)(const char *, const char *); - * int (*rename)(const char *, const char *); + * int (*rename)(const char *, const char *, unsigned int); * int (*link)(const char *, const char *); - * int (*chmod)(const char *, mode_t); - * int (*chown)(const char *, uid_t, gid_t); - * int (*truncate)(const char *, off_t); - * int (*utime)(const char *, struct utimbuf *); + * int (*chmod)(const char *, mode_t, struct fuse_file_info *); + * int (*chown)(const char *, uid_t, gid_t, struct fuse_file_info *); + * int (*truncate)(const char *, off_t, struct fuse_file_info *); * int (*open)(const char *, struct fuse_file_info *); * int (*read)(const char *, char *, size_t, off_t, struct fuse_file_info *); * int (*write)(const char *, const char *, size_t, off_t, struct fuse_file_info *); @@ -41,28 +39,24 @@ * int (*listxattr)(const char *, char *, size_t); * int (*removexattr)(const char *, const char *); * int (*opendir)(const char *, struct fuse_file_info *); - * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *); + * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *, enum fuse_readdir_flags); * int (*releasedir)(const char *, struct fuse_file_info *); * int (*fsyncdir)(const char *, int, struct fuse_file_info *); - * void *(*init)(struct fuse_conn_info *); + * void *(*init)(struct fuse_conn_info *, struct fuse_config *); * void (*destroy)(void *); * int (*access)(const char *, int); * int (*create)(const char *, mode_t, struct fuse_file_info *); - * int (*ftruncate)(const char *, off_t, struct fuse_file_info *); - * int (*fgetattr)(const char *, struct stat *, struct fuse_file_info *); * int (*lock)(const char *, struct fuse_file_info *, int, struct flock *); - * int (*utimens)(const char *, const struct timespec *); + * int (*utimens)(const char *, const struct timespec *, struct fuse_file_info *); * int (*bmap)(const char *, size_t, uint64_t *); - * unsigned int flag_nullpath_ok : 1; - * unsigned int flag_nopath : 1; - * unsigned int flag_utime_omit_ok : 1; - * unsigned int flag_reserved : 29; - * int (*ioctl)(const char *, int, void *, struct fuse_file_info *, unsigned int, void *); + * int (*ioctl)(const char *, unsigned int, void *, struct fuse_file_info *, unsigned int, void *); * int (*poll)(const char *, struct fuse_file_info *, struct fuse_pollhandle *, unsigned int *); * int (*write_buf)(const char *, struct fuse_bufvec *, off_t, struct fuse_file_info *); * int (*read_buf)(const char *, struct fuse_bufvec **, size_t, off_t, struct fuse_file_info *); * int (*flock)(const char *, struct fuse_file_info *, int); * int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *); + * ssize_t (*copy_file_range)(const char *, struct fuse_file_info *, off_t, const char *, struct fuse_file_info *, off_t, size_t, int); + * off_t (*lseek)(const char *, off_t, int, struct fuse_file_info *); * } * } */ @@ -75,7 +69,6 @@ public class fuse_operations { private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( fuse_h.C_POINTER.withName("getattr"), fuse_h.C_POINTER.withName("readlink"), - fuse_h.C_POINTER.withName("getdir"), fuse_h.C_POINTER.withName("mknod"), fuse_h.C_POINTER.withName("mkdir"), fuse_h.C_POINTER.withName("unlink"), @@ -86,7 +79,6 @@ public class fuse_operations { fuse_h.C_POINTER.withName("chmod"), fuse_h.C_POINTER.withName("chown"), fuse_h.C_POINTER.withName("truncate"), - fuse_h.C_POINTER.withName("utime"), fuse_h.C_POINTER.withName("open"), fuse_h.C_POINTER.withName("read"), fuse_h.C_POINTER.withName("write"), @@ -106,18 +98,17 @@ public class fuse_operations { fuse_h.C_POINTER.withName("destroy"), fuse_h.C_POINTER.withName("access"), fuse_h.C_POINTER.withName("create"), - fuse_h.C_POINTER.withName("ftruncate"), - fuse_h.C_POINTER.withName("fgetattr"), fuse_h.C_POINTER.withName("lock"), fuse_h.C_POINTER.withName("utimens"), fuse_h.C_POINTER.withName("bmap"), - MemoryLayout.paddingLayout(8), fuse_h.C_POINTER.withName("ioctl"), fuse_h.C_POINTER.withName("poll"), fuse_h.C_POINTER.withName("write_buf"), fuse_h.C_POINTER.withName("read_buf"), fuse_h.C_POINTER.withName("flock"), - fuse_h.C_POINTER.withName("fallocate") + fuse_h.C_POINTER.withName("fallocate"), + fuse_h.C_POINTER.withName("copy_file_range"), + fuse_h.C_POINTER.withName("lseek") ).withName("fuse_operations"); /** @@ -129,7 +120,7 @@ public static final GroupLayout layout() { /** * {@snippet lang=c : - * int (*getattr)(const char *, struct stat *) + * int (*getattr)(const char *, struct stat *, struct fuse_file_info *) * } */ public static class getattr { @@ -142,12 +133,13 @@ public static class getattr { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1); + int apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, + fuse_h.C_POINTER, fuse_h.C_POINTER ); @@ -173,9 +165,9 @@ public static MemorySegment allocate(getattr.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } @@ -187,7 +179,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment /** * Layout for field: * {@snippet lang=c : - * int (*getattr)(const char *, struct stat *) + * int (*getattr)(const char *, struct stat *, struct fuse_file_info *) * } */ public static final AddressLayout getattr$layout() { @@ -199,7 +191,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment /** * Offset for field: * {@snippet lang=c : - * int (*getattr)(const char *, struct stat *) + * int (*getattr)(const char *, struct stat *, struct fuse_file_info *) * } */ public static final long getattr$offset() { @@ -209,7 +201,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment /** * Getter for field: * {@snippet lang=c : - * int (*getattr)(const char *, struct stat *) + * int (*getattr)(const char *, struct stat *, struct fuse_file_info *) * } */ public static MemorySegment getattr(MemorySegment struct) { @@ -219,7 +211,7 @@ public static MemorySegment getattr(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * int (*getattr)(const char *, struct stat *) + * int (*getattr)(const char *, struct stat *, struct fuse_file_info *) * } */ public static void getattr(MemorySegment struct, MemorySegment fieldValue) { @@ -326,106 +318,6 @@ public static void readlink(MemorySegment struct, MemorySegment fieldValue) { struct.set(readlink$LAYOUT, readlink$OFFSET, fieldValue); } - /** - * {@snippet lang=c : - * int (*getdir)(const char *, fuse_dirh_t, fuse_dirfil_t) - * } - */ - public static class getdir { - - getdir() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - fuse_h.C_INT, - fuse_h.C_POINTER, - fuse_h.C_POINTER, - fuse_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = fuse_h.upcallHandle(getdir.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(getdir.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static final AddressLayout getdir$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("getdir")); - - /** - * Layout for field: - * {@snippet lang=c : - * int (*getdir)(const char *, fuse_dirh_t, fuse_dirfil_t) - * } - */ - public static final AddressLayout getdir$layout() { - return getdir$LAYOUT; - } - - private static final long getdir$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * int (*getdir)(const char *, fuse_dirh_t, fuse_dirfil_t) - * } - */ - public static final long getdir$offset() { - return getdir$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int (*getdir)(const char *, fuse_dirh_t, fuse_dirfil_t) - * } - */ - public static MemorySegment getdir(MemorySegment struct) { - return struct.get(getdir$LAYOUT, getdir$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int (*getdir)(const char *, fuse_dirh_t, fuse_dirfil_t) - * } - */ - public static void getdir(MemorySegment struct, MemorySegment fieldValue) { - struct.set(getdir$LAYOUT, getdir$OFFSET, fieldValue); - } - /** * {@snippet lang=c : * int (*mknod)(const char *, mode_t, dev_t) @@ -494,7 +386,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, short _x1, int return mknod$LAYOUT; } - private static final long mknod$OFFSET = 24; + private static final long mknod$OFFSET = 16; /** * Offset for field: @@ -593,7 +485,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, short _x1) { return mkdir$LAYOUT; } - private static final long mkdir$OFFSET = 32; + private static final long mkdir$OFFSET = 24; /** * Offset for field: @@ -691,7 +583,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0) { return unlink$LAYOUT; } - private static final long unlink$OFFSET = 40; + private static final long unlink$OFFSET = 32; /** * Offset for field: @@ -789,7 +681,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0) { return rmdir$LAYOUT; } - private static final long rmdir$OFFSET = 48; + private static final long rmdir$OFFSET = 40; /** * Offset for field: @@ -888,7 +780,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return symlink$LAYOUT; } - private static final long symlink$OFFSET = 56; + private static final long symlink$OFFSET = 48; /** * Offset for field: @@ -922,7 +814,7 @@ public static void symlink(MemorySegment struct, MemorySegment fieldValue) { /** * {@snippet lang=c : - * int (*rename)(const char *, const char *) + * int (*rename)(const char *, const char *, unsigned int) * } */ public static class rename { @@ -935,13 +827,14 @@ public static class rename { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1); + int apply(MemorySegment _x0, MemorySegment _x1, int _x2); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, - fuse_h.C_POINTER + fuse_h.C_POINTER, + fuse_h.C_INT ); /** @@ -966,9 +859,9 @@ public static MemorySegment allocate(rename.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } @@ -980,19 +873,19 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment /** * Layout for field: * {@snippet lang=c : - * int (*rename)(const char *, const char *) + * int (*rename)(const char *, const char *, unsigned int) * } */ public static final AddressLayout rename$layout() { return rename$LAYOUT; } - private static final long rename$OFFSET = 64; + private static final long rename$OFFSET = 56; /** * Offset for field: * {@snippet lang=c : - * int (*rename)(const char *, const char *) + * int (*rename)(const char *, const char *, unsigned int) * } */ public static final long rename$offset() { @@ -1002,7 +895,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment /** * Getter for field: * {@snippet lang=c : - * int (*rename)(const char *, const char *) + * int (*rename)(const char *, const char *, unsigned int) * } */ public static MemorySegment rename(MemorySegment struct) { @@ -1012,7 +905,7 @@ public static MemorySegment rename(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * int (*rename)(const char *, const char *) + * int (*rename)(const char *, const char *, unsigned int) * } */ public static void rename(MemorySegment struct, MemorySegment fieldValue) { @@ -1086,7 +979,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return link$LAYOUT; } - private static final long link$OFFSET = 72; + private static final long link$OFFSET = 64; /** * Offset for field: @@ -1120,7 +1013,7 @@ public static void link(MemorySegment struct, MemorySegment fieldValue) { /** * {@snippet lang=c : - * int (*chmod)(const char *, mode_t) + * int (*chmod)(const char *, mode_t, struct fuse_file_info *) * } */ public static class chmod { @@ -1133,13 +1026,14 @@ public static class chmod { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, short _x1); + int apply(MemorySegment _x0, short _x1, MemorySegment _x2); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, - fuse_h.C_SHORT + fuse_h.C_SHORT, + fuse_h.C_POINTER ); /** @@ -1164,9 +1058,9 @@ public static MemorySegment allocate(chmod.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, short _x1) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, short _x1, MemorySegment _x2) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } @@ -1178,19 +1072,19 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, short _x1) { /** * Layout for field: * {@snippet lang=c : - * int (*chmod)(const char *, mode_t) + * int (*chmod)(const char *, mode_t, struct fuse_file_info *) * } */ public static final AddressLayout chmod$layout() { return chmod$LAYOUT; } - private static final long chmod$OFFSET = 80; + private static final long chmod$OFFSET = 72; /** * Offset for field: * {@snippet lang=c : - * int (*chmod)(const char *, mode_t) + * int (*chmod)(const char *, mode_t, struct fuse_file_info *) * } */ public static final long chmod$offset() { @@ -1200,7 +1094,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, short _x1) { /** * Getter for field: * {@snippet lang=c : - * int (*chmod)(const char *, mode_t) + * int (*chmod)(const char *, mode_t, struct fuse_file_info *) * } */ public static MemorySegment chmod(MemorySegment struct) { @@ -1210,7 +1104,7 @@ public static MemorySegment chmod(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * int (*chmod)(const char *, mode_t) + * int (*chmod)(const char *, mode_t, struct fuse_file_info *) * } */ public static void chmod(MemorySegment struct, MemorySegment fieldValue) { @@ -1219,7 +1113,7 @@ public static void chmod(MemorySegment struct, MemorySegment fieldValue) { /** * {@snippet lang=c : - * int (*chown)(const char *, uid_t, gid_t) + * int (*chown)(const char *, uid_t, gid_t, struct fuse_file_info *) * } */ public static class chown { @@ -1232,14 +1126,15 @@ public static class chown { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, int _x1, int _x2); + int apply(MemorySegment _x0, int _x1, int _x2, MemorySegment _x3); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, fuse_h.C_INT, - fuse_h.C_INT + fuse_h.C_INT, + fuse_h.C_POINTER ); /** @@ -1264,9 +1159,9 @@ public static MemorySegment allocate(chown.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, int _x2) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, int _x2, MemorySegment _x3) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } @@ -1278,19 +1173,19 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, int _ /** * Layout for field: * {@snippet lang=c : - * int (*chown)(const char *, uid_t, gid_t) + * int (*chown)(const char *, uid_t, gid_t, struct fuse_file_info *) * } */ public static final AddressLayout chown$layout() { return chown$LAYOUT; } - private static final long chown$OFFSET = 88; + private static final long chown$OFFSET = 80; /** * Offset for field: * {@snippet lang=c : - * int (*chown)(const char *, uid_t, gid_t) + * int (*chown)(const char *, uid_t, gid_t, struct fuse_file_info *) * } */ public static final long chown$offset() { @@ -1300,7 +1195,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, int _ /** * Getter for field: * {@snippet lang=c : - * int (*chown)(const char *, uid_t, gid_t) + * int (*chown)(const char *, uid_t, gid_t, struct fuse_file_info *) * } */ public static MemorySegment chown(MemorySegment struct) { @@ -1310,7 +1205,7 @@ public static MemorySegment chown(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * int (*chown)(const char *, uid_t, gid_t) + * int (*chown)(const char *, uid_t, gid_t, struct fuse_file_info *) * } */ public static void chown(MemorySegment struct, MemorySegment fieldValue) { @@ -1319,7 +1214,7 @@ public static void chown(MemorySegment struct, MemorySegment fieldValue) { /** * {@snippet lang=c : - * int (*truncate)(const char *, off_t) + * int (*truncate)(const char *, off_t, struct fuse_file_info *) * } */ public static class truncate { @@ -1332,13 +1227,14 @@ public static class truncate { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, long _x1); + int apply(MemorySegment _x0, long _x1, MemorySegment _x2); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, - fuse_h.C_LONG_LONG + fuse_h.C_LONG_LONG, + fuse_h.C_POINTER ); /** @@ -1363,9 +1259,9 @@ public static MemorySegment allocate(truncate.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1, MemorySegment _x2) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } @@ -1377,19 +1273,19 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1) { /** * Layout for field: * {@snippet lang=c : - * int (*truncate)(const char *, off_t) + * int (*truncate)(const char *, off_t, struct fuse_file_info *) * } */ public static final AddressLayout truncate$layout() { return truncate$LAYOUT; } - private static final long truncate$OFFSET = 96; + private static final long truncate$OFFSET = 88; /** * Offset for field: * {@snippet lang=c : - * int (*truncate)(const char *, off_t) + * int (*truncate)(const char *, off_t, struct fuse_file_info *) * } */ public static final long truncate$offset() { @@ -1399,7 +1295,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1) { /** * Getter for field: * {@snippet lang=c : - * int (*truncate)(const char *, off_t) + * int (*truncate)(const char *, off_t, struct fuse_file_info *) * } */ public static MemorySegment truncate(MemorySegment struct) { @@ -1409,112 +1305,13 @@ public static MemorySegment truncate(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * int (*truncate)(const char *, off_t) + * int (*truncate)(const char *, off_t, struct fuse_file_info *) * } */ public static void truncate(MemorySegment struct, MemorySegment fieldValue) { struct.set(truncate$LAYOUT, truncate$OFFSET, fieldValue); } - /** - * {@snippet lang=c : - * int (*utime)(const char *, struct utimbuf *) - * } - */ - public static class utime { - - utime() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - fuse_h.C_INT, - fuse_h.C_POINTER, - fuse_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = fuse_h.upcallHandle(utime.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(utime.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - } - - private static final AddressLayout utime$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("utime")); - - /** - * Layout for field: - * {@snippet lang=c : - * int (*utime)(const char *, struct utimbuf *) - * } - */ - public static final AddressLayout utime$layout() { - return utime$LAYOUT; - } - - private static final long utime$OFFSET = 104; - - /** - * Offset for field: - * {@snippet lang=c : - * int (*utime)(const char *, struct utimbuf *) - * } - */ - public static final long utime$offset() { - return utime$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int (*utime)(const char *, struct utimbuf *) - * } - */ - public static MemorySegment utime(MemorySegment struct) { - return struct.get(utime$LAYOUT, utime$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int (*utime)(const char *, struct utimbuf *) - * } - */ - public static void utime(MemorySegment struct, MemorySegment fieldValue) { - struct.set(utime$LAYOUT, utime$OFFSET, fieldValue); - } - /** * {@snippet lang=c : * int (*open)(const char *, struct fuse_file_info *) @@ -1582,7 +1379,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return open$LAYOUT; } - private static final long open$OFFSET = 112; + private static final long open$OFFSET = 96; /** * Offset for field: @@ -1684,7 +1481,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return read$LAYOUT; } - private static final long read$OFFSET = 120; + private static final long read$OFFSET = 104; /** * Offset for field: @@ -1786,7 +1583,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return write$LAYOUT; } - private static final long write$OFFSET = 128; + private static final long write$OFFSET = 112; /** * Offset for field: @@ -1885,7 +1682,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return statfs$LAYOUT; } - private static final long statfs$OFFSET = 136; + private static final long statfs$OFFSET = 120; /** * Offset for field: @@ -1984,7 +1781,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return flush$LAYOUT; } - private static final long flush$OFFSET = 144; + private static final long flush$OFFSET = 128; /** * Offset for field: @@ -2083,7 +1880,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return release$LAYOUT; } - private static final long release$OFFSET = 152; + private static final long release$OFFSET = 136; /** * Offset for field: @@ -2183,7 +1980,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, Memor return fsync$LAYOUT; } - private static final long fsync$OFFSET = 160; + private static final long fsync$OFFSET = 144; /** * Offset for field: @@ -2285,7 +2082,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return setxattr$LAYOUT; } - private static final long setxattr$OFFSET = 168; + private static final long setxattr$OFFSET = 152; /** * Offset for field: @@ -2386,7 +2183,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return getxattr$LAYOUT; } - private static final long getxattr$OFFSET = 176; + private static final long getxattr$OFFSET = 160; /** * Offset for field: @@ -2486,7 +2283,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return listxattr$LAYOUT; } - private static final long listxattr$OFFSET = 184; + private static final long listxattr$OFFSET = 168; /** * Offset for field: @@ -2585,7 +2382,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return removexattr$LAYOUT; } - private static final long removexattr$OFFSET = 192; + private static final long removexattr$OFFSET = 176; /** * Offset for field: @@ -2684,7 +2481,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return opendir$LAYOUT; } - private static final long opendir$OFFSET = 200; + private static final long opendir$OFFSET = 184; /** * Offset for field: @@ -2718,7 +2515,7 @@ public static void opendir(MemorySegment struct, MemorySegment fieldValue) { /** * {@snippet lang=c : - * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *) + * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *, enum fuse_readdir_flags) * } */ public static class readdir { @@ -2731,7 +2528,7 @@ public static class readdir { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, long _x3, MemorySegment _x4); + int apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, long _x3, MemorySegment _x4, int _x5); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( @@ -2740,7 +2537,8 @@ public interface Function { fuse_h.C_POINTER, fuse_h.C_POINTER, fuse_h.C_LONG_LONG, - fuse_h.C_POINTER + fuse_h.C_POINTER, + fuse_h.C_INT ); /** @@ -2765,9 +2563,9 @@ public static MemorySegment allocate(readdir.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, long _x3, MemorySegment _x4) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, long _x3, MemorySegment _x4, int _x5) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4, _x5); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } @@ -2779,19 +2577,19 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment /** * Layout for field: * {@snippet lang=c : - * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *) + * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *, enum fuse_readdir_flags) * } */ public static final AddressLayout readdir$layout() { return readdir$LAYOUT; } - private static final long readdir$OFFSET = 208; + private static final long readdir$OFFSET = 192; /** * Offset for field: * {@snippet lang=c : - * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *) + * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *, enum fuse_readdir_flags) * } */ public static final long readdir$offset() { @@ -2801,7 +2599,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment /** * Getter for field: * {@snippet lang=c : - * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *) + * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *, enum fuse_readdir_flags) * } */ public static MemorySegment readdir(MemorySegment struct) { @@ -2811,7 +2609,7 @@ public static MemorySegment readdir(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *) + * int (*readdir)(const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *, enum fuse_readdir_flags) * } */ public static void readdir(MemorySegment struct, MemorySegment fieldValue) { @@ -2885,7 +2683,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment return releasedir$LAYOUT; } - private static final long releasedir$OFFSET = 216; + private static final long releasedir$OFFSET = 200; /** * Offset for field: @@ -2985,7 +2783,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, Memor return fsyncdir$LAYOUT; } - private static final long fsyncdir$OFFSET = 224; + private static final long fsyncdir$OFFSET = 208; /** * Offset for field: @@ -3019,7 +2817,7 @@ public static void fsyncdir(MemorySegment struct, MemorySegment fieldValue) { /** * {@snippet lang=c : - * void *(*init)(struct fuse_conn_info *) + * void *(*init)(struct fuse_conn_info *, struct fuse_config *) * } */ public static class init { @@ -3032,10 +2830,11 @@ public static class init { * The function pointer signature, expressed as a functional interface */ public interface Function { - MemorySegment apply(MemorySegment _x0); + MemorySegment apply(MemorySegment _x0, MemorySegment _x1); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + fuse_h.C_POINTER, fuse_h.C_POINTER, fuse_h.C_POINTER ); @@ -3062,9 +2861,9 @@ public static MemorySegment allocate(init.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0) { + public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) { try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0); + return (MemorySegment) DOWN$MH.invokeExact(funcPtr, _x0, _x1); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } @@ -3076,19 +2875,19 @@ public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0) { /** * Layout for field: * {@snippet lang=c : - * void *(*init)(struct fuse_conn_info *) + * void *(*init)(struct fuse_conn_info *, struct fuse_config *) * } */ public static final AddressLayout init$layout() { return init$LAYOUT; } - private static final long init$OFFSET = 232; + private static final long init$OFFSET = 216; /** * Offset for field: * {@snippet lang=c : - * void *(*init)(struct fuse_conn_info *) + * void *(*init)(struct fuse_conn_info *, struct fuse_config *) * } */ public static final long init$offset() { @@ -3098,7 +2897,7 @@ public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment _x0) { /** * Getter for field: * {@snippet lang=c : - * void *(*init)(struct fuse_conn_info *) + * void *(*init)(struct fuse_conn_info *, struct fuse_config *) * } */ public static MemorySegment init(MemorySegment struct) { @@ -3108,7 +2907,7 @@ public static MemorySegment init(MemorySegment struct) { /** * Setter for field: * {@snippet lang=c : - * void *(*init)(struct fuse_conn_info *) + * void *(*init)(struct fuse_conn_info *, struct fuse_config *) * } */ public static void init(MemorySegment struct, MemorySegment fieldValue) { @@ -3180,7 +2979,7 @@ public static void invoke(MemorySegment funcPtr,MemorySegment _x0) { return destroy$LAYOUT; } - private static final long destroy$OFFSET = 240; + private static final long destroy$OFFSET = 224; /** * Offset for field: @@ -3279,7 +3078,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1) { return access$LAYOUT; } - private static final long access$OFFSET = 248; + private static final long access$OFFSET = 232; /** * Offset for field: @@ -3379,7 +3178,7 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, short _x1, Mem return create$LAYOUT; } - private static final long create$OFFSET = 256; + private static final long create$OFFSET = 240; /** * Offset for field: @@ -3413,12 +3212,12 @@ public static void create(MemorySegment struct, MemorySegment fieldValue) { /** * {@snippet lang=c : - * int (*ftruncate)(const char *, off_t, struct fuse_file_info *) + * int (*lock)(const char *, struct fuse_file_info *, int, struct flock *) * } */ - public static class ftruncate { + public static class lock { - ftruncate() { + lock() { // Should not be called directly } @@ -3426,13 +3225,14 @@ public static class ftruncate { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, long _x1, MemorySegment _x2); + int apply(MemorySegment _x0, MemorySegment _x1, int _x2, MemorySegment _x3); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, - fuse_h.C_LONG_LONG, + fuse_h.C_POINTER, + fuse_h.C_INT, fuse_h.C_POINTER ); @@ -3443,13 +3243,13 @@ public static FunctionDescriptor descriptor() { return $DESC; } - private static final MethodHandle UP$MH = fuse_h.upcallHandle(ftruncate.Function.class, "apply", $DESC); + private static final MethodHandle UP$MH = fuse_h.upcallHandle(lock.Function.class, "apply", $DESC); /** * Allocates a new upcall stub, whose implementation is defined by {@code fi}. * The lifetime of the returned segment is managed by {@code arena} */ - public static MemorySegment allocate(ftruncate.Function fi, Arena arena) { + public static MemorySegment allocate(lock.Function fi, Arena arena) { return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } @@ -3458,67 +3258,67 @@ public static MemorySegment allocate(ftruncate.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1, MemorySegment _x2) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2, MemorySegment _x3) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } } } - private static final AddressLayout ftruncate$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("ftruncate")); + private static final AddressLayout lock$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("lock")); /** * Layout for field: * {@snippet lang=c : - * int (*ftruncate)(const char *, off_t, struct fuse_file_info *) + * int (*lock)(const char *, struct fuse_file_info *, int, struct flock *) * } */ - public static final AddressLayout ftruncate$layout() { - return ftruncate$LAYOUT; + public static final AddressLayout lock$layout() { + return lock$LAYOUT; } - private static final long ftruncate$OFFSET = 264; + private static final long lock$OFFSET = 248; /** * Offset for field: * {@snippet lang=c : - * int (*ftruncate)(const char *, off_t, struct fuse_file_info *) + * int (*lock)(const char *, struct fuse_file_info *, int, struct flock *) * } */ - public static final long ftruncate$offset() { - return ftruncate$OFFSET; + public static final long lock$offset() { + return lock$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int (*ftruncate)(const char *, off_t, struct fuse_file_info *) + * int (*lock)(const char *, struct fuse_file_info *, int, struct flock *) * } */ - public static MemorySegment ftruncate(MemorySegment struct) { - return struct.get(ftruncate$LAYOUT, ftruncate$OFFSET); + public static MemorySegment lock(MemorySegment struct) { + return struct.get(lock$LAYOUT, lock$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int (*ftruncate)(const char *, off_t, struct fuse_file_info *) + * int (*lock)(const char *, struct fuse_file_info *, int, struct flock *) * } */ - public static void ftruncate(MemorySegment struct, MemorySegment fieldValue) { - struct.set(ftruncate$LAYOUT, ftruncate$OFFSET, fieldValue); + public static void lock(MemorySegment struct, MemorySegment fieldValue) { + struct.set(lock$LAYOUT, lock$OFFSET, fieldValue); } /** * {@snippet lang=c : - * int (*fgetattr)(const char *, struct stat *, struct fuse_file_info *) + * int (*utimens)(const char *, const struct timespec *, struct fuse_file_info *) * } */ - public static class fgetattr { + public static class utimens { - fgetattr() { + utimens() { // Should not be called directly } @@ -3543,13 +3343,13 @@ public static FunctionDescriptor descriptor() { return $DESC; } - private static final MethodHandle UP$MH = fuse_h.upcallHandle(fgetattr.Function.class, "apply", $DESC); + private static final MethodHandle UP$MH = fuse_h.upcallHandle(utimens.Function.class, "apply", $DESC); /** * Allocates a new upcall stub, whose implementation is defined by {@code fi}. * The lifetime of the returned segment is managed by {@code arena} */ - public static MemorySegment allocate(fgetattr.Function fi, Arena arena) { + public static MemorySegment allocate(utimens.Function fi, Arena arena) { return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } @@ -3567,58 +3367,58 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment } } - private static final AddressLayout fgetattr$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("fgetattr")); + private static final AddressLayout utimens$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("utimens")); /** * Layout for field: * {@snippet lang=c : - * int (*fgetattr)(const char *, struct stat *, struct fuse_file_info *) + * int (*utimens)(const char *, const struct timespec *, struct fuse_file_info *) * } */ - public static final AddressLayout fgetattr$layout() { - return fgetattr$LAYOUT; + public static final AddressLayout utimens$layout() { + return utimens$LAYOUT; } - private static final long fgetattr$OFFSET = 272; + private static final long utimens$OFFSET = 256; /** * Offset for field: * {@snippet lang=c : - * int (*fgetattr)(const char *, struct stat *, struct fuse_file_info *) + * int (*utimens)(const char *, const struct timespec *, struct fuse_file_info *) * } */ - public static final long fgetattr$offset() { - return fgetattr$OFFSET; + public static final long utimens$offset() { + return utimens$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int (*fgetattr)(const char *, struct stat *, struct fuse_file_info *) + * int (*utimens)(const char *, const struct timespec *, struct fuse_file_info *) * } */ - public static MemorySegment fgetattr(MemorySegment struct) { - return struct.get(fgetattr$LAYOUT, fgetattr$OFFSET); + public static MemorySegment utimens(MemorySegment struct) { + return struct.get(utimens$LAYOUT, utimens$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int (*fgetattr)(const char *, struct stat *, struct fuse_file_info *) + * int (*utimens)(const char *, const struct timespec *, struct fuse_file_info *) * } */ - public static void fgetattr(MemorySegment struct, MemorySegment fieldValue) { - struct.set(fgetattr$LAYOUT, fgetattr$OFFSET, fieldValue); + public static void utimens(MemorySegment struct, MemorySegment fieldValue) { + struct.set(utimens$LAYOUT, utimens$OFFSET, fieldValue); } /** * {@snippet lang=c : - * int (*lock)(const char *, struct fuse_file_info *, int, struct flock *) + * int (*bmap)(const char *, size_t, uint64_t *) * } */ - public static class lock { + public static class bmap { - lock() { + bmap() { // Should not be called directly } @@ -3626,14 +3426,13 @@ public static class lock { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1, int _x2, MemorySegment _x3); + int apply(MemorySegment _x0, long _x1, MemorySegment _x2); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, - fuse_h.C_POINTER, - fuse_h.C_INT, + fuse_h.C_LONG, fuse_h.C_POINTER ); @@ -3644,13 +3443,13 @@ public static FunctionDescriptor descriptor() { return $DESC; } - private static final MethodHandle UP$MH = fuse_h.upcallHandle(lock.Function.class, "apply", $DESC); + private static final MethodHandle UP$MH = fuse_h.upcallHandle(bmap.Function.class, "apply", $DESC); /** * Allocates a new upcall stub, whose implementation is defined by {@code fi}. * The lifetime of the returned segment is managed by {@code arena} */ - public static MemorySegment allocate(lock.Function fi, Arena arena) { + public static MemorySegment allocate(bmap.Function fi, Arena arena) { return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } @@ -3659,67 +3458,67 @@ public static MemorySegment allocate(lock.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2, MemorySegment _x3) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1, MemorySegment _x2) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } } } - private static final AddressLayout lock$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("lock")); + private static final AddressLayout bmap$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("bmap")); /** * Layout for field: * {@snippet lang=c : - * int (*lock)(const char *, struct fuse_file_info *, int, struct flock *) + * int (*bmap)(const char *, size_t, uint64_t *) * } */ - public static final AddressLayout lock$layout() { - return lock$LAYOUT; + public static final AddressLayout bmap$layout() { + return bmap$LAYOUT; } - private static final long lock$OFFSET = 280; + private static final long bmap$OFFSET = 264; /** * Offset for field: * {@snippet lang=c : - * int (*lock)(const char *, struct fuse_file_info *, int, struct flock *) + * int (*bmap)(const char *, size_t, uint64_t *) * } */ - public static final long lock$offset() { - return lock$OFFSET; + public static final long bmap$offset() { + return bmap$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int (*lock)(const char *, struct fuse_file_info *, int, struct flock *) + * int (*bmap)(const char *, size_t, uint64_t *) * } */ - public static MemorySegment lock(MemorySegment struct) { - return struct.get(lock$LAYOUT, lock$OFFSET); + public static MemorySegment bmap(MemorySegment struct) { + return struct.get(bmap$LAYOUT, bmap$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int (*lock)(const char *, struct fuse_file_info *, int, struct flock *) + * int (*bmap)(const char *, size_t, uint64_t *) * } */ - public static void lock(MemorySegment struct, MemorySegment fieldValue) { - struct.set(lock$LAYOUT, lock$OFFSET, fieldValue); + public static void bmap(MemorySegment struct, MemorySegment fieldValue) { + struct.set(bmap$LAYOUT, bmap$OFFSET, fieldValue); } /** * {@snippet lang=c : - * int (*utimens)(const char *, const struct timespec *) + * int (*ioctl)(const char *, unsigned int, void *, struct fuse_file_info *, unsigned int, void *) * } */ - public static class utimens { + public static class ioctl { - utimens() { + ioctl() { // Should not be called directly } @@ -3727,12 +3526,16 @@ public static class utimens { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1); + int apply(MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3, int _x4, MemorySegment _x5); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, + fuse_h.C_INT, + fuse_h.C_POINTER, + fuse_h.C_POINTER, + fuse_h.C_INT, fuse_h.C_POINTER ); @@ -3743,13 +3546,13 @@ public static FunctionDescriptor descriptor() { return $DESC; } - private static final MethodHandle UP$MH = fuse_h.upcallHandle(utimens.Function.class, "apply", $DESC); + private static final MethodHandle UP$MH = fuse_h.upcallHandle(ioctl.Function.class, "apply", $DESC); /** * Allocates a new upcall stub, whose implementation is defined by {@code fi}. * The lifetime of the returned segment is managed by {@code arena} */ - public static MemorySegment allocate(utimens.Function fi, Arena arena) { + public static MemorySegment allocate(ioctl.Function fi, Arena arena) { return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } @@ -3758,67 +3561,67 @@ public static MemorySegment allocate(utimens.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3, int _x4, MemorySegment _x5) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4, _x5); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } } } - private static final AddressLayout utimens$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("utimens")); + private static final AddressLayout ioctl$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("ioctl")); /** * Layout for field: * {@snippet lang=c : - * int (*utimens)(const char *, const struct timespec *) + * int (*ioctl)(const char *, unsigned int, void *, struct fuse_file_info *, unsigned int, void *) * } */ - public static final AddressLayout utimens$layout() { - return utimens$LAYOUT; + public static final AddressLayout ioctl$layout() { + return ioctl$LAYOUT; } - private static final long utimens$OFFSET = 288; + private static final long ioctl$OFFSET = 272; /** * Offset for field: * {@snippet lang=c : - * int (*utimens)(const char *, const struct timespec *) + * int (*ioctl)(const char *, unsigned int, void *, struct fuse_file_info *, unsigned int, void *) * } */ - public static final long utimens$offset() { - return utimens$OFFSET; + public static final long ioctl$offset() { + return ioctl$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int (*utimens)(const char *, const struct timespec *) + * int (*ioctl)(const char *, unsigned int, void *, struct fuse_file_info *, unsigned int, void *) * } */ - public static MemorySegment utimens(MemorySegment struct) { - return struct.get(utimens$LAYOUT, utimens$OFFSET); + public static MemorySegment ioctl(MemorySegment struct) { + return struct.get(ioctl$LAYOUT, ioctl$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int (*utimens)(const char *, const struct timespec *) + * int (*ioctl)(const char *, unsigned int, void *, struct fuse_file_info *, unsigned int, void *) * } */ - public static void utimens(MemorySegment struct, MemorySegment fieldValue) { - struct.set(utimens$LAYOUT, utimens$OFFSET, fieldValue); + public static void ioctl(MemorySegment struct, MemorySegment fieldValue) { + struct.set(ioctl$LAYOUT, ioctl$OFFSET, fieldValue); } /** * {@snippet lang=c : - * int (*bmap)(const char *, size_t, uint64_t *) + * int (*poll)(const char *, struct fuse_file_info *, struct fuse_pollhandle *, unsigned int *) * } */ - public static class bmap { + public static class poll { - bmap() { + poll() { // Should not be called directly } @@ -3826,13 +3629,14 @@ public static class bmap { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, long _x1, MemorySegment _x2); + int apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, MemorySegment _x3); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, - fuse_h.C_LONG, + fuse_h.C_POINTER, + fuse_h.C_POINTER, fuse_h.C_POINTER ); @@ -3843,13 +3647,13 @@ public static FunctionDescriptor descriptor() { return $DESC; } - private static final MethodHandle UP$MH = fuse_h.upcallHandle(bmap.Function.class, "apply", $DESC); + private static final MethodHandle UP$MH = fuse_h.upcallHandle(poll.Function.class, "apply", $DESC); /** * Allocates a new upcall stub, whose implementation is defined by {@code fi}. * The lifetime of the returned segment is managed by {@code arena} */ - public static MemorySegment allocate(bmap.Function fi, Arena arena) { + public static MemorySegment allocate(poll.Function fi, Arena arena) { return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } @@ -3858,67 +3662,67 @@ public static MemorySegment allocate(bmap.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1, MemorySegment _x2) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, MemorySegment _x3) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } } } - private static final AddressLayout bmap$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("bmap")); + private static final AddressLayout poll$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("poll")); /** * Layout for field: * {@snippet lang=c : - * int (*bmap)(const char *, size_t, uint64_t *) + * int (*poll)(const char *, struct fuse_file_info *, struct fuse_pollhandle *, unsigned int *) * } */ - public static final AddressLayout bmap$layout() { - return bmap$LAYOUT; + public static final AddressLayout poll$layout() { + return poll$LAYOUT; } - private static final long bmap$OFFSET = 296; + private static final long poll$OFFSET = 280; /** * Offset for field: * {@snippet lang=c : - * int (*bmap)(const char *, size_t, uint64_t *) + * int (*poll)(const char *, struct fuse_file_info *, struct fuse_pollhandle *, unsigned int *) * } */ - public static final long bmap$offset() { - return bmap$OFFSET; + public static final long poll$offset() { + return poll$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int (*bmap)(const char *, size_t, uint64_t *) + * int (*poll)(const char *, struct fuse_file_info *, struct fuse_pollhandle *, unsigned int *) * } */ - public static MemorySegment bmap(MemorySegment struct) { - return struct.get(bmap$LAYOUT, bmap$OFFSET); + public static MemorySegment poll(MemorySegment struct) { + return struct.get(poll$LAYOUT, poll$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int (*bmap)(const char *, size_t, uint64_t *) + * int (*poll)(const char *, struct fuse_file_info *, struct fuse_pollhandle *, unsigned int *) * } */ - public static void bmap(MemorySegment struct, MemorySegment fieldValue) { - struct.set(bmap$LAYOUT, bmap$OFFSET, fieldValue); + public static void poll(MemorySegment struct, MemorySegment fieldValue) { + struct.set(poll$LAYOUT, poll$OFFSET, fieldValue); } /** * {@snippet lang=c : - * int (*ioctl)(const char *, int, void *, struct fuse_file_info *, unsigned int, void *) + * int (*write_buf)(const char *, struct fuse_bufvec *, off_t, struct fuse_file_info *) * } */ - public static class ioctl { + public static class write_buf { - ioctl() { + write_buf() { // Should not be called directly } @@ -3926,16 +3730,14 @@ public static class ioctl { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3, int _x4, MemorySegment _x5); + int apply(MemorySegment _x0, MemorySegment _x1, long _x2, MemorySegment _x3); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - fuse_h.C_INT, - fuse_h.C_POINTER, fuse_h.C_INT, fuse_h.C_POINTER, fuse_h.C_POINTER, - fuse_h.C_INT, + fuse_h.C_LONG_LONG, fuse_h.C_POINTER ); @@ -3946,13 +3748,13 @@ public static FunctionDescriptor descriptor() { return $DESC; } - private static final MethodHandle UP$MH = fuse_h.upcallHandle(ioctl.Function.class, "apply", $DESC); + private static final MethodHandle UP$MH = fuse_h.upcallHandle(write_buf.Function.class, "apply", $DESC); /** * Allocates a new upcall stub, whose implementation is defined by {@code fi}. * The lifetime of the returned segment is managed by {@code arena} */ - public static MemorySegment allocate(ioctl.Function fi, Arena arena) { + public static MemorySegment allocate(write_buf.Function fi, Arena arena) { return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } @@ -3961,67 +3763,67 @@ public static MemorySegment allocate(ioctl.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, MemorySegment _x2, MemorySegment _x3, int _x4, MemorySegment _x5) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, long _x2, MemorySegment _x3) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4, _x5); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } } } - private static final AddressLayout ioctl$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("ioctl")); + private static final AddressLayout write_buf$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("write_buf")); /** * Layout for field: * {@snippet lang=c : - * int (*ioctl)(const char *, int, void *, struct fuse_file_info *, unsigned int, void *) + * int (*write_buf)(const char *, struct fuse_bufvec *, off_t, struct fuse_file_info *) * } */ - public static final AddressLayout ioctl$layout() { - return ioctl$LAYOUT; + public static final AddressLayout write_buf$layout() { + return write_buf$LAYOUT; } - private static final long ioctl$OFFSET = 312; + private static final long write_buf$OFFSET = 288; /** * Offset for field: * {@snippet lang=c : - * int (*ioctl)(const char *, int, void *, struct fuse_file_info *, unsigned int, void *) + * int (*write_buf)(const char *, struct fuse_bufvec *, off_t, struct fuse_file_info *) * } */ - public static final long ioctl$offset() { - return ioctl$OFFSET; + public static final long write_buf$offset() { + return write_buf$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int (*ioctl)(const char *, int, void *, struct fuse_file_info *, unsigned int, void *) + * int (*write_buf)(const char *, struct fuse_bufvec *, off_t, struct fuse_file_info *) * } */ - public static MemorySegment ioctl(MemorySegment struct) { - return struct.get(ioctl$LAYOUT, ioctl$OFFSET); + public static MemorySegment write_buf(MemorySegment struct) { + return struct.get(write_buf$LAYOUT, write_buf$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int (*ioctl)(const char *, int, void *, struct fuse_file_info *, unsigned int, void *) + * int (*write_buf)(const char *, struct fuse_bufvec *, off_t, struct fuse_file_info *) * } */ - public static void ioctl(MemorySegment struct, MemorySegment fieldValue) { - struct.set(ioctl$LAYOUT, ioctl$OFFSET, fieldValue); + public static void write_buf(MemorySegment struct, MemorySegment fieldValue) { + struct.set(write_buf$LAYOUT, write_buf$OFFSET, fieldValue); } /** * {@snippet lang=c : - * int (*poll)(const char *, struct fuse_file_info *, struct fuse_pollhandle *, unsigned int *) + * int (*read_buf)(const char *, struct fuse_bufvec **, size_t, off_t, struct fuse_file_info *) * } */ - public static class poll { + public static class read_buf { - poll() { + read_buf() { // Should not be called directly } @@ -4029,14 +3831,15 @@ public static class poll { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, MemorySegment _x3); + int apply(MemorySegment _x0, MemorySegment _x1, long _x2, long _x3, MemorySegment _x4); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, fuse_h.C_POINTER, - fuse_h.C_POINTER, + fuse_h.C_LONG, + fuse_h.C_LONG_LONG, fuse_h.C_POINTER ); @@ -4047,13 +3850,13 @@ public static FunctionDescriptor descriptor() { return $DESC; } - private static final MethodHandle UP$MH = fuse_h.upcallHandle(poll.Function.class, "apply", $DESC); + private static final MethodHandle UP$MH = fuse_h.upcallHandle(read_buf.Function.class, "apply", $DESC); /** * Allocates a new upcall stub, whose implementation is defined by {@code fi}. * The lifetime of the returned segment is managed by {@code arena} */ - public static MemorySegment allocate(poll.Function fi, Arena arena) { + public static MemorySegment allocate(read_buf.Function fi, Arena arena) { return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } @@ -4062,67 +3865,67 @@ public static MemorySegment allocate(poll.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, MemorySegment _x2, MemorySegment _x3) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, long _x2, long _x3, MemorySegment _x4) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } } } - private static final AddressLayout poll$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("poll")); + private static final AddressLayout read_buf$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("read_buf")); /** * Layout for field: * {@snippet lang=c : - * int (*poll)(const char *, struct fuse_file_info *, struct fuse_pollhandle *, unsigned int *) + * int (*read_buf)(const char *, struct fuse_bufvec **, size_t, off_t, struct fuse_file_info *) * } */ - public static final AddressLayout poll$layout() { - return poll$LAYOUT; + public static final AddressLayout read_buf$layout() { + return read_buf$LAYOUT; } - private static final long poll$OFFSET = 320; + private static final long read_buf$OFFSET = 296; /** * Offset for field: * {@snippet lang=c : - * int (*poll)(const char *, struct fuse_file_info *, struct fuse_pollhandle *, unsigned int *) + * int (*read_buf)(const char *, struct fuse_bufvec **, size_t, off_t, struct fuse_file_info *) * } */ - public static final long poll$offset() { - return poll$OFFSET; + public static final long read_buf$offset() { + return read_buf$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int (*poll)(const char *, struct fuse_file_info *, struct fuse_pollhandle *, unsigned int *) + * int (*read_buf)(const char *, struct fuse_bufvec **, size_t, off_t, struct fuse_file_info *) * } */ - public static MemorySegment poll(MemorySegment struct) { - return struct.get(poll$LAYOUT, poll$OFFSET); + public static MemorySegment read_buf(MemorySegment struct) { + return struct.get(read_buf$LAYOUT, read_buf$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int (*poll)(const char *, struct fuse_file_info *, struct fuse_pollhandle *, unsigned int *) + * int (*read_buf)(const char *, struct fuse_bufvec **, size_t, off_t, struct fuse_file_info *) * } */ - public static void poll(MemorySegment struct, MemorySegment fieldValue) { - struct.set(poll$LAYOUT, poll$OFFSET, fieldValue); + public static void read_buf(MemorySegment struct, MemorySegment fieldValue) { + struct.set(read_buf$LAYOUT, read_buf$OFFSET, fieldValue); } /** * {@snippet lang=c : - * int (*write_buf)(const char *, struct fuse_bufvec *, off_t, struct fuse_file_info *) + * int (*flock)(const char *, struct fuse_file_info *, int) * } */ - public static class write_buf { + public static class flock { - write_buf() { + flock() { // Should not be called directly } @@ -4130,15 +3933,14 @@ public static class write_buf { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1, long _x2, MemorySegment _x3); + int apply(MemorySegment _x0, MemorySegment _x1, int _x2); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, fuse_h.C_POINTER, - fuse_h.C_LONG_LONG, - fuse_h.C_POINTER + fuse_h.C_INT ); /** @@ -4148,13 +3950,13 @@ public static FunctionDescriptor descriptor() { return $DESC; } - private static final MethodHandle UP$MH = fuse_h.upcallHandle(write_buf.Function.class, "apply", $DESC); + private static final MethodHandle UP$MH = fuse_h.upcallHandle(flock.Function.class, "apply", $DESC); /** * Allocates a new upcall stub, whose implementation is defined by {@code fi}. * The lifetime of the returned segment is managed by {@code arena} */ - public static MemorySegment allocate(write_buf.Function fi, Arena arena) { + public static MemorySegment allocate(flock.Function fi, Arena arena) { return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } @@ -4163,67 +3965,67 @@ public static MemorySegment allocate(write_buf.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, long _x2, MemorySegment _x3) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); + return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } } } - private static final AddressLayout write_buf$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("write_buf")); + private static final AddressLayout flock$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("flock")); /** * Layout for field: * {@snippet lang=c : - * int (*write_buf)(const char *, struct fuse_bufvec *, off_t, struct fuse_file_info *) + * int (*flock)(const char *, struct fuse_file_info *, int) * } */ - public static final AddressLayout write_buf$layout() { - return write_buf$LAYOUT; + public static final AddressLayout flock$layout() { + return flock$LAYOUT; } - private static final long write_buf$OFFSET = 328; + private static final long flock$OFFSET = 304; /** * Offset for field: * {@snippet lang=c : - * int (*write_buf)(const char *, struct fuse_bufvec *, off_t, struct fuse_file_info *) + * int (*flock)(const char *, struct fuse_file_info *, int) * } */ - public static final long write_buf$offset() { - return write_buf$OFFSET; + public static final long flock$offset() { + return flock$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int (*write_buf)(const char *, struct fuse_bufvec *, off_t, struct fuse_file_info *) + * int (*flock)(const char *, struct fuse_file_info *, int) * } */ - public static MemorySegment write_buf(MemorySegment struct) { - return struct.get(write_buf$LAYOUT, write_buf$OFFSET); + public static MemorySegment flock(MemorySegment struct) { + return struct.get(flock$LAYOUT, flock$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int (*write_buf)(const char *, struct fuse_bufvec *, off_t, struct fuse_file_info *) + * int (*flock)(const char *, struct fuse_file_info *, int) * } */ - public static void write_buf(MemorySegment struct, MemorySegment fieldValue) { - struct.set(write_buf$LAYOUT, write_buf$OFFSET, fieldValue); + public static void flock(MemorySegment struct, MemorySegment fieldValue) { + struct.set(flock$LAYOUT, flock$OFFSET, fieldValue); } /** * {@snippet lang=c : - * int (*read_buf)(const char *, struct fuse_bufvec **, size_t, off_t, struct fuse_file_info *) + * int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *) * } */ - public static class read_buf { + public static class fallocate { - read_buf() { + fallocate() { // Should not be called directly } @@ -4231,14 +4033,14 @@ public static class read_buf { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1, long _x2, long _x3, MemorySegment _x4); + int apply(MemorySegment _x0, int _x1, long _x2, long _x3, MemorySegment _x4); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( fuse_h.C_INT, fuse_h.C_POINTER, - fuse_h.C_POINTER, - fuse_h.C_LONG, + fuse_h.C_INT, + fuse_h.C_LONG_LONG, fuse_h.C_LONG_LONG, fuse_h.C_POINTER ); @@ -4250,13 +4052,13 @@ public static FunctionDescriptor descriptor() { return $DESC; } - private static final MethodHandle UP$MH = fuse_h.upcallHandle(read_buf.Function.class, "apply", $DESC); + private static final MethodHandle UP$MH = fuse_h.upcallHandle(fallocate.Function.class, "apply", $DESC); /** * Allocates a new upcall stub, whose implementation is defined by {@code fi}. * The lifetime of the returned segment is managed by {@code arena} */ - public static MemorySegment allocate(read_buf.Function fi, Arena arena) { + public static MemorySegment allocate(fallocate.Function fi, Arena arena) { return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } @@ -4265,7 +4067,7 @@ public static MemorySegment allocate(read_buf.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, long _x2, long _x3, MemorySegment _x4) { + public static int invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, long _x2, long _x3, MemorySegment _x4) { try { return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4); } catch (Throwable ex$) { @@ -4274,58 +4076,58 @@ public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment } } - private static final AddressLayout read_buf$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("read_buf")); + private static final AddressLayout fallocate$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("fallocate")); /** * Layout for field: * {@snippet lang=c : - * int (*read_buf)(const char *, struct fuse_bufvec **, size_t, off_t, struct fuse_file_info *) + * int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *) * } */ - public static final AddressLayout read_buf$layout() { - return read_buf$LAYOUT; + public static final AddressLayout fallocate$layout() { + return fallocate$LAYOUT; } - private static final long read_buf$OFFSET = 336; + private static final long fallocate$OFFSET = 312; /** * Offset for field: * {@snippet lang=c : - * int (*read_buf)(const char *, struct fuse_bufvec **, size_t, off_t, struct fuse_file_info *) + * int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *) * } */ - public static final long read_buf$offset() { - return read_buf$OFFSET; + public static final long fallocate$offset() { + return fallocate$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int (*read_buf)(const char *, struct fuse_bufvec **, size_t, off_t, struct fuse_file_info *) + * int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *) * } */ - public static MemorySegment read_buf(MemorySegment struct) { - return struct.get(read_buf$LAYOUT, read_buf$OFFSET); + public static MemorySegment fallocate(MemorySegment struct) { + return struct.get(fallocate$LAYOUT, fallocate$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int (*read_buf)(const char *, struct fuse_bufvec **, size_t, off_t, struct fuse_file_info *) + * int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *) * } */ - public static void read_buf(MemorySegment struct, MemorySegment fieldValue) { - struct.set(read_buf$LAYOUT, read_buf$OFFSET, fieldValue); + public static void fallocate(MemorySegment struct, MemorySegment fieldValue) { + struct.set(fallocate$LAYOUT, fallocate$OFFSET, fieldValue); } /** * {@snippet lang=c : - * int (*flock)(const char *, struct fuse_file_info *, int) + * ssize_t (*copy_file_range)(const char *, struct fuse_file_info *, off_t, const char *, struct fuse_file_info *, off_t, size_t, int) * } */ - public static class flock { + public static class copy_file_range { - flock() { + copy_file_range() { // Should not be called directly } @@ -4333,13 +4135,18 @@ public static class flock { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, MemorySegment _x1, int _x2); + long apply(MemorySegment _x0, MemorySegment _x1, long _x2, MemorySegment _x3, MemorySegment _x4, long _x5, long _x6, int _x7); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - fuse_h.C_INT, + fuse_h.C_LONG, + fuse_h.C_POINTER, + fuse_h.C_POINTER, + fuse_h.C_LONG_LONG, fuse_h.C_POINTER, fuse_h.C_POINTER, + fuse_h.C_LONG_LONG, + fuse_h.C_LONG, fuse_h.C_INT ); @@ -4350,13 +4157,13 @@ public static FunctionDescriptor descriptor() { return $DESC; } - private static final MethodHandle UP$MH = fuse_h.upcallHandle(flock.Function.class, "apply", $DESC); + private static final MethodHandle UP$MH = fuse_h.upcallHandle(copy_file_range.Function.class, "apply", $DESC); /** * Allocates a new upcall stub, whose implementation is defined by {@code fi}. * The lifetime of the returned segment is managed by {@code arena} */ - public static MemorySegment allocate(flock.Function fi, Arena arena) { + public static MemorySegment allocate(copy_file_range.Function fi, Arena arena) { return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } @@ -4365,67 +4172,67 @@ public static MemorySegment allocate(flock.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, int _x2) { + public static long invoke(MemorySegment funcPtr,MemorySegment _x0, MemorySegment _x1, long _x2, MemorySegment _x3, MemorySegment _x4, long _x5, long _x6, int _x7) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2); + return (long) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4, _x5, _x6, _x7); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } } } - private static final AddressLayout flock$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("flock")); + private static final AddressLayout copy_file_range$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("copy_file_range")); /** * Layout for field: * {@snippet lang=c : - * int (*flock)(const char *, struct fuse_file_info *, int) + * ssize_t (*copy_file_range)(const char *, struct fuse_file_info *, off_t, const char *, struct fuse_file_info *, off_t, size_t, int) * } */ - public static final AddressLayout flock$layout() { - return flock$LAYOUT; + public static final AddressLayout copy_file_range$layout() { + return copy_file_range$LAYOUT; } - private static final long flock$OFFSET = 344; + private static final long copy_file_range$OFFSET = 320; /** * Offset for field: * {@snippet lang=c : - * int (*flock)(const char *, struct fuse_file_info *, int) + * ssize_t (*copy_file_range)(const char *, struct fuse_file_info *, off_t, const char *, struct fuse_file_info *, off_t, size_t, int) * } */ - public static final long flock$offset() { - return flock$OFFSET; + public static final long copy_file_range$offset() { + return copy_file_range$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int (*flock)(const char *, struct fuse_file_info *, int) + * ssize_t (*copy_file_range)(const char *, struct fuse_file_info *, off_t, const char *, struct fuse_file_info *, off_t, size_t, int) * } */ - public static MemorySegment flock(MemorySegment struct) { - return struct.get(flock$LAYOUT, flock$OFFSET); + public static MemorySegment copy_file_range(MemorySegment struct) { + return struct.get(copy_file_range$LAYOUT, copy_file_range$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int (*flock)(const char *, struct fuse_file_info *, int) + * ssize_t (*copy_file_range)(const char *, struct fuse_file_info *, off_t, const char *, struct fuse_file_info *, off_t, size_t, int) * } */ - public static void flock(MemorySegment struct, MemorySegment fieldValue) { - struct.set(flock$LAYOUT, flock$OFFSET, fieldValue); + public static void copy_file_range(MemorySegment struct, MemorySegment fieldValue) { + struct.set(copy_file_range$LAYOUT, copy_file_range$OFFSET, fieldValue); } /** * {@snippet lang=c : - * int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *) + * off_t (*lseek)(const char *, off_t, int, struct fuse_file_info *) * } */ - public static class fallocate { + public static class lseek { - fallocate() { + lseek() { // Should not be called directly } @@ -4433,15 +4240,14 @@ public static class fallocate { * The function pointer signature, expressed as a functional interface */ public interface Function { - int apply(MemorySegment _x0, int _x1, long _x2, long _x3, MemorySegment _x4); + long apply(MemorySegment _x0, long _x1, int _x2, MemorySegment _x3); } private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - fuse_h.C_INT, - fuse_h.C_POINTER, - fuse_h.C_INT, fuse_h.C_LONG_LONG, + fuse_h.C_POINTER, fuse_h.C_LONG_LONG, + fuse_h.C_INT, fuse_h.C_POINTER ); @@ -4452,13 +4258,13 @@ public static FunctionDescriptor descriptor() { return $DESC; } - private static final MethodHandle UP$MH = fuse_h.upcallHandle(fallocate.Function.class, "apply", $DESC); + private static final MethodHandle UP$MH = fuse_h.upcallHandle(lseek.Function.class, "apply", $DESC); /** * Allocates a new upcall stub, whose implementation is defined by {@code fi}. * The lifetime of the returned segment is managed by {@code arena} */ - public static MemorySegment allocate(fallocate.Function fi, Arena arena) { + public static MemorySegment allocate(lseek.Function fi, Arena arena) { return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); } @@ -4467,57 +4273,57 @@ public static MemorySegment allocate(fallocate.Function fi, Arena arena) { /** * Invoke the upcall stub {@code funcPtr}, with given parameters */ - public static int invoke(MemorySegment funcPtr,MemorySegment _x0, int _x1, long _x2, long _x3, MemorySegment _x4) { + public static long invoke(MemorySegment funcPtr,MemorySegment _x0, long _x1, int _x2, MemorySegment _x3) { try { - return (int) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3, _x4); + return (long) DOWN$MH.invokeExact(funcPtr, _x0, _x1, _x2, _x3); } catch (Throwable ex$) { throw new AssertionError("should not reach here", ex$); } } } - private static final AddressLayout fallocate$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("fallocate")); + private static final AddressLayout lseek$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("lseek")); /** * Layout for field: * {@snippet lang=c : - * int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *) + * off_t (*lseek)(const char *, off_t, int, struct fuse_file_info *) * } */ - public static final AddressLayout fallocate$layout() { - return fallocate$LAYOUT; + public static final AddressLayout lseek$layout() { + return lseek$LAYOUT; } - private static final long fallocate$OFFSET = 352; + private static final long lseek$OFFSET = 328; /** * Offset for field: * {@snippet lang=c : - * int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *) + * off_t (*lseek)(const char *, off_t, int, struct fuse_file_info *) * } */ - public static final long fallocate$offset() { - return fallocate$OFFSET; + public static final long lseek$offset() { + return lseek$OFFSET; } /** * Getter for field: * {@snippet lang=c : - * int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *) + * off_t (*lseek)(const char *, off_t, int, struct fuse_file_info *) * } */ - public static MemorySegment fallocate(MemorySegment struct) { - return struct.get(fallocate$LAYOUT, fallocate$OFFSET); + public static MemorySegment lseek(MemorySegment struct) { + return struct.get(lseek$LAYOUT, lseek$OFFSET); } /** * Setter for field: * {@snippet lang=c : - * int (*fallocate)(const char *, int, off_t, off_t, struct fuse_file_info *) + * off_t (*lseek)(const char *, off_t, int, struct fuse_file_info *) * } */ - public static void fallocate(MemorySegment struct, MemorySegment fieldValue) { - struct.set(fallocate$LAYOUT, fallocate$OFFSET, fieldValue); + public static void lseek(MemorySegment struct, MemorySegment fieldValue) { + struct.set(lseek$LAYOUT, lseek$OFFSET, fieldValue); } /** @@ -4549,7 +4355,7 @@ public static MemorySegment allocateArray(long elementCount, SegmentAllocator al } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { @@ -4557,7 +4363,7 @@ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consume } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code elementCount * layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/stat.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/stat.java similarity index 99% rename from jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/stat.java rename to jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/stat.java index b5b8fbdf..9123f9e3 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/stat.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/stat.java @@ -1,6 +1,6 @@ // Generated by jextract -package org.cryptomator.jfuse.mac.extr.fuse; +package org.cryptomator.jfuse.mac.extr.fuse3; import java.lang.invoke.*; import java.lang.foreign.*; @@ -925,7 +925,7 @@ public static MemorySegment allocateArray(long elementCount, SegmentAllocator al } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { @@ -933,7 +933,7 @@ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consume } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code elementCount * layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/statvfs.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/statvfs.java similarity index 99% rename from jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/statvfs.java rename to jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/statvfs.java index 17efeb85..b63c355f 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/statvfs.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/statvfs.java @@ -1,6 +1,6 @@ // Generated by jextract -package org.cryptomator.jfuse.mac.extr.fuse; +package org.cryptomator.jfuse.mac.extr.fuse3; import java.lang.invoke.*; import java.lang.foreign.*; @@ -569,7 +569,7 @@ public static MemorySegment allocateArray(long elementCount, SegmentAllocator al } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { @@ -577,7 +577,7 @@ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consume } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code elementCount * layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/timespec.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/timespec.java similarity index 97% rename from jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/timespec.java rename to jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/timespec.java index bebe9dda..8b52fe5b 100644 --- a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse/timespec.java +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3/timespec.java @@ -1,6 +1,6 @@ // Generated by jextract -package org.cryptomator.jfuse.mac.extr.fuse; +package org.cryptomator.jfuse.mac.extr.fuse3; import java.lang.invoke.*; import java.lang.foreign.*; @@ -155,7 +155,7 @@ public static MemorySegment allocateArray(long elementCount, SegmentAllocator al } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { @@ -163,7 +163,7 @@ public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consume } /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any). + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). * The returned segment has size {@code elementCount * layout().byteSize()} */ public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3_lowlevel/fuse_cmdline_opts.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3_lowlevel/fuse_cmdline_opts.java new file mode 100644 index 00000000..6d24d403 --- /dev/null +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3_lowlevel/fuse_cmdline_opts.java @@ -0,0 +1,542 @@ +// Generated by jextract + +package org.cryptomator.jfuse.mac.extr.fuse3_lowlevel; + +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + +/** + * {@snippet lang=c : + * struct fuse_cmdline_opts { + * int singlethread; + * int foreground; + * int debug; + * int nodefault_subtype; + * char *mountpoint; + * int show_version; + * int show_help; + * int clone_fd; + * unsigned int max_idle_threads; + * unsigned int max_threads; + * } + * } + */ +public class fuse_cmdline_opts { + + fuse_cmdline_opts() { + // Should not be called directly + } + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + fuse_lowlevel_h.C_INT.withName("singlethread"), + fuse_lowlevel_h.C_INT.withName("foreground"), + fuse_lowlevel_h.C_INT.withName("debug"), + fuse_lowlevel_h.C_INT.withName("nodefault_subtype"), + fuse_lowlevel_h.C_POINTER.withName("mountpoint"), + fuse_lowlevel_h.C_INT.withName("show_version"), + fuse_lowlevel_h.C_INT.withName("show_help"), + fuse_lowlevel_h.C_INT.withName("clone_fd"), + fuse_lowlevel_h.C_INT.withName("max_idle_threads"), + fuse_lowlevel_h.C_INT.withName("max_threads"), + MemoryLayout.paddingLayout(4) + ).withName("fuse_cmdline_opts"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfInt singlethread$LAYOUT = (OfInt)$LAYOUT.select(groupElement("singlethread")); + + /** + * Layout for field: + * {@snippet lang=c : + * int singlethread + * } + */ + public static final OfInt singlethread$layout() { + return singlethread$LAYOUT; + } + + private static final long singlethread$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * int singlethread + * } + */ + public static final long singlethread$offset() { + return singlethread$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int singlethread + * } + */ + public static int singlethread(MemorySegment struct) { + return struct.get(singlethread$LAYOUT, singlethread$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int singlethread + * } + */ + public static void singlethread(MemorySegment struct, int fieldValue) { + struct.set(singlethread$LAYOUT, singlethread$OFFSET, fieldValue); + } + + private static final OfInt foreground$LAYOUT = (OfInt)$LAYOUT.select(groupElement("foreground")); + + /** + * Layout for field: + * {@snippet lang=c : + * int foreground + * } + */ + public static final OfInt foreground$layout() { + return foreground$LAYOUT; + } + + private static final long foreground$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * int foreground + * } + */ + public static final long foreground$offset() { + return foreground$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int foreground + * } + */ + public static int foreground(MemorySegment struct) { + return struct.get(foreground$LAYOUT, foreground$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int foreground + * } + */ + public static void foreground(MemorySegment struct, int fieldValue) { + struct.set(foreground$LAYOUT, foreground$OFFSET, fieldValue); + } + + private static final OfInt debug$LAYOUT = (OfInt)$LAYOUT.select(groupElement("debug")); + + /** + * Layout for field: + * {@snippet lang=c : + * int debug + * } + */ + public static final OfInt debug$layout() { + return debug$LAYOUT; + } + + private static final long debug$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * int debug + * } + */ + public static final long debug$offset() { + return debug$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int debug + * } + */ + public static int debug(MemorySegment struct) { + return struct.get(debug$LAYOUT, debug$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int debug + * } + */ + public static void debug(MemorySegment struct, int fieldValue) { + struct.set(debug$LAYOUT, debug$OFFSET, fieldValue); + } + + private static final OfInt nodefault_subtype$LAYOUT = (OfInt)$LAYOUT.select(groupElement("nodefault_subtype")); + + /** + * Layout for field: + * {@snippet lang=c : + * int nodefault_subtype + * } + */ + public static final OfInt nodefault_subtype$layout() { + return nodefault_subtype$LAYOUT; + } + + private static final long nodefault_subtype$OFFSET = 12; + + /** + * Offset for field: + * {@snippet lang=c : + * int nodefault_subtype + * } + */ + public static final long nodefault_subtype$offset() { + return nodefault_subtype$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int nodefault_subtype + * } + */ + public static int nodefault_subtype(MemorySegment struct) { + return struct.get(nodefault_subtype$LAYOUT, nodefault_subtype$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int nodefault_subtype + * } + */ + public static void nodefault_subtype(MemorySegment struct, int fieldValue) { + struct.set(nodefault_subtype$LAYOUT, nodefault_subtype$OFFSET, fieldValue); + } + + private static final AddressLayout mountpoint$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("mountpoint")); + + /** + * Layout for field: + * {@snippet lang=c : + * char *mountpoint + * } + */ + public static final AddressLayout mountpoint$layout() { + return mountpoint$LAYOUT; + } + + private static final long mountpoint$OFFSET = 16; + + /** + * Offset for field: + * {@snippet lang=c : + * char *mountpoint + * } + */ + public static final long mountpoint$offset() { + return mountpoint$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * char *mountpoint + * } + */ + public static MemorySegment mountpoint(MemorySegment struct) { + return struct.get(mountpoint$LAYOUT, mountpoint$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * char *mountpoint + * } + */ + public static void mountpoint(MemorySegment struct, MemorySegment fieldValue) { + struct.set(mountpoint$LAYOUT, mountpoint$OFFSET, fieldValue); + } + + private static final OfInt show_version$LAYOUT = (OfInt)$LAYOUT.select(groupElement("show_version")); + + /** + * Layout for field: + * {@snippet lang=c : + * int show_version + * } + */ + public static final OfInt show_version$layout() { + return show_version$LAYOUT; + } + + private static final long show_version$OFFSET = 24; + + /** + * Offset for field: + * {@snippet lang=c : + * int show_version + * } + */ + public static final long show_version$offset() { + return show_version$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int show_version + * } + */ + public static int show_version(MemorySegment struct) { + return struct.get(show_version$LAYOUT, show_version$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int show_version + * } + */ + public static void show_version(MemorySegment struct, int fieldValue) { + struct.set(show_version$LAYOUT, show_version$OFFSET, fieldValue); + } + + private static final OfInt show_help$LAYOUT = (OfInt)$LAYOUT.select(groupElement("show_help")); + + /** + * Layout for field: + * {@snippet lang=c : + * int show_help + * } + */ + public static final OfInt show_help$layout() { + return show_help$LAYOUT; + } + + private static final long show_help$OFFSET = 28; + + /** + * Offset for field: + * {@snippet lang=c : + * int show_help + * } + */ + public static final long show_help$offset() { + return show_help$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int show_help + * } + */ + public static int show_help(MemorySegment struct) { + return struct.get(show_help$LAYOUT, show_help$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int show_help + * } + */ + public static void show_help(MemorySegment struct, int fieldValue) { + struct.set(show_help$LAYOUT, show_help$OFFSET, fieldValue); + } + + private static final OfInt clone_fd$LAYOUT = (OfInt)$LAYOUT.select(groupElement("clone_fd")); + + /** + * Layout for field: + * {@snippet lang=c : + * int clone_fd + * } + */ + public static final OfInt clone_fd$layout() { + return clone_fd$LAYOUT; + } + + private static final long clone_fd$OFFSET = 32; + + /** + * Offset for field: + * {@snippet lang=c : + * int clone_fd + * } + */ + public static final long clone_fd$offset() { + return clone_fd$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int clone_fd + * } + */ + public static int clone_fd(MemorySegment struct) { + return struct.get(clone_fd$LAYOUT, clone_fd$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int clone_fd + * } + */ + public static void clone_fd(MemorySegment struct, int fieldValue) { + struct.set(clone_fd$LAYOUT, clone_fd$OFFSET, fieldValue); + } + + private static final OfInt max_idle_threads$LAYOUT = (OfInt)$LAYOUT.select(groupElement("max_idle_threads")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned int max_idle_threads + * } + */ + public static final OfInt max_idle_threads$layout() { + return max_idle_threads$LAYOUT; + } + + private static final long max_idle_threads$OFFSET = 36; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned int max_idle_threads + * } + */ + public static final long max_idle_threads$offset() { + return max_idle_threads$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * unsigned int max_idle_threads + * } + */ + public static int max_idle_threads(MemorySegment struct) { + return struct.get(max_idle_threads$LAYOUT, max_idle_threads$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * unsigned int max_idle_threads + * } + */ + public static void max_idle_threads(MemorySegment struct, int fieldValue) { + struct.set(max_idle_threads$LAYOUT, max_idle_threads$OFFSET, fieldValue); + } + + private static final OfInt max_threads$LAYOUT = (OfInt)$LAYOUT.select(groupElement("max_threads")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned int max_threads + * } + */ + public static final OfInt max_threads$layout() { + return max_threads$LAYOUT; + } + + private static final long max_threads$OFFSET = 40; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned int max_threads + * } + */ + public static final long max_threads$offset() { + return max_threads$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * unsigned int max_threads + * } + */ + public static int max_threads(MemorySegment struct) { + return struct.get(max_threads$LAYOUT, max_threads$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * unsigned int max_threads + * } + */ + public static void max_threads(MemorySegment struct, int fieldValue) { + struct.set(max_threads$LAYOUT, max_threads$OFFSET, fieldValue); + } + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); + } + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { + return reinterpret(addr, 1, arena, cleanup); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); + } +} + diff --git a/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3_lowlevel/fuse_lowlevel_h.java b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3_lowlevel/fuse_lowlevel_h.java new file mode 100644 index 00000000..72094171 --- /dev/null +++ b/jfuse-mac/src/main/java/org/cryptomator/jfuse/mac/extr/fuse3_lowlevel/fuse_lowlevel_h.java @@ -0,0 +1,72 @@ +// Generated by jextract + +package org.cryptomator.jfuse.mac.extr.fuse3_lowlevel; + +import java.lang.invoke.*; +import java.lang.foreign.*; +import java.nio.ByteOrder; +import java.util.*; +import java.util.function.*; +import java.util.stream.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; + +public class fuse_lowlevel_h { + + fuse_lowlevel_h() { + // Should not be called directly + } + + static final Arena LIBRARY_ARENA = Arena.ofAuto(); + static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls"); + + static void traceDowncall(String name, Object... args) { + String traceArgs = Arrays.stream(args) + .map(Object::toString) + .collect(Collectors.joining(", ")); + System.out.printf("%s(%s)\n", name, traceArgs); + } + + static MemorySegment findOrThrow(String symbol) { + return SYMBOL_LOOKUP.find(symbol) + .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol)); + } + + static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { + try { + return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType()); + } catch (ReflectiveOperationException ex) { + throw new AssertionError(ex); + } + } + + static MemoryLayout align(MemoryLayout layout, long align) { + return switch (layout) { + case PaddingLayout p -> p; + case ValueLayout v -> v.withByteAlignment(align); + case GroupLayout g -> { + MemoryLayout[] alignedMembers = g.memberLayouts().stream() + .map(m -> align(m, align)).toArray(MemoryLayout[]::new); + yield g instanceof StructLayout ? + MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers); + } + case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align)); + }; + } + + static final SymbolLookup SYMBOL_LOOKUP = SymbolLookup.loaderLookup() + .or(Linker.nativeLinker().defaultLookup()); + + public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; + public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; + public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT; + public static final ValueLayout.OfInt C_INT = ValueLayout.JAVA_INT; + public static final ValueLayout.OfLong C_LONG_LONG = ValueLayout.JAVA_LONG; + public static final ValueLayout.OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT; + public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; + public static final AddressLayout C_POINTER = ValueLayout.ADDRESS + .withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, JAVA_BYTE)); + public static final ValueLayout.OfLong C_LONG = ValueLayout.JAVA_LONG; +} + diff --git a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FileInfoImplTest.java b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FileInfoImplTest.java index 91fee183..e91e77f6 100644 --- a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FileInfoImplTest.java +++ b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FileInfoImplTest.java @@ -1,7 +1,7 @@ package org.cryptomator.jfuse.mac; import org.cryptomator.jfuse.mac.extr.fcntl.fcntl_h; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_file_info; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_file_info; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.params.ParameterizedTest; diff --git a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl317Test.java b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl317Test.java new file mode 100644 index 00000000..9cf9ec9f --- /dev/null +++ b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseConnInfoImpl317Test.java @@ -0,0 +1,99 @@ +package org.cryptomator.jfuse.mac; + +import org.cryptomator.jfuse.api.FuseConnInfo; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_conn_info; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Named; +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.mockito.Answers; +import org.mockito.Mockito; + +import java.lang.foreign.Arena; +import java.lang.foreign.MemorySegment; +import java.util.function.BiConsumer; +import java.util.function.Function; +import java.util.stream.Stream; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyLong; + +public class FuseConnInfoImpl317Test { + + @DisplayName("XFeatureFlag methods are delegating to FuseFunctions") + @Test + void testXFeatureFlagMethods() { + try (var arena = Arena.ofConfined(); + var fuseFunctionsMock = Mockito.mockStatic(FuseFunctions.class)) { + var segment = fuse_conn_info.allocate(arena); + var connInfo = new FuseConnInfoImpl317(segment); + fuseFunctionsMock.when(() -> FuseFunctions.fuse_set_feature_flag(any(), anyLong())).thenReturn(true); + fuseFunctionsMock.when(() -> FuseFunctions.fuse_unset_feature_flag(any(), anyLong())).then(Answers.RETURNS_DEFAULTS); + fuseFunctionsMock.when(() -> FuseFunctions.fuse_get_feature_flag(any(), anyLong())).thenReturn(true); + + Assertions.assertDoesNotThrow(() -> connInfo.setFeatureFlag(3003L)); + Assertions.assertDoesNotThrow(() -> connInfo.getFeatureFlag(3003L)); + Assertions.assertDoesNotThrow(() -> connInfo.unsetFeatureFlag(3003L)); + + fuseFunctionsMock.verify(() -> FuseFunctions.fuse_set_feature_flag(segment, 3003L)); + fuseFunctionsMock.verify(() -> FuseFunctions.fuse_unset_feature_flag(segment, 3003L)); + fuseFunctionsMock.verify(() -> FuseFunctions.fuse_get_feature_flag(segment, 3003L)); + } + } + + @DisplayName("test long getters") + @ParameterizedTest(name = "{1}") + @MethodSource + void testGetters(SetInMemorySegment setter, GetInConnInfo getter) { + try (var arena = Arena.ofConfined()) { + var segment = fuse_conn_info.allocate(arena); + var connInfo = new FuseConnInfoImpl317(segment); + + setter.accept(segment, 42L); + + Assertions.assertEquals(42L, getter.apply(connInfo)); + } + } + + public static Stream testGetters() { + return Stream.of( + Arguments.arguments((SetInMemorySegment) fuse_conn_info::want_ext, Named.of("wantExt()", (GetInConnInfo) FuseConnInfo::wantExt)), + Arguments.arguments((SetInMemorySegment) fuse_conn_info::capable_ext, Named.of("capableExt()", (GetInConnInfo) FuseConnInfo::capableExt)) + ); + } + + interface SetInMemorySegment extends BiConsumer { + } + + interface GetInConnInfo extends Function { + } + + @DisplayName("test setters") + @ParameterizedTest(name = "{0}") + @MethodSource + void testSetters(SetInConnInfo setter, GetInMemorySegment getter) { + try (var arena = Arena.ofConfined()) { + var segment = fuse_conn_info.allocate(arena); + var connInfo = new FuseConnInfoImpl317(segment); + + setter.accept(connInfo, 42L); + + Assertions.assertEquals(42L, getter.apply(segment)); + } + } + + public static Stream testSetters() { + return Stream.of( + Arguments.arguments(Named.of("setWantExt()", (SetInConnInfo) FuseConnInfo::setWantExt), (GetInMemorySegment) fuse_conn_info::want_ext) + ); + } + + interface SetInConnInfo extends BiConsumer { + } + + interface GetInMemorySegment extends Function { + } +} diff --git a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseConnInfoImplTest.java b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseConnInfoImplTest.java index 0590dea0..ddd89693 100644 --- a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseConnInfoImplTest.java +++ b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/FuseConnInfoImplTest.java @@ -1,7 +1,7 @@ package org.cryptomator.jfuse.mac; import org.cryptomator.jfuse.api.FuseConnInfo; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_conn_info; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_conn_info; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Named; @@ -37,10 +37,11 @@ public static Stream testGetters() { Arguments.arguments((SetInMemorySegment) fuse_conn_info::proto_minor, Named.of("protoMinor()", (GetInConnInfo) FuseConnInfo::protoMinor)), Arguments.arguments((SetInMemorySegment) fuse_conn_info::capable, Named.of("capable()", (GetInConnInfo) FuseConnInfo::capable)), Arguments.arguments((SetInMemorySegment) fuse_conn_info::max_write, Named.of("maxWrite()", (GetInConnInfo) FuseConnInfo::maxWrite)), + Arguments.arguments((SetInMemorySegment) fuse_conn_info::max_read, Named.of("maxRead()", (GetInConnInfo) FuseConnInfo::maxRead)), Arguments.arguments((SetInMemorySegment) fuse_conn_info::max_readahead, Named.of("maxReadahead()", (GetInConnInfo) FuseConnInfo::maxReadahead)), Arguments.arguments((SetInMemorySegment) fuse_conn_info::max_background, Named.of("maxBackground()", (GetInConnInfo) FuseConnInfo::maxBackground)), Arguments.arguments((SetInMemorySegment) fuse_conn_info::congestion_threshold, Named.of("congestionThreshold()", (GetInConnInfo) FuseConnInfo::congestionThreshold)), - Arguments.arguments((SetInMemorySegment) fuse_conn_info::async_read, Named.of("asyncRead()", (GetInConnInfo) FuseConnInfo::asyncRead)), + Arguments.arguments((SetInMemorySegment) fuse_conn_info::time_gran, Named.of("timeGran()", (GetInConnInfo) FuseConnInfo::timeGran)), Arguments.arguments((SetInMemorySegment) fuse_conn_info::want, Named.of("want()", (GetInConnInfo) FuseConnInfo::want)) ); } @@ -67,10 +68,11 @@ public static Stream testSetters() { return Stream.of( Arguments.arguments(Named.of("setWant()", (SetInConnInfo) FuseConnInfo::setWant), (GetInMemorySegment) fuse_conn_info::want), Arguments.arguments(Named.of("setMaxWrite()", (SetInConnInfo) FuseConnInfo::setMaxWrite), (GetInMemorySegment) fuse_conn_info::max_write), + Arguments.arguments(Named.of("setMaxRead()", (SetInConnInfo) FuseConnInfo::setMaxRead), (GetInMemorySegment) fuse_conn_info::max_read), Arguments.arguments(Named.of("setMaxReadahead()", (SetInConnInfo) FuseConnInfo::setMaxReadahead), (GetInMemorySegment) fuse_conn_info::max_readahead), Arguments.arguments(Named.of("setMaxBackground()", (SetInConnInfo) FuseConnInfo::setMaxBackground), (GetInMemorySegment) fuse_conn_info::max_background), Arguments.arguments(Named.of("setCongestionThreshold()", (SetInConnInfo) FuseConnInfo::setCongestionThreshold), (GetInMemorySegment) fuse_conn_info::congestion_threshold), - Arguments.arguments(Named.of("setAsyncRead()", (SetInConnInfo) FuseConnInfo::setAsyncRead), (GetInMemorySegment) fuse_conn_info::async_read) + Arguments.arguments(Named.of("setTimeGran()", (SetInConnInfo) FuseConnInfo::setTimeGran), (GetInMemorySegment) fuse_conn_info::time_gran) ); } 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 dffc2683..021f8a1e 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 @@ -1,12 +1,16 @@ package org.cryptomator.jfuse.mac; +import org.cryptomator.jfuse.api.FuseConnInfo; import org.cryptomator.jfuse.api.FuseMountFailedException; import org.cryptomator.jfuse.api.FuseOperations; import org.cryptomator.jfuse.api.TimeSpec; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_file_info; -import org.cryptomator.jfuse.mac.extr.fuse.fuse_h; -import org.cryptomator.jfuse.mac.extr.fuse.stat; -import org.cryptomator.jfuse.mac.extr.fuse.timespec; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_config; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_conn_info; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_file_info; +import org.cryptomator.jfuse.mac.extr.fuse3.fuse_h; +import org.cryptomator.jfuse.mac.extr.fuse3.stat; +import org.cryptomator.jfuse.mac.extr.fuse3.timespec; +import org.cryptomator.jfuse.mac.extr.fuse3_lowlevel.fuse_cmdline_opts; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -15,6 +19,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; +import org.junit.jupiter.params.provider.ValueSource; +import org.mockito.Answers; import org.mockito.MockedStatic; import org.mockito.Mockito; @@ -23,6 +29,7 @@ import java.lang.foreign.ValueLayout; import java.time.Instant; import java.util.List; +import java.util.concurrent.atomic.AtomicReference; import static java.lang.foreign.ValueLayout.JAVA_INT; @@ -37,65 +44,76 @@ public class Mount { private List args = List.of("foo", "bar"); private FuseImpl fuseImplSpy = Mockito.spy(fuseImpl); - private MockedStatic fuseH; - - @BeforeEach - public void setup() { - Mockito.doReturn(Mockito.mock(FuseArgs.class)).when(fuseImplSpy).parseArgs(args); - fuseH = Mockito.mockStatic(fuse_h.class); - } - - @AfterEach - public void teardown() { - fuseH.close(); - } @Test @DisplayName("MountFailedException when fuse_new fails") public void testFuseNewFails() { - fuseH.when(() -> fuse_h.fuse_mount(Mockito.any(), Mockito.any())).thenReturn(MemorySegment.ofAddress(42L)); - fuseH.when(() -> fuse_h.fuse_new(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.anyLong(), Mockito.any())).thenReturn(MemorySegment.NULL); - - var thrown = Assertions.assertThrows(FuseMountFailedException.class, () -> fuseImplSpy.mount(args)); - - fuseH.verify(() -> fuse_h.fuse_unmount(Mockito.any(), Mockito.any())); - Assertions.assertEquals("fuse_new failed", thrown.getMessage()); + try (var fuseH = Mockito.mockStatic(FuseNewHelper.class)) { + var helper = Mockito.mock(FuseNewHelper.class); + fuseH.when(FuseNewHelper::getInstance).thenReturn(helper); + Mockito.when(helper.fuse_new(Mockito.any(), Mockito.any(), Mockito.anyLong(), Mockito.any())).thenReturn(MemorySegment.NULL); + var thrown = Assertions.assertThrows(FuseMountFailedException.class, () -> fuseImplSpy.createFuseFS(Mockito.mock(FuseArgs.class))); + Assertions.assertEquals("fuse_new failed", thrown.getMessage()); + } } @Test @DisplayName("MountFailedException when fuse_mount fails") - public void testFuseMountFails() { - fuseH.when(() -> fuse_h.fuse_mount(Mockito.any(), Mockito.any())).thenReturn(MemorySegment.NULL); + public void testFuseMountFails() throws FuseMountFailedException { + try (var fuseH = Mockito.mockStatic(fuse_h.class)) { + var fuseArgs = Mockito.mock(FuseArgs.class); + Mockito.doReturn(fuseArgs).when(fuseImplSpy).parseArgs(args); + Mockito.when(fuseArgs.mountPoint()).thenReturn(MemorySegment.NULL); + Mockito.when(fuseArgs.args()).thenReturn(MemorySegment.NULL); + fuseH.when(() -> fuse_h.fuse_mount(Mockito.any(), Mockito.any())).thenReturn(1); + Mockito.doReturn(MemorySegment.NULL).when(fuseImplSpy).createFuseFS(Mockito.any()); + var thrown = Assertions.assertThrows(FuseMountFailedException.class, () -> fuseImplSpy.mount(args)); + Assertions.assertEquals("fuse_mount failed", thrown.getMessage()); + } + } - var thrown = Assertions.assertThrows(FuseMountFailedException.class, () -> fuseImplSpy.mount(args)); + } - fuseH.verify(() -> fuse_h.fuse_new(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.anyLong(), Mockito.any()), Mockito.never()); - Assertions.assertEquals("fuse_mount failed", thrown.getMessage()); - } + @ParameterizedTest(name = "fusefs {0}") + @DisplayName("parseArgs with -h/--help") + @ValueSource(strings = {"--help", "-h"}) + public void testParseArgsHelp(String arg) { + var args = List.of("fusefs", arg); + try (var fuseFunctionsClass = Mockito.mockStatic(FuseFunctions.class); + var fuseH = Mockito.mockStatic(fuse_h.class)) { + fuseFunctionsClass.when(() -> FuseFunctions.fuse_parse_cmdline(Mockito.any(), Mockito.any())).then(invocation -> { + MemorySegment opts = invocation.getArgument(1); + fuse_cmdline_opts.show_help(opts, 1); + return 0; + }); + fuseH.when(() -> fuse_h.fuse_lib_help(Mockito.any())).thenAnswer(Answers.RETURNS_DEFAULTS); + Assertions.assertThrows(IllegalArgumentException.class, () -> fuseImpl.parseArgs(args)); + fuseH.verify(() -> fuse_h.fuse_lib_help(Mockito.any())); + } } @Test @DisplayName("parseArgs") public void testParseArgs() { - try (var fuseH = Mockito.mockStatic(fuse_h.class); - var arena = Arena.ofConfined()) { - fuseH.when(() -> fuse_h.fuse_parse_cmdline(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).then(invocation -> { - MemorySegment mp = invocation.getArgument(1); - MemorySegment mt = invocation.getArgument(2); - MemorySegment fg = invocation.getArgument(3); - mp.set(ValueLayout.ADDRESS, 0L, arena.allocateFrom("/mount/point")); - mt.set(JAVA_INT, 0L, 1); - fg.set(JAVA_INT, 0L, 1); + try (var fuseFunctionsClass = Mockito.mockStatic(FuseFunctions.class); + var arena = Arena.ofConfined()) { + fuseFunctionsClass.when(() -> FuseFunctions.fuse_parse_cmdline(Mockito.any(), Mockito.any())).then(invocation -> { + MemorySegment opts = invocation.getArgument(1); + fuse_cmdline_opts.singlethread(opts, 0); + fuse_cmdline_opts.debug(opts, 1); + fuse_cmdline_opts.mountpoint(opts, arena.allocateFrom("/mount/point")); return 0; }); var fuseArgs = fuseImpl.parseArgs(List.of("fusefs", "-foo", "-bar", "/mount/point")); - Assertions.assertTrue(fuseArgs.multiThreaded()); + Assertions.assertTrue(fuseArgs.multithreaded()); Assertions.assertTrue(fuseArgs.toString().contains("arg[0] = fusefs")); Assertions.assertTrue(fuseArgs.toString().contains("arg[1] = -foo")); Assertions.assertTrue(fuseArgs.toString().contains("arg[2] = -bar")); + Assertions.assertTrue(fuseArgs.toString().contains("singlethreaded = false")); + Assertions.assertTrue(fuseArgs.toString().contains("debug = 1")); Assertions.assertTrue(fuseArgs.toString().contains("mountPoint = /mount/point")); } } @@ -145,7 +163,62 @@ public void testFsyncdir() { Assertions.assertEquals(42, result); } } + } + + @Nested + @DisplayName("init") + public class Init { + @DisplayName("init() sets fuse_conn_info.wants |= FUSE_CAP_READDIRPLUS for libfuse < 3.17") + @Test + public void testInit316() { + try (var fuseFunctionsClass = Mockito.mockStatic(FuseFunctions.class); + var fuseH = Mockito.mockStatic(fuse_h.class); + var arena = Arena.ofConfined()) { + + var consumerReceivedConnInfo = new AtomicReference(); + Mockito.doAnswer(invocation -> { + consumerReceivedConnInfo.set(invocation.getArgument(0)); + return null; + }).when(fuseOps).init(Mockito.any(), Mockito.any()); + var connInfo = fuse_conn_info.allocate(arena); + var fuseConfig = fuse_config.allocate(arena); + + fuseH.when(fuse_h::fuse_version).thenReturn(316); + fuseFunctionsClass.when(() -> FuseFunctions.fuse_set_feature_flag(Mockito.any(), Mockito.anyLong())).thenThrow(UnsupportedOperationException.class); + + fuseImpl.init(connInfo, fuseConfig); + + Assertions.assertInstanceOf(FuseConnInfoImpl.class, consumerReceivedConnInfo.get()); + Assertions.assertEquals(FuseConnInfo.FUSE_CAP_READDIRPLUS, consumerReceivedConnInfo.get().want() & FuseConnInfo.FUSE_CAP_READDIRPLUS); + } + } + + @DisplayName("init() calls set_feature_flag(FUSE_CAP_READDIRPLUS) for libfuse >= 3.17") + @Test + public void testInit317() { + try (var fuseFunctionsClass = Mockito.mockStatic(FuseFunctions.class); + var fuseH = Mockito.mockStatic(fuse_h.class); + var arena = Arena.ofConfined()) { + + var consumerReceivedConnInfo = new AtomicReference(); + Mockito.doAnswer(invocation -> { + consumerReceivedConnInfo.set(invocation.getArgument(0)); + return null; + }).when(fuseOps).init(Mockito.any(), Mockito.any()); + var connInfo = fuse_conn_info.allocate(arena); + var fuseConfig = fuse_config.allocate(arena); + + fuseH.when(fuse_h::fuse_version).thenReturn(317); + fuseFunctionsClass.when(() -> FuseFunctions.fuse_set_feature_flag(connInfo, FuseConnInfo.FUSE_CAP_READDIRPLUS)).thenReturn(true); + + + fuseImpl.init(connInfo, fuseConfig); + + fuseFunctionsClass.verify(() -> FuseFunctions.fuse_set_feature_flag(connInfo, FuseConnInfo.FUSE_CAP_READDIRPLUS)); + Assertions.assertInstanceOf(FuseConnInfoImpl317.class, consumerReceivedConnInfo.get()); + } + } } @Nested @@ -157,10 +230,11 @@ public class Utimens { public void testUtimensNow() { try (var arena = Arena.ofConfined()) { var path = arena.allocateFrom("/foo"); + var fi = fuse_file_info.allocate(arena); var times = MemorySegment.NULL; - Mockito.doReturn(42).when(fuseOps).utimens(Mockito.eq("/foo"), Mockito.argThat(TimeSpec::isUtimeNow), Mockito.argThat(TimeSpec::isUtimeNow), Mockito.isNull()); + Mockito.doReturn(42).when(fuseOps).utimens(Mockito.eq("/foo"), Mockito.argThat(TimeSpec::isUtimeNow), Mockito.argThat(TimeSpec::isUtimeNow), Mockito.any()); - var result = fuseImpl.utimens(path, times); + var result = fuseImpl.utimens(path, times, fi); Assertions.assertEquals(42, result); } @@ -177,14 +251,15 @@ public void testUtimens(long sec0, long nsec0, long sec1, long nsec1) { Instant expectedMTime = Instant.ofEpochSecond(sec1, nsec1); try (var arena = Arena.ofConfined()) { var path = arena.allocateFrom("/foo"); + var fi = fuse_file_info.allocate(arena); var times = timespec.allocateArray(2, arena); timespec.tv_sec(timespec.asSlice(times, 0), sec0); timespec.tv_nsec(timespec.asSlice(times, 0), nsec0); timespec.tv_sec(timespec.asSlice(times, 1), sec1); timespec.tv_nsec(timespec.asSlice(times, 1), nsec1); - Mockito.doReturn(42).when(fuseOps).utimens(Mockito.eq("/foo"), Mockito.argThat(t -> expectedATime.equals(t.get())), Mockito.argThat(t -> expectedMTime.equals(t.get())), Mockito.isNull()); + Mockito.doReturn(42).when(fuseOps).utimens(Mockito.eq("/foo"), Mockito.argThat(t -> expectedATime.equals(t.get())), Mockito.argThat(t -> expectedMTime.equals(t.get())), Mockito.any()); - var result = fuseImpl.utimens(path, times); + var result = fuseImpl.utimens(path, times, fi); Assertions.assertEquals(42, result); } @@ -200,10 +275,11 @@ public class Attr { public void testGetattr() { try (var arena = Arena.ofConfined()) { var path = arena.allocateFrom("/foo"); + var fi = fuse_file_info.allocate(arena); var attr = stat.allocate(arena); - Mockito.doReturn(42).when(fuseOps).getattr(Mockito.eq("/foo"), Mockito.any(), Mockito.isNull()); + Mockito.doReturn(42).when(fuseOps).getattr(Mockito.eq("/foo"), Mockito.any(), Mockito.any()); - var result = fuseImpl.getattr(path, attr); + var result = fuseImpl.getattr(path, attr, fi); Assertions.assertEquals(42, result); } @@ -297,9 +373,10 @@ public class Truncate { public void testTruncate() { try (var arena = Arena.ofConfined()) { var path = arena.allocateFrom("/foo"); - Mockito.doReturn(42).when(fuseOps).truncate(Mockito.eq("/foo"), Mockito.eq(1337L), Mockito.isNull()); + var fi = fuse_file_info.allocate(arena); + Mockito.doReturn(42).when(fuseOps).truncate(Mockito.eq("/foo"), Mockito.eq(1337L), Mockito.any()); - var result = fuseImpl.truncate(path, 1337L); + var result = fuseImpl.truncate(path, 1337L, fi); Assertions.assertEquals(42, result); } @@ -326,9 +403,10 @@ public void testFtruncate() { public void testChown() { try (var arena = Arena.ofConfined()) { var path = arena.allocateFrom("/foo"); - Mockito.doReturn(42).when(fuseOps).chown("/foo", 42, 1337, null); + var fi = fuse_file_info.allocate(arena); + Mockito.doReturn(42).when(fuseOps).chown(Mockito.eq("/foo"), Mockito.eq(42), Mockito.eq(1337), Mockito.any()); - var result = fuseImpl.chown(path, 42, 1337); + var result = fuseImpl.chown(path, 42, 1337, fi); Assertions.assertEquals(42, result); } 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 index b69f6220..20ab93f1 100644 --- a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/StatImplTest.java +++ b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/StatImplTest.java @@ -1,7 +1,7 @@ package org.cryptomator.jfuse.mac; import org.cryptomator.jfuse.api.Stat; -import org.cryptomator.jfuse.mac.extr.fuse.stat; +import org.cryptomator.jfuse.mac.extr.fuse3.stat; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Named; diff --git a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/StatvfsImplTest.java b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/StatvfsImplTest.java index fe1fe986..78240452 100644 --- a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/StatvfsImplTest.java +++ b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/StatvfsImplTest.java @@ -1,7 +1,7 @@ package org.cryptomator.jfuse.mac; import org.cryptomator.jfuse.api.Statvfs; -import org.cryptomator.jfuse.mac.extr.fuse.statvfs; +import org.cryptomator.jfuse.mac.extr.fuse3.statvfs; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Named; diff --git a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/TimeSpecImplTest.java b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/TimeSpecImplTest.java index 93b6e344..7ff60ba4 100644 --- a/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/TimeSpecImplTest.java +++ b/jfuse-mac/src/test/java/org/cryptomator/jfuse/mac/TimeSpecImplTest.java @@ -1,7 +1,7 @@ package org.cryptomator.jfuse.mac; import org.cryptomator.jfuse.mac.extr.stat.stat_h; -import org.cryptomator.jfuse.mac.extr.fuse.timespec; +import org.cryptomator.jfuse.mac.extr.fuse3.timespec; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; From 0db2f13675d88656377b74b8b39b31de972a8c0d Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Mon, 9 Feb 2026 20:08:26 +0100 Subject: [PATCH 2/3] run local test with macfuse + libfuse3 --- .idea/runConfigurations/PosixMirrorFileSystem__macFUSE_.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.idea/runConfigurations/PosixMirrorFileSystem__macFUSE_.xml b/.idea/runConfigurations/PosixMirrorFileSystem__macFUSE_.xml index 1a45eab3..49d7b837 100644 --- a/.idea/runConfigurations/PosixMirrorFileSystem__macFUSE_.xml +++ b/.idea/runConfigurations/PosixMirrorFileSystem__macFUSE_.xml @@ -3,7 +3,7 @@