Commits

evhan  committed 9ee6222

Use cncb/pthreads, support fuse_loop_mt

  • Participants
  • Parent commits d2ecc9b

Comments (0)

Files changed (4)

  (author "Evan Hanson")
  (license "BSD")
  (category os)
- (depends foreigners matchable)
+ (depends concurrent-native-callbacks foreigners matchable)
  (foreign-depends "libfuse"))
 ;;; under the terms of the GNU LGPLv2.
 ;;;
 
-(require-library lolevel srfi-18)
+(require-library lolevel srfi-18 posix)
+(require-library concurrent-native-callbacks)
+(require-extension-for-syntax concurrent-native-callbacks-compile-time matchable)
 
 (module fuse
   (make-filesystem
    start-filesystem
    stop-filesystem
+   filesystem-running?
+   filesystem?
    file/fifo
    file/chr
    file/blk
    file/dir
    file/lnk
    file/sock)
-  (import scheme chicken foreign lolevel srfi-18 matchable libfuse)
+  (import scheme chicken foreign lolevel srfi-18)
+  (import (except posix errno/nosys))
+  (import concurrent-native-callbacks libfuse matchable)
   (foreign-declare "#define FUSE_USE_VERSION 26")
   (foreign-declare "#include <fuse.h>")
   (foreign-declare "#include <errno.h>")
+  (foreign-declare "#include <pthread.h>")
+  (foreign-declare "#include <signal.h>")
 
 (define-foreign-type dev_t int)
 (define-foreign-type off_t integer64) ; libfuse has _FILE_OFFSET_BITS=64
 (define-foreign-type fuse_file_info (c-pointer (struct "fuse_file_info")))
 (define-foreign-type fuse_conn_info (c-pointer (struct "fuse_conn_info")))
 (define-foreign-type fuse_pollhandle (c-pointer (struct "fuse_pollhandle")))
+(define-foreign-type fuse_operations (c-pointer (struct "fuse_operations")))
 (define-foreign-type fuse_fill_dir_t
-  (function int (c-pointer (const c-string) (c-pointer (const (struct "stat"))) off_t)))
+  (function int (c-pointer c-string (c-pointer (struct "stat")) off_t)))
+
+(define-inline (false) #f)
 
 (define-inline (vector-for-each f v) ; . v
   (let ((l (##sys#vector-length v)))
 
 ;;
 ;; The filesystem and mount record types are opaque structures that
-;; track a filesystem's callbacks, mountpoints, and each mount's dynamic
-;; environment (currently, its exception handler).
+;; track a filesystem's callbacks, active mounts, shutdown and exception
+;; handlers.
 ;;
 (define-record filesystem operations mounts)
-(define-record mount filesystem channel exception-handler)
-(define filesystem make-filesystem)
+(define-record mount filesystem running-handler shutdown-handler exception-handler)
 
 (define-inline (filesystem-mount-add! fs path mount)
   (filesystem-mounts-set! fs (alist-cons path mount (filesystem-mounts fs))))
     ))
 
 (define make-filesystem
-  (let ((not-implemented (lambda _ (raise errno/nosys))))
+  (let ((make-filesystem make-filesystem))
     (lambda args
-      (let ((oper (##sys#make-vector 23 not-implemented)))
+      (let ((oper (##sys#make-vector 23 #f)))
         (let loop ((args args))
           (match args
             (()
-             (filesystem oper '()))
+             (make-filesystem oper '()))
             (('utime: value . rest)
              (error 'make-filesystem "The utime: option is deprecated - use utimens: instead"))
             (('getdir: value . rest)
             (else
              (error 'make-filesystem "Odd keyword arguments" (car args)))))))))
 
+(define current-fuse-context #f) ; XXX Dynamic variable.
+
 (define-inline (current-mount)
-  (gc-root-ref (fuse_context_private_data (fuse_get_context))))
+  (gc-root-ref (fuse_context_private_data current-fuse-context)))
 
 (define-inline (current-filesystem)
   (mount-filesystem (current-mount)))
 
 (define-inline (current-filesystem-callback i)
-  (##sys#vector-ref (filesystem-operations (current-filesystem)) i))
+  (or (##sys#vector-ref (filesystem-operations (current-filesystem)) i)
+      (lambda _ (raise errno/nosys))))
 
 (define-inline (current-mount-exception-handler)
   (mount-exception-handler (current-mount)))
       thunk))))
 
 (define-syntax define-callback
-  (syntax-rules ()
-    ((_ spec return-type . body)
-     (define-external spec return-type
-       (callback-protect (lambda () . body))))))
-
-(define-callback (fuse_getattr_callback (c-string path) ((c-pointer (struct "stat")) stat)) int
+  (er-macro-transformer
+   (lambda (e r c)
+     (let* ((name        (caadr e))
+            (spec        (cdadr e))
+            (return-type (caddr e))
+            (body        (cdddr e))
+            (handler     (symbol-append 'fuse_ name '_handler))
+            (callback    (symbol-append 'fuse_ name '_callback)))
+       `(begin
+          (define-synchronous-concurrent-native-callback
+            (,handler (c-pointer context) ,@spec) ,return-type
+            (fluid-let ((current-fuse-context context))
+              (callback-protect (lambda () ,@body))))
+          (foreign-declare
+           ,(conc (foreign-type-declaration return-type "")
+                  callback "("
+                  (string-intersperse
+                   (map (match-lambda
+                          ((type arg)
+                           (foreign-type-declaration type (symbol->string arg))))
+                        spec)
+                   ",") "){"
+                  (if (eq? void return-type) "" "return ")
+                  handler "(fuse_get_context(),"
+                  (string-intersperse
+                   (map (match-lambda ((type arg) (symbol->string arg))) spec)
+                   ",") ");}")))))))
+
+(define-callback (getattr (c-string path) (c-pointer stat)) int
   (let ((v ((current-filesystem-callback 0) path)))
     (match v
       (#(mode nlink uid gid size atime ctime mtime)
       (else
        (callback-result v)))))
 
-(define-callback (fuse_readdir_callback (c-string path) (c-pointer buf) (fuse_fill_dir_t filler) (off_t off) (fuse_file_info fi)) int
+(define-callback (readdir (c-string path) (c-pointer buf) ((function int (c-pointer c-string c-pointer int)) filler) (integer64 off) (c-pointer fi)) int
   (let ((v ((current-filesystem-callback 1) path)))
     (match v
       ((n ...)
       (else
        (callback-result v)))))
 
-(define-callback (fuse_open_callback (c-string path) (fuse_file_info fi)) int
+(define-callback (open (c-string path) (c-pointer fi)) int
   (let ((v ((current-filesystem-callback 2) path (fuse_file_info_flags fi))))
     (fuse_file_info_fh_set! fi (object-evict v))
     (callback-result v)))
 
-(define-callback (fuse_read_callback (c-string path) (c-pointer buf) (size_t len) (off_t off) (fuse_file_info fi)) int
+(define-callback (read (c-string path) (c-pointer buf) (size_t len) (integer64 off) (c-pointer fi)) int
   (let ((v ((current-filesystem-callback 3) (fuse_file_info_fh fi) len off)))
     (cond ((fixnum? v) v)
           ((string? v)
              l))
           ((callback-result v)))))
 
-(define-callback (fuse_write_callback (c-string path) (c-string data) (size_t len) (off_t off) (fuse_file_info fi)) int
+(define-callback (write (c-string path) (c-string data) (size_t len) (integer64 off) (c-pointer fi)) int
   (let ((v ((current-filesystem-callback 4) (fuse_file_info_fh fi) (##sys#substring data 0 len) off)))
     (cond ((fixnum? v) v)
           ((string? v) (string-length v))
           ((callback-result v)))))
 
-(define-callback (fuse_release_callback (c-string path) (fuse_file_info fi)) int
+(define-callback (release (c-string path) (c-pointer fi)) int
   (callback-result ((current-filesystem-callback 5) (object-unevict (fuse_file_info_fh fi)))))
 
-(define-callback (fuse_access_callback (c-string path) (mode_t mode)) int
+(define-callback (access (c-string path) (int mode)) int
   (callback-result ((current-filesystem-callback 6) path mode)))
 
-(define-callback (fuse_create_callback (c-string path) (mode_t mode) (fuse_file_info fi)) int
+(define-callback (create (c-string path) (int mode) (c-pointer fi)) int
   (let ((v ((current-filesystem-callback 7) path mode)))
     (fuse_file_info_fh_set! fi (object-evict v))
     (callback-result v)))
 
-(define-callback (fuse_unlink_callback (c-string path)) int
+(define-callback (unlink (c-string path)) int
   (callback-result ((current-filesystem-callback 8) path)))
 
-(define-callback (fuse_truncate_callback (c-string path) (off_t off)) int
+(define-callback (truncate (c-string path) (integer64 off)) int
   (callback-result ((current-filesystem-callback 9) path off)))
 
-(define-callback (fuse_readlink_callback (c-string path) (c-pointer buf) (size_t len)) int
+(define-callback (readlink (c-string path) (c-pointer buf) (size_t len)) int
   (let ((r ((current-filesystem-callback 10) path)))
     (cond ((not r)
            (foreign-value "-ENOENT" int))
           (else
            (error 'readlink "Invalid result" r)))))
 
-(define-callback (fuse_symlink_callback (c-string to) (c-string from)) int
+(define-callback (symlink (c-string to) (c-string from)) int
   (callback-result ((current-filesystem-callback 11) to from)))
 
-(define-callback (fuse_mknod_callback (c-string path) (mode_t mode) (dev_t dev)) int
+(define-callback (mknod (c-string path) (int mode) (int dev)) int
   (callback-result ((current-filesystem-callback 12) path mode)))
 
-(define-callback (fuse_mkdir_callback (c-string path) (mode_t mode)) int
+(define-callback (mkdir (c-string path) (int mode)) int
   (callback-result ((current-filesystem-callback 13) path mode)))
 
-(define-callback (fuse_rmdir_callback (c-string path)) int
+(define-callback (rmdir (c-string path)) int
   (callback-result ((current-filesystem-callback 14) path)))
 
-(define-callback (fuse_rename_callback (c-string from) (c-string to)) int
+(define-callback (rename (c-string from) (c-string to)) int
   (callback-result ((current-filesystem-callback 15) from to)))
 
-(define-callback (fuse_link_callback (c-string to) (c-string from)) int
+(define-callback (link (c-string to) (c-string from)) int
   (callback-result ((current-filesystem-callback 16) to from)))
 
-(define-callback (fuse_chmod_callback (c-string path) (mode_t mode)) int
+(define-callback (chmod (c-string path) (int mode)) int
   (callback-result ((current-filesystem-callback 17) path mode)))
 
-(define-callback (fuse_chown_callback (c-string path) (uid_t uid) (gid_t gid)) int
+(define-callback (chown (c-string path) (int uid) (int gid)) int
   (callback-result ((current-filesystem-callback 18) path uid gid)))
 
-(define-callback (fuse_utimens_callback (c-string path) ((c-pointer (struct "timespec")) tv)) int ; tv[2]
+(define-callback (utimens (c-string path) (c-pointer tv)) int ; tv[2]
   (let-values (((asec msec) ; nsecs currently ignored.
                 ((foreign-primitive ((c-pointer tv))
                   "C_values(4,
                  tv)))
     (callback-result ((current-filesystem-callback 19) path asec msec))))
 
-(define-callback (fuse_statfs_callback (c-string path) ((c-pointer (struct "statvfs")) statvfs)) int
+(define-callback (statfs (c-string path) (c-pointer statvfs)) int
   (let ((v ((current-filesystem-callback 20) path)))
     (match v
       (#(bsize blocks bfree bavail files ffree namemax)
       (else
        (callback-result v)))))
 
-(define-callback (fuse_init_callback (fuse_conn_info conn)) c-pointer
+(define-callback (init (c-pointer data)) c-pointer
   (callback-protect (current-filesystem-callback 21))
-  (fuse_context_private_data (fuse_get_context)))
+  (fuse_context_private_data current-fuse-context))
 
-(define-callback (fuse_destroy_callback (c-pointer data)) void
-  ((current-filesystem-callback 22)))
+;(define-callback (destroy (c-pointer data)) void
+;  (callback-protect (current-filesystem-callback 22)))
 
 (define make-gc-root
-  (foreign-primitive ((scheme-object obj))
-#<<EOC
-  C_word rp, op[C_SIZEOF_POINTER], *pp = op, *root;
-  root = CHICKEN_new_gc_root();
-  CHICKEN_gc_root_set(root, obj);
-  rp = C_mpointer(&pp, (void *)root);
-  C_return(rp);
-EOC
-))
+  (foreign-primitive c-pointer ((scheme-object obj))
+   "C_word *root = CHICKEN_new_gc_root();"
+   "CHICKEN_gc_root_set(root, obj);"
+   "C_return(root);"))
 
 (define gc-root-ref
-  (foreign-primitive ((c-pointer root)) "C_return(CHICKEN_gc_root_ref(root));"))
-
-(define gc-root-destroy
-  (foreign-primitive ((c-pointer root)) "CHICKEN_delete_gc_root(root);"))
+  (foreign-primitive scheme-object ((c-pointer root)) "C_return(CHICKEN_gc_root_ref(root));"))
+
+(define gc-root-destroy!
+  (foreign-primitive void ((c-pointer root)) "CHICKEN_delete_gc_root(root);"))
+
+(cond-expand
+  (linux)
+  (else
+   (foreign-declare "#define fuse_loop_mt fuse_loop")
+   (foreign-declare "#define fuse_exit(_)")))
+
+#>
+
+void *fuse_loop_worker(void *fuse) {
+  sigset_t s;
+  sigemptyset(&s);
+  sigaddset(&s, SIGHUP);
+  sigaddset(&s, SIGINT);
+  sigaddset(&s, SIGTERM);
+  pthread_sigmask(SIG_BLOCK, &s, NULL);
+  fuse_loop_mt(fuse);
+  fuse_exit(fuse);
+  return NULL;
+}
+
+long start_fuse_thread(void *fuse) {
+  pthread_t t;
+  if (pthread_create(&t, NULL, fuse_loop_worker, fuse))
+    C_return(0);
+  else
+    C_return((long) t);
+}
+
+<#
+
+(define (start-fuse-thread! fuse)
+  (when (zero? ((foreign-lambda long start_fuse_thread c-pointer) fuse))
+    (error 'start-filesystem "couldn't start FUSE thread")))
 
 (define start-filesystem
   (let* ((opsize (foreign-type-size "struct fuse_operations"))
          (ops    (allocate opsize)))
-    (fuse_operations_getattr_set!  ops (location fuse_getattr_callback))
-    (fuse_operations_readdir_set!  ops (location fuse_readdir_callback))
-    (fuse_operations_open_set!     ops (location fuse_open_callback))
-    (fuse_operations_read_set!     ops (location fuse_read_callback))
-    (fuse_operations_write_set!    ops (location fuse_write_callback))
-    (fuse_operations_release_set!  ops (location fuse_release_callback))
-    (fuse_operations_access_set!   ops (location fuse_access_callback))
-    (fuse_operations_create_set!   ops (location fuse_create_callback))
-    (fuse_operations_unlink_set!   ops (location fuse_unlink_callback))
-    (fuse_operations_truncate_set! ops (location fuse_truncate_callback))
-    (fuse_operations_readlink_set! ops (location fuse_readlink_callback))
-    (fuse_operations_symlink_set!  ops (location fuse_symlink_callback))
-    (fuse_operations_mknod_set!    ops (location fuse_mknod_callback))
-    (fuse_operations_mkdir_set!    ops (location fuse_mkdir_callback))
-    (fuse_operations_rmdir_set!    ops (location fuse_rmdir_callback))
-    (fuse_operations_rename_set!   ops (location fuse_rename_callback))
-    (fuse_operations_link_set!     ops (location fuse_link_callback))
-    (fuse_operations_chmod_set!    ops (location fuse_chmod_callback))
-    (fuse_operations_chown_set!    ops (location fuse_chown_callback))
-    (fuse_operations_utimens_set!  ops (location fuse_utimens_callback))
-    (fuse_operations_statfs_set!   ops (location fuse_statfs_callback))
-    (fuse_operations_init_set!     ops (location fuse_init_callback))
-    (fuse_operations_destroy_set!  ops (location fuse_destroy_callback))
+    (fuse_operations_getattr_set!  ops (foreign-value "fuse_getattr_callback" c-pointer))
+    (fuse_operations_readdir_set!  ops (foreign-value "fuse_readdir_callback" c-pointer))
+    (fuse_operations_open_set!     ops (foreign-value "fuse_open_callback" c-pointer))
+    (fuse_operations_read_set!     ops (foreign-value "fuse_read_callback" c-pointer))
+    (fuse_operations_write_set!    ops (foreign-value "fuse_write_callback" c-pointer))
+    (fuse_operations_release_set!  ops (foreign-value "fuse_release_callback" c-pointer))
+    (fuse_operations_access_set!   ops (foreign-value "fuse_access_callback" c-pointer))
+    (fuse_operations_create_set!   ops (foreign-value "fuse_create_callback" c-pointer))
+    (fuse_operations_unlink_set!   ops (foreign-value "fuse_unlink_callback" c-pointer))
+    (fuse_operations_truncate_set! ops (foreign-value "fuse_truncate_callback" c-pointer))
+    (fuse_operations_readlink_set! ops (foreign-value "fuse_readlink_callback" c-pointer))
+    (fuse_operations_symlink_set!  ops (foreign-value "fuse_symlink_callback" c-pointer))
+    (fuse_operations_mknod_set!    ops (foreign-value "fuse_mknod_callback" c-pointer))
+    (fuse_operations_mkdir_set!    ops (foreign-value "fuse_mkdir_callback" c-pointer))
+    (fuse_operations_rmdir_set!    ops (foreign-value "fuse_rmdir_callback" c-pointer))
+    (fuse_operations_rename_set!   ops (foreign-value "fuse_rename_callback" c-pointer))
+    (fuse_operations_link_set!     ops (foreign-value "fuse_link_callback" c-pointer))
+    (fuse_operations_chmod_set!    ops (foreign-value "fuse_chmod_callback" c-pointer))
+    (fuse_operations_chown_set!    ops (foreign-value "fuse_chown_callback" c-pointer))
+    (fuse_operations_utimens_set!  ops (foreign-value "fuse_utimens_callback" c-pointer))
+    (fuse_operations_statfs_set!   ops (foreign-value "fuse_statfs_callback" c-pointer))
+    (fuse_operations_init_set!     ops (foreign-value "fuse_init_callback" c-pointer))
     (lambda (path fs)
       (and-let* ((chan  (fuse_mount path #f))
-                 (mount (make-mount fs chan (current-exception-handler)))
+                 (mount (make-mount fs false void (current-exception-handler)))
                  (root  (make-gc-root mount))
-                 (fuse  (fuse_new chan #f ops opsize root))
-                 (sess  (fuse_get_session fuse)))
-        (filesystem-mount-add! fs path mount)
-        (fuse_set_signal_handlers sess)
-        (cond-expand
-          (linux
-           (let ((size (fuse_chan_bufsize chan)))
-             (let loop ((buf (allocate size)))
-               (thread-wait-for-i/o! (fuse_chan_fd chan) #:input)
-               (unless (fuse_session_exited sess)
-                 (let-location ((chan* c-pointer chan))
-                   (let ((r (fuse_chan_recv (location chan*) buf size)))
-                     (cond ((fx= r (foreign-value "-EINTR" int))
-                            (loop buf))
-                           ((fx<= r 0)
-                            (free buf)
-                            (fuse_session_exit sess))
-                           (else
-                            (thread-start!
-                             (lambda ()
-                               (fuse_session_process sess buf r chan*)
-                               (free buf)))
-                            (loop (allocate size))))))))))
-          (else
-           (fuse_loop fuse)))
-        (fuse_remove_signal_handlers sess)
-        (fuse_unmount path chan)
-        (fuse_destroy fuse)
-        (gc-root-destroy root)
-        (filesystem-mount-delete! fs path)))))
+                 (fuse  (fuse_new chan #f ops opsize root)))
+        (handle-exceptions e
+          (begin
+            (stop-filesystem path fs)
+            (unless (join-timeout-exception? e) (raise e)))
+          (let ((d (gensym "dispatcher")))
+            (start-fuse-thread! fuse)
+            (filesystem-mount-add! fs path mount)
+            (on-exit (lambda () (stop-filesystem path fs)))
+            (mount-running-handler-set!
+             mount
+             (lambda ()
+               (not (fuse_exited fuse))))
+            (mount-shutdown-handler-set!
+             mount
+             (lambda ()
+               (dispatcher-terminate! (dispatcher d))
+               (mount-running-handler-set! mount false)
+               (mount-shutdown-handler-set! mount void)
+               (filesystem-mount-delete! fs path)
+               (fuse_exit fuse)
+               (fuse_unmount path chan)
+               (fuse_destroy fuse)
+               (gc-root-destroy! root)
+               (let ((destroy-callback
+                      (##sys#vector-ref (filesystem-operations fs) 22)))
+                 (when destroy-callback (destroy-callback)))))
+            (dispatch d)))))))
 
 (define (stop-filesystem path fs)
-  (cond-expand
-    (linux
-     (and-let* ((mount (alist-ref path (filesystem-mounts fs) string=?))
-                (chan  (mount-channel mount)))
-       (fuse_session_exit (fuse_chan_session chan))
-       ((foreign-lambda int close int) (fuse_chan_fd chan))))
-    (else))))
+  (and-let* ((mount (alist-ref path (filesystem-mounts fs) string=?)))
+    ((mount-shutdown-handler mount))))
+
+(define (filesystem-running? path fs)
+  (and-let* ((mount (alist-ref path (filesystem-mounts fs) string=?)))
+    ((mount-running-handler mount)))))
                  "This is unlikely to work.")
            (cond-expand
              (freebsd '(-lfuse -C -D_FILE_OFFSET_BITS=64 -pthread))
-             (openbsd '(-lfuse))
+             (openbsd '(-lfuse -pthread))
              ;(macosx ...) ; No clue.
-             (else    '(-lfuse -C -D_FILE_OFFSET_BITS=64))))
+             (else    '(-lfuse -C -D_FILE_OFFSET_BITS=64 -pthread))))
           (else
            (foldl (lambda (a s)
                     (if (string-prefix? "-l" s)
   (define-foreign-type mode_t "mode_t")
   (define-foreign-type fuse (c-pointer (struct "fuse")))
   (define-foreign-type fuse_args (c-pointer (struct "fuse_args")))
-  (define-foreign-type fuse_buf (c-pointer (struct "fuse_buf")))
-  (define-foreign-type fuse_bufvec (c-pointer (struct "fuse_bufvec")))
+  ;(define-foreign-type fuse_buf (c-pointer (struct "fuse_buf")))
+  ;(define-foreign-type fuse_bufvec (c-pointer (struct "fuse_bufvec")))
   (define-foreign-type fuse_chan (c-pointer (struct "fuse_chan")))
-  (define-foreign-type fuse_chan_ops (c-pointer (struct "fuse_chan_ops")))
+  ;(define-foreign-type fuse_chan_ops (c-pointer (struct "fuse_chan_ops")))
   (define-foreign-type fuse_conn_info (c-pointer (struct "fuse_conn_info")))
   (define-foreign-type fuse_session (c-pointer (struct "fuse_session")))
-  (define-foreign-type fuse_pollhandle (c-pointer (struct "fuse_pollhandle")))
+  ;(define-foreign-type fuse_pollhandle (c-pointer (struct "fuse_pollhandle")))
   (define-foreign-type fuse_fill_dir_t (function int (c-pointer (const c-string) (c-pointer (const (struct "stat"))) off_t)))
 
   ;(define-foreign-record-type (fuse_args "struct fuse_args")
 
   (define fuse_new (foreign-lambda fuse fuse_new fuse_chan fuse_args (const fuse_operations) size_t c-pointer))
   (define fuse_destroy (foreign-safe-lambda void fuse_destroy fuse))
-  (define fuse_exit (foreign-lambda void fuse_exit fuse))
   (define fuse_loop (foreign-safe-lambda int fuse_loop fuse))
   (define fuse_get_context (foreign-lambda fuse_context fuse_get_context))
   (define fuse_get_session (foreign-lambda fuse_session fuse_get_session fuse))
   ;(define fuse_interrupted (foreign-lambda bool fuse_interrupted))
   ;(define fuse_notify_poll (foreign-lambda int fuse_notify_poll fuse_pollhandle))
 
+  (cond-expand
+    (linux
+     (define fuse_exit (foreign-lambda void fuse_exit fuse))
+     (define fuse_exited (foreign-lambda bool fuse_exited fuse)))
+    (else
+     (define fuse_exit void)
+     (define fuse_exited (lambda (_) #f))))
+
   (define fuse_mount (foreign-lambda fuse_chan fuse_mount nonnull-c-string fuse_args))
   (define fuse_unmount (foreign-lambda void fuse_unmount nonnull-c-string fuse_chan))
 
   ;(define fuse_version (foreign-lambda int fuse_version))
   ;(define fuse_pollhandle_destroy (foreign-lambda void fuse_pollhandle_destroy fuse_pollhandle))
 
-  ;(define fuse_loop_mt (foreign-safe-lambda int fuse_loop_mt fuse))
+  (define fuse_loop_mt (foreign-safe-lambda int fuse_loop_mt fuse))
   ;(define fuse_start_cleanup_thread (foreign-lambda int fuse_start_cleanup_thread fuse))
   ;(define fuse_start_cleanup_thread (foreign-lambda void fuse_stop_cleanup_thread fuse))
   ;(define fuse_clean_cache (foreign-lambda int fuse_clean_cache fuse))
 
   ;(define fuse_chan_new (foreign-lambda fuse_chan fuse_chan_new fuse_chan_ops int size_t c-pointer))
   (define fuse_chan_fd (foreign-lambda int fuse_chan_fd fuse_chan))
-  (define fuse_chan_bufsize (foreign-lambda size_t fuse_chan_bufsize fuse_chan))
-  (define fuse_chan_session (foreign-lambda fuse_session fuse_chan_session fuse_chan))
-  (define fuse_chan_recv (foreign-lambda int fuse_chan_recv (c-pointer fuse_chan) c-pointer size_t))
+  ;(define fuse_chan_bufsize (foreign-lambda size_t fuse_chan_bufsize fuse_chan))
+  ;(define fuse_chan_session (foreign-lambda fuse_session fuse_chan_session fuse_chan))
+  ;(define fuse_chan_recv (foreign-lambda int fuse_chan_recv (c-pointer fuse_chan) c-pointer size_t))
   ;(define fuse_chan_send (foreign-lambda int fuse_chan_send fuse_chan (c-pointer (struct "iovec")) size_t))
   ;(define fuse_chan_destroy (foreign-lambda void fuse_chan_destroy fuse_chan))
 
   ;(define fuse_session_add_chan (foreign-lambda void fuse_session_add_chan fuse_session fuse_chan))
   ;(define fuse_session_remove_chan (foreign-lambda void fuse_session_remove_chan fuse_chan))
   ;(define fuse_session_next_chan (foreign-lambda fuse_chan fuse_session_next_chan fuse_session fuse_chan))
-  (define fuse_session_process (foreign-safe-lambda void fuse_session_process fuse_session c-pointer size_t fuse_chan))
+  ;(define fuse_session_process (foreign-safe-lambda void fuse_session_process fuse_session c-pointer size_t fuse_chan))
   ;(define fuse_session_process_buf (foreign-lambda void fuse_session_process_buf fuse_session (const fuse_buf) fuse_chan))
   ;(define fuse_session_receive_buf (foreign-lambda int fuse_session_receive_buf fuse_session fuse_buf (c-pointer fuse_chan)))
   ;(define fuse_session_destroy (foreign-lambda void fuse_session_destroy fuse_session))
-  (define fuse_session_exit (foreign-lambda void fuse_session_exit fuse_session))
+  ;(define fuse_session_exit (foreign-lambda void fuse_session_exit fuse_session))
   ;(define fuse_session_reset (foreign-lambda void fuse_session_reset fuse_session))
-  (define fuse_session_exited (foreign-lambda bool fuse_session_exited fuse_session))
+  ;(define fuse_session_exited (foreign-lambda bool fuse_session_exited fuse_session))
   ;(define fuse_session_data (foreign-lambda c-pointer fuse_session_data fuse_session))
   ;(define fuse_session_loop (foreign-safe-lambda int fuse_session_loop fuse_session))