Welcome to the CHICKEN Scheme pasting service

Chicken as a filesystem pasted by alaricsp on Mon Apr 23 22:54:17 2012

(define filesystem (new-filesystem
                    (+ perm/irusr perm/ixusr perm/irgrp perm/ixgrp perm/iroth perm/ixoth)
                    "root"
                    "root"
                    0
                    0))

(insert-file! filesystem
              qtfile
              "hello"
              (+ perm/irusr perm/ixusr perm/irgrp perm/ixgrp perm/iroth perm/ixoth)
              "root"
              "root"
              "root"
              #f
              0
              0
              (lambda (file) "Hello, world!")
              0)

...

[alaric@ahu ~]$ sudo mount -t 9p 127.0.0.1 /mnt/tmp2 -o port=1564
Password: 
[alaric@ahu ~]$ cat /mnt/tmp2/hello
Hello, world![alaric@ahu ~]$ 

How fids are handled by the server added by alaricsp on Mon Apr 23 23:05:59 2012

(define (handle-attach message auth-fid-value bind-fid! reply! error!)
  (dump-message-fid 'Tattach message auth-fid-value)
  (let ((root (filesystem-root filesystem)))
   (bind-fid! root)
   (reply! (list (file-qid root)))))

...and the value passed to bind-fid! comes back to later handlers as a fid-value like so:

(define (handle-open message fid-value reply! error!)
  (dump-message-fid 'Topen message fid-value)
  ;; FIXME: Check permissions, and have a hashtable in the filesystem
  ;; that maps a (session, file id) pair to an open-state in which to store
  ;; anything we need, and expose it to extra per-file handlers.
  (reply! (list (file-qid fid-value) +block-size+)))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What does `(string-chomp "foobar")' produce?
Visually impaired? Let me spell it for you (wav file) download WAV