added blib, create /tmp/fusetest-$ENV{LOGNAME} (from directory for loopback) if it...
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 2 Jan 2006 20:31:19 +0000 (20:31 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 2 Jan 2006 20:31:19 +0000 (20:31 +0000)
exist. mounted directory will be empty when mounted.

git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/fuse/perl-llin@23 6e4b0b00-1209-0410-87b2-b275959b5705

examples/loopback.pl

index dd3fe15..7a88876 100644 (file)
@@ -1,13 +1,19 @@
 #!/usr/bin/perl -w
 use strict;
 
+use blib;
 use Fuse;
 use IO::File;
 use POSIX qw(ENOENT ENOSYS EEXIST EPERM O_RDONLY O_RDWR O_APPEND O_CREAT);
 use Fcntl qw(S_ISBLK S_ISCHR S_ISFIFO SEEK_SET);
 require 'syscall.ph'; # for SYS_mknod and SYS_lchown
 
-sub fixup { return "/tmp/fusetest-" . $ENV{LOGNAME} . shift }
+my $tmp_path = "/tmp/fusetest-" . $ENV{LOGNAME};
+if (! -e $tmp_path) {
+       mkdir($tmp_path) || die "can't create $tmp_path: $!";
+}
+
+sub fixup { return $tmp_path . shift }
 
 sub x_getattr {
        my ($file) = fixup(shift);
@@ -133,4 +139,5 @@ Fuse::main(
        write   =>"main::x_write",
        statfs  =>"main::x_statfs",
        threaded=>0,
+       debug => 1,
 );