Permalink
Browse files

progress

  • Loading branch information...
1 parent 4411351 commit b8b78a43a5a8538d17365f967f9d67aac5761afd @fizx committed Sep 18, 2009
View
@@ -2,4 +2,8 @@
.DS_Store
coverage
rdoc
-pkg
+pkg
+*.o
+*.bundle
+*.log
+Makefile
View
@@ -10,6 +10,7 @@ begin
gem.email = "kyle@kylemaxwell.com"
gem.homepage = "http://github.com/fizx/fusefs"
gem.authors = ["Kyle Maxwell"]
+ gem.extensions = ["ext/extconf.rb"]
end
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
View
@@ -1,157 +0,0 @@
-
-SHELL = /bin/sh
-
-#### Start of system configuration section. ####
-
-srcdir = .
-topdir = /opt/local/lib/ruby/1.8/i686-darwin10
-hdrdir = $(topdir)
-VPATH = $(srcdir):$(topdir):$(hdrdir)
-exec_prefix = $(prefix)
-prefix = $(DESTDIR)/opt/local
-sharedstatedir = $(prefix)/com
-mandir = $(DESTDIR)/opt/local/share/man
-psdir = $(docdir)
-oldincludedir = $(DESTDIR)/usr/include
-localedir = $(datarootdir)/locale
-bindir = $(exec_prefix)/bin
-libexecdir = $(exec_prefix)/libexec
-sitedir = $(libdir)/ruby/site_ruby
-htmldir = $(docdir)
-vendorarchdir = $(vendorlibdir)/$(sitearch)
-includedir = $(prefix)/include
-infodir = $(datarootdir)/info
-vendorlibdir = $(vendordir)/$(ruby_version)
-sysconfdir = $(prefix)/etc
-libdir = $(exec_prefix)/lib
-sbindir = $(exec_prefix)/sbin
-rubylibdir = $(libdir)/ruby/$(ruby_version)
-docdir = $(datarootdir)/doc/$(PACKAGE)
-dvidir = $(docdir)
-vendordir = $(DESTDIR)/opt/local/lib/ruby/vendor_ruby
-datarootdir = $(prefix)/share
-pdfdir = $(docdir)
-archdir = $(rubylibdir)/$(arch)
-sitearchdir = $(sitelibdir)/$(sitearch)
-datadir = $(datarootdir)
-localstatedir = $(prefix)/var
-sitelibdir = $(sitedir)/$(ruby_version)
-
-CC = /usr/bin/gcc-4.2
-LIBRUBY = $(LIBRUBY_SO)
-LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
-LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
-LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
-
-RUBY_EXTCONF_H =
-CFLAGS = -fno-common -O2 -arch x86_64 -fno-common -pipe -fno-common $(cflags) -arch x86_64
-INCFLAGS = -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin10 -I.
-DEFS =
-CPPFLAGS = -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/opt/local/include
-CXXFLAGS = $(CFLAGS)
-ldflags = -L. -L/opt/local/lib
-dldflags =
-archflag = -arch x86_64
-DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
-LDSHARED = $(CC) -dynamic -bundle -undefined suppress -flat_namespace
-AR = ar
-EXEEXT =
-
-RUBY_INSTALL_NAME = ruby
-RUBY_SO_NAME = ruby
-arch = i686-darwin10
-sitearch = i686-darwin10
-ruby_version = 1.8
-ruby = /opt/local/bin/ruby
-RUBY = $(ruby)
-RM = rm -f
-MAKEDIRS = mkdir -p
-INSTALL = /usr/bin/install -c
-INSTALL_PROG = $(INSTALL) -m 0755
-INSTALL_DATA = $(INSTALL) -m 644
-COPY = cp
-
-#### End of system configuration section. ####
-
-preload =
-
-libpath = . $(libdir)
-LIBPATH = -L. -L$(libdir)
-DEFFILE =
-
-CLEANFILES = mkmf.log
-DISTCLEANFILES =
-
-extout =
-extout_prefix =
-target_prefix =
-LOCAL_LIBS =
-LIBS = $(LIBRUBYARG_SHARED) -lfuse -lpthread -ldl -lobjc
-SRCS = fusefs_fuse.c fusefs_lib.c
-OBJS = fusefs_fuse.o fusefs_lib.o
-TARGET = fusefs_lib
-DLLIB = $(TARGET).bundle
-EXTSTATIC =
-STATIC_LIB =
-
-BINDIR = $(bindir)
-RUBYCOMMONDIR = $(sitedir)$(target_prefix)
-RUBYLIBDIR = $(sitelibdir)$(target_prefix)
-RUBYARCHDIR = $(sitearchdir)$(target_prefix)
-
-TARGET_SO = $(DLLIB)
-CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
-CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
-
-all: $(DLLIB)
-static: $(STATIC_LIB)
-
-clean:
- @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
-
-distclean: clean
- @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
- @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
-
-realclean: distclean
-install: install-so install-rb
-
-install-so: $(RUBYARCHDIR)
-install-so: $(RUBYARCHDIR)/$(DLLIB)
-$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
-install-rb: pre-install-rb install-rb-default
-install-rb-default: pre-install-rb-default
-pre-install-rb: Makefile
-pre-install-rb-default: Makefile
-$(RUBYARCHDIR):
- $(MAKEDIRS) $@
-
-site-install: site-install-so site-install-rb
-site-install-so: install-so
-site-install-rb: install-rb
-
-.SUFFIXES: .c .m .cc .cxx .cpp .C .o
-
-.cc.o:
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
-
-.cxx.o:
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
-
-.cpp.o:
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
-
-.C.o:
- $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
-
-.c.o:
- $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
-
-$(DLLIB): $(OBJS) Makefile
- @-$(RM) $@
- $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
-
-
-
-$(OBJS): ruby.h defines.h
View
@@ -1,6 +1,6 @@
require 'mkmf'
dir_config('fusefs_lib.so')
-if have_library('fuse')
+if have_library('fuse_ino64') || have_library('fuse')
create_makefile('fusefs_lib')
else
puts "No FUSE install available"
View
@@ -3,15 +3,10 @@
/* This is rewriting most of the things that occur
* in fuse_main up through fuse_loop */
-#define FUSE_USE_VERSION 22
+#define FUSE_USE_VERSION 26
#define _FILE_OFFSET_BITS 64
#include <fuse.h>
-/* #include "fuse_i.h"
-#include "fuse_compat.h"
-#include "fuse_kernel.h"
-#include "fuse_kernel_compat5.h" */
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -24,25 +19,32 @@
#include <sys/uio.h>
#include <signal.h>
-struct fuse * fuse_instance = NULL;
-static unsigned int fusefd;
+struct fuse *fuse_instance = NULL;
+struct fuse_chan *fusech = NULL;
static char *mounted_at = NULL;
static int set_one_signal_handler(int signal, void (*handler)(int));
int fusefs_fd() {
- return fusefd;
+ if(fusech == NULL)
+ return -1;
+ return fuse_chan_fd(fusech);
}
int
fusefs_unmount() {
+ char buf[128];
+
+ if (mounted_at && fusech) {
+ fuse_unmount(mounted_at, fusech);
+ sprintf(buf, "/sbin/umount %s", mounted_at);
+ system(buf);
+ }
if (fuse_instance)
fuse_destroy(fuse_instance);
fuse_instance = NULL;
- if (mounted_at)
- fuse_unmount(mounted_at);
free(mounted_at);
- fusefd = -1;
+ fusech = NULL;
}
static void
@@ -53,38 +55,8 @@ fusefs_ehandler() {
}
int
-fusefs_setup(char *mountpoint, const struct fuse_operations *op, char *opts) {
- char fuse_new_opts[1024];
- char fuse_mount_opts[1024];
- char nopts[1024];
-
- char *cur;
- char *ptr;
-
- fuse_new_opts[0] = '\0';
- fuse_mount_opts[0] = '\0';
-
- for (cur=opts;cur;cur = ptr) {
- ptr = strchr(cur,',');
- if (ptr) *(ptr++) = '\0';
- if (fuse_is_lib_option(cur)) {
- if (fuse_new_opts[0]) {
- strcpy(nopts,fuse_new_opts);
- snprintf(fuse_new_opts,1024,"%s,%s",nopts,cur);
- } else {
- snprintf(fuse_new_opts,1024,"%s",cur);
- }
- } else {
- if (fuse_mount_opts[0]) {
- strcpy(nopts,fuse_mount_opts);
- snprintf(fuse_mount_opts,1024,"%s,%s",nopts,cur);
- } else {
- snprintf(fuse_mount_opts,1024,"%s",cur);
- }
- }
- }
-
- fusefd = -1;
+fusefs_setup(char *mountpoint, const struct fuse_operations *op, struct fuse_args *opts) {
+ fusech = NULL;
if (fuse_instance != NULL) {
return 0;
}
@@ -93,10 +65,10 @@ fusefs_setup(char *mountpoint, const struct fuse_operations *op, char *opts) {
}
/* First, mount us */
- fusefd = fuse_mount(mountpoint, fuse_mount_opts[0] ? fuse_mount_opts : NULL);
- if (fusefd == -1) return 0;
+ fusech = fuse_mount(mountpoint, opts);
+ if (fusech == NULL) return 0;
- fuse_instance = fuse_new(fusefd, fuse_new_opts[0] ? fuse_new_opts : NULL, op, sizeof(*op));
+ fuse_instance = fuse_new(fusech, opts, op, sizeof(*op), NULL);
if (fuse_instance == NULL)
goto err_unmount;
@@ -115,7 +87,7 @@ fusefs_setup(char *mountpoint, const struct fuse_operations *op, char *opts) {
err_destroy:
fuse_destroy(fuse_instance);
err_unmount:
- fuse_unmount(mountpoint);
+ fuse_unmount(mountpoint, fusech);
return 0;
}
View
@@ -6,10 +6,12 @@
#ifndef __FUSEFS_FUSE_H_
#define __FUSEFS_FUSE_H_
+struct fuse_args;
+
int fusefs_fd();
int fusefs_unmount();
int fusefs_ehandler();
-int fusefs_setup(char *mountpoint, const struct fuse_operations *op, char *opts);
+int fusefs_setup(char *mountpoint, const struct fuse_operations *op, struct fuse_args *opts);
int fusefs_process();
int fusefs_uid();
int fusefs_gid();
View
Binary file not shown.
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit b8b78a4

Please sign in to comment.