Added statfs support to kernel, lib, examples, and perl

other minor perl fixes (still unstable)
diff --git a/lib/fuse.c b/lib/fuse.c
index 98bab3f..88f3eae 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -306,6 +306,16 @@
     attr->_dummy  = 4096;
 }
 
+static void convert_statfs(struct statfs *st, struct fuse_statfs *fst)
+{
+    fst->block_size  = st->f_bsize;
+    fst->blocks      = st->f_blocks;
+    fst->blocks_free = st->f_bavail;
+    fst->files       = st->f_files;
+    fst->files_free  = st->f_ffree;
+    fst->namelen     = st->f_namelen;
+}
+
 static int fill_dir(struct fuse_dirhandle *dh, char *name, int type)
 {
     struct fuse_dirent dirent;
@@ -793,6 +803,20 @@
     send_reply(f, in, res, NULL, 0);
 }
 
+static void do_statfs(struct fuse *f, struct fuse_in_header *in)
+{
+    int res;
+    struct statfs sbuf;
+    struct fuse_statfs_out arg;
+
+    res = -ENOSYS;
+    if(f->op.statfs)
+        res = f->op.statfs(&sbuf);
+    if(!res)
+        convert_statfs(&sbuf,&arg.st);
+    send_reply(f, in, res, &arg, sizeof(arg));
+}
+
 static void free_cmd(struct fuse_cmd *cmd)
 {
     free(cmd->buf);
@@ -878,6 +902,10 @@
         do_write(f, in, (struct fuse_write_in *) inarg);
         break;
 
+    case FUSE_STATFS:
+        do_statfs(f, in);
+        break;
+
     default:
         fprintf(stderr, "Operation %i not implemented\n", in->opcode);
         send_reply(f, in, -ENOSYS, NULL, 0);