Commits

Etienne Perot committed 4b45d80

Added new types and new structs, fixed some silly mistakes

  • Participants
  • Parent commits b681323

Comments (0)

Files changed (11)

 <classpath>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-	<classpathentry kind="lib" path="lib/jna/jna.jar"/>
+	<classpathentry kind="lib" path="lib/jna/jna.jar" sourcepath="lib/jna/jna.src.zip"/>
 	<classpathentry kind="lib" path="lib/jna/platform.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

File src/net/fusejna/FuseJna.java

 		}
 		fuse.fuse_main_real(args.length, args, operations, new TypeSize(operations.size()), null);
 		System.err.println("Mounted");
+		try {
+			Thread.sleep(10000);
+		}
+		catch (final InterruptedException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
 	}
 }

File src/net/fusejna/structures/StructFuseFileInfo.java

+package net.fusejna.structures;
+
+import net.fusejna.types.TypeUInt64;
+
+import com.sun.jna.NativeLong;
+import com.sun.jna.Structure;
+
+public class StructFuseFileInfo extends Structure
+{
+	public static class ByReference extends StructFuseFileInfo implements Structure.ByReference
+	{
+	}
+
+	public static class ByValue extends StructFuseFileInfo implements Structure.ByValue
+	{
+	}
+
+	public int flags;
+	public NativeLong fh_old;
+	public int writepage;
+	public int direct_io = 1;
+	public int keep_cache = 1;
+	public int flush = 1;
+	public int nonseekable = 1;
+	public int padding = 28;
+	public TypeUInt64 fhl;
+	public TypeUInt64 lock_owner;
+}

File src/net/fusejna/structures/StructFuseOperations.java

 	{
 		getattr = new Callback()
 		{
-			public int callback(final String path, final Pointer stat)
+			public int callback(final String path, final StructStat.ByReference stat)
 			{
-				System.out.println("getattr");
+				System.out.println("getattr " + stat);
 				sleep();
 				return 0;
 			}
 				return 0;
 			}
 		};
