Permalink
Browse files

Initial structure is in place, nothing works yet, lots of debugging code

  • Loading branch information...
EtiennePerot committed Jan 15, 2012
1 parent 51b4763 commit b681323298fbc00032d9814ef25aad0989355b77
View
@@ -0,0 +1,3 @@
+bin
+*.log
+

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,110 @@
+#Sat Jan 14 20:49:31 EST 2012
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=true
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=true
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=true
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=true
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=true
+cleanup.sort_members_all=false
+cleanup.use_blocks=false
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_Etienne
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Etienne
+formatter_settings_version=12
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=true
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=true
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=true
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=true
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=true
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
View
Binary file not shown.
@@ -0,0 +1,16 @@
+package net.fusejna;
+
+import java.io.File;
+
+public abstract class FuseFilesystem
+{
+ public final void mount(final File mountPoint)
+ {
+ // TODO
+ }
+
+ public final void mount(final String mountPoint)
+ {
+ mount(new File(mountPoint));
+ }
+}
@@ -0,0 +1,66 @@
+package net.fusejna;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.CharacterCodingException;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import net.fusejna.examples.NullFS;
+import net.fusejna.structures.StructFuseContext;
+import net.fusejna.structures.StructFuseOperations;
+import net.fusejna.types.TypeSize;
+
+import com.sun.jna.Library;
+import com.sun.jna.Native;
+import com.sun.jna.Pointer;
+
+final class FuseJna
+{
+ private interface LibFuse extends Library
+ {
+ StructFuseContext fuse_get_context();
+
+ int fuse_main_real(int argc, String[] argv, StructFuseOperations op, TypeSize size, Pointer user_data);
+ }
+
+ private static LibFuse libFuse = null;
+ private static Lock libFuseLoadLock = new ReentrantLock();
+
+ static LibFuse getFuse()
+ {
+ if (libFuse != null) {
+ // No need to lock if everything is fine already
+ return libFuse;
+ }
+ libFuseLoadLock.lock();
+ if (libFuse == null) {
+ Native.setProtected(true);
+ libFuse = (LibFuse) Native.loadLibrary("fuse", LibFuse.class);
+ }
+ libFuseLoadLock.unlock();
+ return libFuse;
+ }
+
+ public static void main(final String... args)
+ {
+ final LibFuse fuse = getFuse();
+ final StructFuseOperations.ByReference operations = new StructFuseOperations.ByReference(new NullFS());
+ final Charset utf8 = Charset.forName("UTF-8");
+ final CharsetEncoder utf8encoder = utf8.newEncoder();
+ final ByteBuffer[] argv = new ByteBuffer[args.length];
+ try {
+ for (int i = 0; i < args.length; i++) {
+ utf8encoder.reset();
+ argv[i] = utf8encoder.encode(CharBuffer.wrap(args[i]));
+ }
+ }
+ catch (final CharacterCodingException e) {
+ // Not gonna happen
+ }
+ fuse.fuse_main_real(args.length, args, operations, new TypeSize(operations.size()), null);
+ System.err.println("Mounted");
+ }
+}
@@ -0,0 +1,7 @@
+package net.fusejna.examples;
+
+import net.fusejna.FuseFilesystem;
+
+public final class NullFS extends FuseFilesystem
+{
+}
@@ -0,0 +1,29 @@
+package net.fusejna.structures;
+
+import com.sun.jna.Structure;
+
+public class StructFuseConnInfo extends Structure
+{
+ public static class ByReference extends StructFuseConnInfo implements Structure.ByReference
+ {
+ }
+
+ public static class ByValue extends StructFuseConnInfo implements Structure.ByValue
+ {
+ }
+
+ public int proto_major;
+ public int proto_minor;
+ public int async_read;
+ public int max_write;
+ public int max_readahead;
+ public int enable;
+ public int want;
+ public int[] reserved = new int[25];
+
+ public void setOptions(final boolean setVolumeName, final boolean caseInsensitive)
+ {
+ want = (setVolumeName ? 0x2 : 0x0) | (caseInsensitive ? 0x1 : 0x0);
+ write();
+ }
+}
@@ -0,0 +1,25 @@
+package net.fusejna.structures;
+
+import net.fusejna.types.TypeGid;
+import net.fusejna.types.TypePid;
+import net.fusejna.types.TypeUid;
+
+import com.sun.jna.Pointer;
+import com.sun.jna.Structure;
+
+public class StructFuseContext extends Structure
+{
+ public static class ByReference extends StructFuseContext implements Structure.ByReference
+ {
+ }
+
+ public static class ByValue extends StructFuseContext implements Structure.ByValue
+ {
+ }
+
+ public Pointer fuse;
+ public TypeUid uid;
+ public TypeGid gid;
+ public TypePid pid;
+ public Pointer private_data;
+}
Oops, something went wrong.

0 comments on commit b681323

Please sign in to comment.