From 3d7bec80d55d854d9fb3c25ffb199b8bcb2e4ae4 Mon Sep 17 00:00:00 2001 From: Harvie Date: Thu, 24 May 2012 02:02:24 +0200 Subject: [PATCH] Filesystem example in pure fuse --- perl/fuse/fs3.pl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 perl/fuse/fs3.pl diff --git a/perl/fuse/fs3.pl b/perl/fuse/fs3.pl new file mode 100755 index 0000000..e9a1f28 --- /dev/null +++ b/perl/fuse/fs3.pl @@ -0,0 +1,25 @@ +#!/usr/bin/env perl + +use Fuse; + +#use JSON; +#print encode_json {}; + +my ($mountpoint) = ""; +$mountpoint = shift(@ARGV) if @ARGV; +Fuse::main(mountpoint=>$mountpoint, getattr=>"main::my_getattr", getdir=>"main::my_getdir"); + +sub my_getattr { + #($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) + #return (1,1,0777,1,0,0,1,1,1,1,1,1,1); + my ($size) = 1024; + my ($modes) = (0040<<9) + 0755; #dir=0040, file=0100 + my ($dev, $ino, $rdev, $blocks, $gid, $uid, $nlink, $blksize) = (0,0,0,1,0,0,1,1024); + my ($atime, $ctime, $mtime); + $atime = $ctime = $mtime = 666666; + return ($dev,$ino,$modes,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks); +} + +sub my_getdir { + return ('.', 'a', 'b', 0); +} -- 2.30.2