-		readlink = new Callback()
-		{
-			public int callback(final String path, final Pointer target, final TypeSize size)
-			{
-				System.out.println("readlink");
-				sleep();
-				return 0;
-			}
-		};
 		mknod = new Callback()
 		{
 			public int callback(final String path, final TypeMode mode, final TypeDev dev)
 		utime = null; // Deprecated
 		open = new Callback()
 		{
-			public int callback(final String path, final Pointer info)
+			public int callback(final String path, final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("open");
 				sleep();
 		read = new Callback()
 		{
 			public int callback(final String path, final Pointer buffer, final TypeSize size, final TypeOff offset,
-					final Pointer info)
+					final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("read");
 				sleep();
 		write = new Callback()
 		{
 			public int callback(final String path, final String buffer, final TypeSize size, final TypeOff offset,
-					final Pointer info)
+					final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("write");
 				sleep();
 		};
 		statfs = new Callback()
 		{
-			public int callback(final String path, final Pointer statsvfs)
+			public int callback(final String path, final StructFuseFileInfo.ByReference statsvfs)
 			{
 				System.out.println("statfs");
 				sleep();
 		};
 		flush = new Callback()
 		{
-			public int callback(final String path, final Pointer info)
+			public int callback(final String path, final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("flush");
 				sleep();
 		};
 		release = new Callback()
 		{
-			public int callback(final String path, final Pointer info)
+			public int callback(final String path, final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("info");
 				sleep();
 		};
 		fsync = new Callback()
 		{
-			public int callback(final String path, final Pointer info)
+			public int callback(final String path, final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("fsync");
 				sleep();
 		};
 		opendir = new Callback()
 		{
-			public int callback(final String path, final Pointer info)
+			public int callback(final String path, final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("opendir");
 				sleep();
 		};
 		readdir = new Callback()
 		{
-			public int callback(final String path, final Callback fillFunction, final TypeOff offset, final Pointer info)
+			public int callback(final String path, final Callback fillFunction, final TypeOff offset,
+					final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("readdir");
 				sleep();
 		};
 		releasedir = new Callback()
 		{
-			public int callback(final String path, final Pointer info)
+			public int callback(final String path, final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("releasedir");
 				sleep();
 		};
 		fsyncdir = new Callback()
 		{
-			public int callback(final String path, final Pointer info)
+			public int callback(final String path, final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("fsyncdir");
 				sleep();
 		};
 		create = new Callback()
 		{
-			public int callback(final String path, final TypeMode mode, final Pointer info)
+			public int callback(final String path, final TypeMode mode, final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("create");
 				sleep();
 		};
 		ftruncate = new Callback()
 		{
-			public int callback(final String path, final TypeOff offset, final Pointer info)
+			public int callback(final String path, final TypeOff offset, final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("ftruncate");
 				sleep();
 		};
 		fgetattr = new Callback()
 		{
-			public int callback(final String path, final Pointer attr, final Pointer info)
+			public int callback(final String path, final Pointer attr, final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("fgetattr");
 				sleep();
 		};
 		bmap = new Callback()
 		{
-			public int callback(final String path, final Pointer info)
+			public int callback(final String path, final StructFuseFileInfo.ByReference info)
 			{
 				System.out.println("bmap");
 				sleep();

File src/net/fusejna/structures/StructStat.java

+package net.fusejna.structures;
+
+import net.fusejna.types.TypeBlkCnt;
+import net.fusejna.types.TypeBlkSize;
+import net.fusejna.types.TypeDev;
+import net.fusejna.types.TypeGid;
+import net.fusejna.types.TypeIno;
+import net.fusejna.types.TypeMode;
+import net.fusejna.types.TypeNLink;
+import net.fusejna.types.TypeOff;
+import net.fusejna.types.TypeTime;
+import net.fusejna.types.TypeUid;
+
+import com.sun.jna.Structure;
+
+public class StructStat extends Structure
+{
+	public static class ByReference extends StructStat implements Structure.ByReference
+	{
+	}
+
+	public static class ByValue extends StructStat implements Structure.ByValue
+	{
+	}
+
+	public TypeDev st_dev;
+	public TypeIno st_ino;
+	public TypeMode st_mode;
+	public TypeNLink st_nlink;
+	public TypeUid st_uid;
+	public TypeGid st_gid;
+	public TypeDev st_rdev;
+	public TypeOff st_size;
+	public TypeBlkSize st_blksize;
+	public TypeBlkCnt st_blocks;
+	public TypeTime st_atime;
+	public TypeTime st_mtime;
+	public TypeTime st_ctime;
+}

File src/net/fusejna/structures/StructTimespec.java

 
 public class StructTimespec extends Structure
 {
-	public static class ByReference extends StructFuseContext implements Structure.ByReference
+	public static class ByReference extends StructTimespec implements Structure.ByReference
 	{
 	}
 

File src/net/fusejna/types/TypeBlkCnt.java

+package net.fusejna.types;
+
+import com.sun.jna.IntegerType;
+
+@SuppressWarnings("serial")
+public class TypeBlkCnt extends IntegerType
+{
+	private static final int size = 8;
+
+	public TypeBlkCnt()
+	{
+		super(size);
+	}
+
+	public TypeBlkCnt(final long value)
+	{
+		super(size, value);
+	}
+}

File src/net/fusejna/types/TypeBlkSize.java

+package net.fusejna.types;
+
+import com.sun.jna.IntegerType;
+
+@SuppressWarnings("serial")
+public class TypeBlkSize extends IntegerType
+{
+	private static final int size = 8;
+
+	public TypeBlkSize()
+	{
+		super(size);
+	}
+
+	public TypeBlkSize(final long value)
+	{
+		super(size, value);
+	}
+}

File src/net/fusejna/types/TypeIno.java

+package net.fusejna.types;
+
+import com.sun.jna.IntegerType;
+
+@SuppressWarnings("serial")
+public class TypeIno extends IntegerType
+{
+	private static final int size = 8;
+
+	public TypeIno()
+	{
+		super(size);
+	}
+
+	public TypeIno(final long value)
+	{
+		super(size, value);
+	}
+}

File src/net/fusejna/types/TypeNLink.java

+package net.fusejna.types;
+
+import com.sun.jna.IntegerType;
+
+@SuppressWarnings("serial")
+public class TypeNLink extends IntegerType
+{
+	private static final int size = 8;
+
+	public TypeNLink()
+	{
+		super(size);
+	}
+
+	public TypeNLink(final long value)
+	{
+		super(size, value);
+	}
+}

File src/net/fusejna/types/TypeTime.java

+package net.fusejna.types;
+
+import com.sun.jna.IntegerType;
+
+@SuppressWarnings("serial")
+public class TypeTime extends IntegerType
+{
+	private static final int size = 8;
+
+	public TypeTime()
+	{
+		super(size);
+	}
+
+	public TypeTime(final long value)
+	{
+		super(size, value);
+	}
+}