5 |
use warnings; |
use warnings; |
6 |
use Errno; |
use Errno; |
7 |
use Carp; |
use Carp; |
8 |
|
use Config; |
9 |
|
|
10 |
require Exporter; |
require Exporter; |
11 |
require DynaLoader; |
require DynaLoader; |
21 |
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
22 |
# will save memory. |
# will save memory. |
23 |
our %EXPORT_TAGS = ( |
our %EXPORT_TAGS = ( |
24 |
'all' => [ qw(FUSE_DEBUG XATTR_CREATE XATTR_REPLACE) ], |
'all' => [ qw(XATTR_CREATE XATTR_REPLACE) ], |
|
'debug' => [ qw(FUSE_DEBUG) ], |
|
25 |
'xattr' => [ qw(XATTR_CREATE XATTR_REPLACE) ] |
'xattr' => [ qw(XATTR_CREATE XATTR_REPLACE) ] |
26 |
); |
); |
27 |
|
|
28 |
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
29 |
|
|
30 |
our @EXPORT = qw( |
our @EXPORT = (); |
31 |
FUSE_DEBUG |
our $VERSION = '0.08'; |
|
); |
|
|
our $VERSION = '0.06'; |
|
32 |
|
|
33 |
sub AUTOLOAD { |
sub AUTOLOAD { |
34 |
# This AUTOLOAD is used to 'autoload' constants from the constant() |
# This AUTOLOAD is used to 'autoload' constants from the constant() |
75 |
bootstrap Fuse $VERSION; |
bootstrap Fuse $VERSION; |
76 |
|
|
77 |
sub main { |
sub main { |
78 |
my (@subs) = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); |
my @names = qw(getattr readlink getdir mknod mkdir unlink rmdir symlink |
79 |
my (@names) = qw(getattr readlink getdir mknod mkdir unlink rmdir symlink |
rename link chmod chown truncate utime open read write statfs |
80 |
rename link chmod chown truncate utime open read write statfs |
flush release fsync setxattr getxattr listxattr removexattr); |
81 |
flush release fsync setxattr getxattr listxattr removexattr); |
my @subs = map {undef} @names; |
82 |
my (@validOpts) = qw(allow_other); |
my @validOpts = qw(ro allow_other default_permissions fsname use_ino nonempty); |
83 |
my ($tmp) = 0; |
my $tmp = 0; |
84 |
my (%mapping) = map { $_ => $tmp++ } (@names); |
my %mapping = map { $_ => $tmp++ } @names; |
85 |
my (%optmap) = map { $_ => 1 } (@validOpts); |
my %optmap = map { $_ => 1 } @validOpts; |
86 |
my (%otherargs) = (debug=>0, threaded=>0, mountpoint=>"", mountopts=>""); |
my @otherargs = qw(debug threaded mountpoint mountopts); |
87 |
|
my %otherargs = (debug=>0, threaded=>0, mountpoint=>"", mountopts=>""); |
88 |
while(my $name = shift) { |
while(my $name = shift) { |
89 |
my ($subref) = shift; |
my ($subref) = shift; |
90 |
if(exists($otherargs{$name})) { |
if(exists($otherargs{$name})) { |
95 |
$subs[$mapping{$name}] = $subref; |
$subs[$mapping{$name}] = $subref; |
96 |
} |
} |
97 |
} |
} |
98 |
foreach my $opt ( split(/,/,$otherargs{mountopts}) ) { |
foreach my $opt ( map {m/^([^=]*)/; $1} split(/,/,$otherargs{mountopts}) ) { |
99 |
if ( ! exists($optmap{$opt}) ) { |
next if exists($optmap{$opt}); |
100 |
croak "Use of an invalid mountopt argument"; |
croak "Fuse::main: invalid '$opt' argument in mountopts"; |
101 |
} |
} |
102 |
} |
if($otherargs{threaded}) { |
103 |
perl_fuse_main($otherargs{debug},$otherargs{threaded},$otherargs{mountpoint},$otherargs{mountopts},@subs); |
# make sure threads are both available, and loaded. |
104 |
|
if($Config{useithreads}) { |
105 |
|
if(exists($threads::{VERSION})) { |
106 |
|
if(exists($threads::shared::{VERSION})) { |
107 |
|
# threads will work. |
108 |
|
} else { |
109 |
|
carp("Thread support requires you to use threads::shared.\nThreads are disabled.\n"); |
110 |
|
$otherargs{threaded} = 0; |
111 |
|
} |
112 |
|
} else { |
113 |
|
carp("Thread support requires you to use threads and threads::shared.\nThreads are disabled.\n"); |
114 |
|
$otherargs{threaded} = 0; |
115 |
|
} |
116 |
|
} else { |
117 |
|
carp("Thread support was not compiled into this build of perl.\nThreads are disabled.\n"); |
118 |
|
$otherargs{threaded} = 0; |
119 |
|
} |
120 |
|
} |
121 |
|
perl_fuse_main(@otherargs{@otherargs},@subs); |
122 |
} |
} |
123 |
|
|
124 |
# Autoload methods go after =cut, and are processed by the autosplit program. |
# Autoload methods go after =cut, and are processed by the autosplit program. |
156 |
|
|
157 |
=head2 EXPORTED SYMBOLS |
=head2 EXPORTED SYMBOLS |
158 |
|
|
159 |
FUSE_DEBUG by default. |
None by default. |
160 |
|
|
161 |
You can request all exportable symbols by using the tag ":all". |
You can request all exportable symbols by using the tag ":all". |
162 |
|
|
|
You can request all debug symbols by using the tag ":debug". |
|
|
This will export FUSE_DEBUG. |
|
|
|
|
163 |
You can request the extended attribute symbols by using the tag ":xattr". |
You can request the extended attribute symbols by using the tag ":xattr". |
164 |
This will export XATTR_CREATE and XATTR_REPLACE. |
This will export XATTR_CREATE and XATTR_REPLACE. |
165 |
|
|
229 |
you're using are also thread-safe. |
you're using are also thread-safe. |
230 |
|
|
231 |
(If enabled, this option will cause a warning if your perl interpreter was not |
(If enabled, this option will cause a warning if your perl interpreter was not |
232 |
built with USE_ITHREADS.) |
built with USE_ITHREADS, or if you have failed to use threads or |
233 |
|
threads::shared.) |
234 |
|
|
235 |
=back |
=back |
236 |
|
|