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.

Seeking for Perl wisdom...on the process of learning...not there...yet!

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

    What are you doing to get your error? I don't get it when I run it.

    Unfortunately, neither your script nor any examples at dpavlin/perl-fuse use the 'init' callback, so there is no demonstration of how to use it. I may be using it incorrectly but.. I doubt it, because it works on the first call of fuse_get_context().

    I may see if I can get in contact with the author and direct them here. I've had a look but I don't see any unit tests for it either, which might explain why the issue has been missed.

    In the meantime, I think I shall just use the wrapping method as most of it is coded (longhandedly, bleh!) anyway..

    Once again, thank you for your time and efforts to help!

      Hello Anonymous Monk,

      Let me show you a complete error output, maybe you can see something that I am missing.

      Debug:

      The script is the one that I posted above, the only modification is this:

      my $mountpoint = "/home/thanos/test_fuse"; #$mountpoint = $ARGV[1] or die "You forgot to provide the mountpoint!\ +n";

      I am running on:

      Linux OS 3.13.0-38-generic #65-Ubuntu SMP Thu Oct 9 11:36:50 UTC 2014 +x86_64 x86_64 x86_64 GNU/Linux

      Perl Version:

      This is perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-li +nux-gnu-thread-multi

      Hope this gives more information in possible representation of error. If you have any possible thoughts on how to get over this error please let me know. Thanks in advance.

      Seeking for Perl wisdom...on the process of learning...not there...yet!

        I'm not sure what you are regarding to be an error..

        "Function not implemented" is returned by the Fuse module by default if you don't provide a callback for that function, which you haven't done (it would be handled by Fuse::main (getdir => ...);