From: Harvie Date: Thu, 24 May 2012 00:02:24 +0000 (+0200) Subject: Filesystem example in pure fuse X-Git-Url: http://git.harvie.cz/?p=mirrors%2FPrograms.git;a=commitdiff_plain;h=3d7bec80d55d854d9fb3c25ffb199b8bcb2e4ae4 Filesystem example in pure fuse --- 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); +}