EtiennePerot / fuse-jna

No-nonsense, actually-working Java bindings to FUSE using JNA.
http://fusejna.net/
Other
137 stars 43 forks source link

fuse_get_context() wanted #2

Closed onokonem closed 11 years ago

onokonem commented 11 years ago

Hi!

First of all, thank you for fuse-jna. Saved me a lot of work, true.

For the project I'm working on I need access to the data provided by fuse_get_context(). But I was not able to find a way to get them! Even reading sources :)

So I made a simple patch attached below. I still think I've missed something and there must be a standard way to call fuse_get_context(), but just in case...

diff --git a/src/net/fusejna/Platform.java b/src/net/fusejna/Platform.java
index 33cae9f..2e2c91a 100644
--- a/src/net/fusejna/Platform.java
+++ b/src/net/fusejna/Platform.java
@@ -28,6 +28,14 @@ public final class Platform
        return libFuse;
    }

+   public static final StructFuseContext.ByReference fuse_get_context()
+   {
+       if (libFuse == null) {
+           init();
+       }
+       return libFuse.fuse_get_context();
+   }
+
    private static final void init()
    {
        if (libFuse != null) {
EtiennePerot commented 11 years ago

I'll look at that in a moment, thanks

EtiennePerot commented 11 years ago

I forgot that I had written StructFuseContext... Added some getter methods for it and usage example in 9dab949038937c85c72eb658b4ce824fbe376a1e, thanks for the report.