Changeset 27841 in project


Ignore:
Timestamp:
11/17/12 07:03:06 (7 years ago)
Author:
Ivan Raikov
Message:

fuse: some more hacking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/fuse/trunk/fuse.scm

    r27813 r27841  
    5252(define fuse-get-session (foreign-safe-lambda c-pointer "fuse_get_session" c-pointer))
    5353(define fuse-session-next-chan (foreign-safe-lambda c-pointer "fuse_session_next_chan" c-pointer c-pointer))
     54(define fuse-chan-bufsize (foreign-safe-lambda unsigned-int "fuse_chan_bufsize" c-pointer))
     55(define fuse-chan-recv  (foreign-safe-lambda unsigned-int "fuse_chan_recv" c-pointer c-pointer unsigned-int))
    5456
     57;; TODO
     58;;  se->op.process(se->data, buf, len, ch);
     59(define fuse-session-process  (foreign-safe-lambda unsigned-int "fuse_call_session_process" c-pointer c-pointer unsigned-int c-pointer))
    5560
    5661(define fmount (foreign-safe-lambda void "chicken_fuse_mount" scheme-object scheme-object scheme-object))
    5762
    58 ;; TODO mt-support: fuse-session-process  fuse-chan-recv  fuse-chan-bufsize 
    59 
    60 (define (fuse-session-process se buf res ch)
    61   (begin))
    62 
    63 (define (fuse-chan-recv ch buf bufsize)
    64   (begin))
    65 
    66 (define (fuse-chan-bufsize ch)
    67   0)
     63(define max-threads (make-parameter 10))
    6864
    6965(define thread-alive?
     
    7773(define fuse-mutex (make-mutex))
    7874
    79 (define fuse-threads (make-parameter '()))
     75(define fuse-threads '())
    8076
    8177(define (new-thread se ch)
     
    8480                        (buf     (allocate bufsize)))
    8581                   ;; TODO: check for unmounted file system
    86                    (let ((res (fuse-chan-recv ch buf bufsize)))
    87                      (fuse-session-process se buf res ch))))))
     82                   (let ((actual-size (fuse-chan-recv ch buf bufsize)))
     83                     (let ((status (fuse-session-process se buf actual-size ch)))
     84                       (free buf)
     85                       status
     86                       ))
     87                   ))
     88               ))
    8889    (let ((t (make-thread thunk)))
    8990      t)))
     
    123124            (join-threads)
    124125            (mutex-lock! fuse-mutex)
    125             (if (< (length fuse-threads) 10)
     126            (if (< (length fuse-threads) (max-threads))
    126127                (let ((t (new-thread se ch)))
    127128                  (set! fuse-threads (cons t fuse-threads))
Note: See TracChangeset for help on using the changeset viewer.