in reply to Re^2: FUSE, fuse_get_context and private = dangling pointer woes
in thread FUSE, fuse_get_context and private = dangling pointer woes
Hello CandyAngel,
First of all sorry for the late reply I got busy with something else and I just found a few hours to spend with this script.
I am afraid that I can not be much of assistance with your problem. No matter what I tried I was not able to make my sample script to work.
I keep getting this error:
unique: 71, opcode: RELEASEDIR (29), nodeid: 1, insize: 64, pid: 0 unique: 71, success, outsize: 16 unique: 72, opcode: LOOKUP (1), nodeid: 1, insize: 52, pid: 26177 LOOKUP /autorun.inf unique: 72, error: -38 (Function not implemented), outsize: 16
Where it gets stack, for some unknown reason to me. I tried anything that could come to my mind but so far I did not find a solution to this problem.
But I found some example codes, that might give a few ideas to experiment with or play around with your code. Take a look here dpavlin/perl-fuse if you have not done it yet.
This is a sample of my code that I was trying to make it work, just in case that can help you by any means.
#!/usr/bin/perl use Fuse; use strict; use warnings; use threads::shared; use Fuse "fuse_get_context"; use POSIX "ENOENT"; my (%files) = ( 'thanos' => { type => 0040, mode => 0755, ctime => time()-1000 } ); sub filename_fixup { my ($file) = shift; $file =~ s,^/,,; $file = '.' unless length($file); return $file; } sub e_getattr { my ($file) = filename_fixup(shift); $file =~ s,^/,,; $file = '.' unless length($file); return -ENOENT() unless exists($files{$file}); my ($size) = exists($files{$file}{cont}) ? length($files{$file}{co +nt}) : 0; $size = $files{$file}{size} if exists $files{$file}{size}; my ($modes) = ($files{$file}{type}<<9) + $files{$file}{mode}; my ($dev, $ino, $rdev, $blocks, $gid, $uid, $nlink, $blksize) = (0 +,0,0,1,0,0,1,1024); my ($atime, $ctime, $mtime); $atime = $ctime = $mtime = $files{$file}{ctime}; # 2 possible types of return values: #return -ENOENT(); # or any other error you care to #print(join(",",($dev,$ino,$modes,$nlink,$uid,$gid,$rdev,$size,$at +ime,$mtime,$ctime,$blksize,$blocks)),"\n"); return ($dev,$ino,$modes,$nlink,$uid,$gid,$rdev,$size,$atime,$mtim +e,$ctime,$blksize,$blocks); } sub e_getdir { # return as many text filenames as you like, followed by the retva +l. print((scalar keys %files)."\n"); return (keys %files),0; } my $mountpoint = ""; $mountpoint = $ARGV[1] or die "You forgot to provide the mountpoint!\n +"; #$mountpoint = shift(@ARGV) if @ARGV; croak("Fuse doesn't have ioctl") unless Fuse::fuse_version() >= 2.8; Fuse::main( debug => 1, mountpoint => $mountpoint, mountopts => "", # if 'user_allow_other' in /etc/fuse.conf as per + the FUSE documention threaded => 0, getattr => "main::e_getattr", #getdir => "main::e_getdir", #open => "main::e_open", #statfs => "main::e_statfs", #read => "main::e_read", );
Just in case that you faced the same problem with me and you found a solution, let me know how you worked your way out of it. Any way, I hope by now you have solved your problems alternatively I am sure the examples will give you a few hints. Best of luck with your script.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: FUSE, fuse_get_context and private = dangling pointer woes
by Anonymous Monk on Oct 11, 2014 at 02:01 UTC | |
by thanos1983 (Parson) on Oct 11, 2014 at 10:57 UTC | |
by CandyAngel (Initiate) on Oct 13, 2014 at 23:50 UTC |