;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; hellofs.scm - CHICKEN fuse example (hello world). ;;; ;;; http://fuse.sourceforge.net/helloworld.html ;;; ;;; To run: ;;; ;;; $ csc hellofs.scm ;;; $ ./hellofs ;;; (use fuse posix) (define hello "Hello world!\n") (define fs (make-filesystem getattr: (lambda (path) (let ((tm (current-seconds))) (cond ((string=? path "/") (vector (bitwise-ior file/dir perm/irusr perm/iwusr perm/ixusr) 2 (current-user-id) (current-group-id) 0 tm tm tm)) ((string=? path "/hello") (vector (bitwise-ior file/reg perm/irusr perm/iwusr perm/ixusr) 1 (current-user-id) (current-group-id) (string-length hello) tm tm tm)) (else (raise errno/noent))))) readdir: (lambda (path) (and (string=? path "/") '("." ".." "hello"))) open: (lambda (path mode) (string=? path "/hello")) read: (lambda (path size offset) (let ((len (string-length hello))) (if (>= offset len) 0 (substring hello offset (min size (- len offset)))))))) (for-each (lambda (path) (set-signal-handler! signal/int (lambda (_) (filesystem-stop! path fs))) (filesystem-start! path fs) (filesystem-wait! path fs)) (command-line-arguments))