;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; ;;; hellofs.scm - CHICKEN fuse example (hello world). ;;; ;;; http://fuse.sourceforge.net/helloworld.html ;;; ;;; To run: ;;; ;;; $ csc hellofs.scm ;;; $ ./hellofs ;;; ;;; Ctrl-C or `fusermount -u ` will exit the filesystem loop. ;;; (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) (start-filesystem path fs)) (command-line-arguments))