19 |
# This allows declaration use Fuse ':all'; |
# This allows declaration use Fuse ':all'; |
20 |
# 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 |
21 |
# will save memory. |
# will save memory. |
22 |
our %EXPORT_TAGS = ( 'all' => [ qw( |
our %EXPORT_TAGS = ( |
23 |
FUSE_DEBUG |
'all' => [ qw(FUSE_DEBUG XATTR_CREATE XATTR_REPLACE) ], |
24 |
) ] ); |
'debug' => [ qw(FUSE_DEBUG) ], |
25 |
|
'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 = qw( |
31 |
FUSE_DEBUG |
FUSE_DEBUG |
32 |
); |
); |
33 |
our $VERSION = '0.04'; |
our $VERSION = '0.06'; |
34 |
|
|
35 |
sub AUTOLOAD { |
sub AUTOLOAD { |
36 |
# This AUTOLOAD is used to 'autoload' constants from the constant() |
# This AUTOLOAD is used to 'autoload' constants from the constant() |
64 |
goto &$AUTOLOAD; |
goto &$AUTOLOAD; |
65 |
} |
} |
66 |
|
|
67 |
|
sub XATTR_CREATE { |
68 |
|
# See <sys/xattr.h>. |
69 |
|
return 1; |
70 |
|
} |
71 |
|
|
72 |
|
sub XATTR_REPLACE { |
73 |
|
# See <sys/xattr.h>. |
74 |
|
return 2; |
75 |
|
} |
76 |
|
|
77 |
bootstrap Fuse $VERSION; |
bootstrap Fuse $VERSION; |
78 |
|
|
79 |
sub main { |
sub main { |
80 |
my (@subs) = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); |
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); |
81 |
my (@names) = qw(getattr readlink getdir mknod mkdir unlink rmdir symlink |
my (@names) = qw(getattr readlink getdir mknod mkdir unlink rmdir symlink |
82 |
rename link chmod chown truncate utime open read write statfs); |
rename link chmod chown truncate utime open read write statfs |
83 |
|
flush release fsync setxattr getxattr listxattr removexattr); |
84 |
|
my (@validOpts) = qw(allow_other); |
85 |
my ($tmp) = 0; |
my ($tmp) = 0; |
86 |
my (%mapping) = map { $_ => $tmp++ } (@names); |
my (%mapping) = map { $_ => $tmp++ } (@names); |
87 |
my (%otherargs) = (debug=>0, mountpoint=>""); |
my (%optmap) = map { $_ => 1 } (@validOpts); |
88 |
|
my (%otherargs) = (debug=>0, mountpoint=>"", mountopts=>""); |
89 |
while(my $name = shift) { |
while(my $name = shift) { |
90 |
my ($subref) = shift; |
my ($subref) = shift; |
91 |
if(exists($otherargs{$name})) { |
if(exists($otherargs{$name})) { |
98 |
$subs[$mapping{$name}] = $subref; |
$subs[$mapping{$name}] = $subref; |
99 |
} |
} |
100 |
} |
} |
101 |
perl_fuse_main($otherargs{debug},$otherargs{mountpoint},@subs); |
foreach my $opt ( split(/,/,$otherargs{mountopts}) ) { |
102 |
|
if ( ! exists($optmap{$opt}) ) { |
103 |
|
croak "Use of an invalid mountopt argument"; |
104 |
|
} |
105 |
|
} |
106 |
|
perl_fuse_main($otherargs{debug},$otherargs{mountpoint},$otherargs{mountopts},@subs); |
107 |
} |
} |
108 |
|
|
109 |
# Autoload methods go after =cut, and are processed by the autosplit program. |
# Autoload methods go after =cut, and are processed by the autosplit program. |
142 |
etc) can be imported either from POSIX or from Fcntl, often both. |
etc) can be imported either from POSIX or from Fcntl, often both. |
143 |
See their respective documentations, for more information. |
See their respective documentations, for more information. |
144 |
|
|
145 |
=head2 EXPORT |
=head2 EXPORTED SYMBOLS |
146 |
|
|
147 |
None by default. |
FUSE_DEBUG by default. |
148 |
|
|
149 |
=head2 EXPORTABLE CONSTANTS |
You can request all exportable symbols by using the tag ":all". |
150 |
|
|
151 |
None. |
You can request all debug symbols by using the tag ":debug". |
152 |
|
This will export FUSE_DEBUG. |
153 |
|
|
154 |
|
You can request the extended attribute symbols by using the tag ":xattr". |
155 |
|
This will export XATTR_CREATE and XATTR_REPLACE. |
156 |
|
|
157 |
=head2 FUNCTIONS |
=head2 FUNCTIONS |
158 |
|
|
181 |
|
|
182 |
=back |
=back |
183 |
|
|
184 |
|
mountopts => string |
185 |
|
|
186 |
|
=over 1 |
187 |
|
|
188 |
|
This is a comma seperated list of mount options to pass to the FUSE kernel |
189 |
|
module. |
190 |
|
|
191 |
|
At present, it allows the specification of the allow_other |
192 |
|
argument when mounting the new FUSE filesystem. To use this, you will also |
193 |
|
need 'user_allow_other' in /etc/fuse.conf as per the FUSE documention |
194 |
|
|
195 |
|
mountopts => "allow_other" or |
196 |
|
mountopts => "" |
197 |
|
|
198 |
|
=back |
199 |
|
|
200 |
unthreaded => boolean |
unthreaded => boolean |
201 |
|
|
202 |
=over 1 |
=over 1 |
389 |
|
|
390 |
-ENOANO(), $namelen, $files, $files_free, $blocks, $blocks_avail, $blocksize |
-ENOANO(), $namelen, $files, $files_free, $blocks, $blocks_avail, $blocksize |
391 |
|
|
392 |
|
=head3 flush |
393 |
|
|
394 |
|
Arguments: Pathname |
395 |
|
Returns an errno or 0 on success. |
396 |
|
|
397 |
|
Called to synchronise any cached data. This is called before the file |
398 |
|
is closed. It may be called multiple times before a file is closed. |
399 |
|
|
400 |
|
=head3 release |
401 |
|
|
402 |
|
Arguments: Pathname, numeric flags passed to open |
403 |
|
Returns an errno or 0 on success. |
404 |
|
|
405 |
|
Called to indicate that there are no more references to the file. Called once |
406 |
|
for every file with the same pathname and flags as were passed to open. |
407 |
|
|
408 |
|
=head3 fsync |
409 |
|
|
410 |
|
Arguments: Pathname, numeric flags |
411 |
|
Returns an errno or 0 on success. |
412 |
|
|
413 |
|
Called to synchronise the file's contents. If flags is non-zero, |
414 |
|
only synchronise the user data. Otherwise synchronise the user and meta data. |
415 |
|
|
416 |
|
=head3 setxattr |
417 |
|
|
418 |
|
Arguments: Pathname, extended attribute's name, extended attribute's value, numeric flags (which is an OR-ing of XATTR_CREATE and XATTR_REPLACE |
419 |
|
Returns an errno or 0 on success. |
420 |
|
|
421 |
|
Called to set the value of the named extended attribute. |
422 |
|
|
423 |
|
If you wish to reject setting of a particular form of extended attribute name |
424 |
|
(e.g.: regexps matching user\..* or security\..*), then return - EOPNOTSUPP. |
425 |
|
|
426 |
|
If flags is set to XATTR_CREATE and the extended attribute already exists, |
427 |
|
this should fail with - EEXIST. If flags is set to XATTR_REPLACE |
428 |
|
and the extended attribute doesn't exist, this should fail with - ENOATTR. |
429 |
|
|
430 |
|
XATTR_CREATE and XATTR_REPLACE are provided by this module, but not exported |
431 |
|
by default. To import them: |
432 |
|
|
433 |
|
use Fuse ':xattr'; |
434 |
|
|
435 |
|
or: |
436 |
|
|
437 |
|
use Fuse ':all'; |
438 |
|
|
439 |
|
=head3 getxattr |
440 |
|
|
441 |
|
Arguments: Pathname, extended attribute's name |
442 |
|
Returns an errno, 0 if there was no value, or the extended attribute's value. |
443 |
|
|
444 |
|
Called to get the value of the named extended attribute. |
445 |
|
|
446 |
|
=head3 listxattr |
447 |
|
|
448 |
|
Arguments: Pathname |
449 |
|
Returns a list: 0 or more text strings (the extended attribute names), followed by a numeric errno (usually 0). |
450 |
|
|
451 |
|
=head3 removexattr |
452 |
|
|
453 |
|
Arguments: Pathname, extended attribute's name |
454 |
|
Returns an errno or 0 on success. |
455 |
|
|
456 |
=head1 AUTHOR |
=head1 AUTHOR |
457 |
|
|
458 |
Mark Glines, E<lt>mark@glines.orgE<gt> |
Mark Glines, E<lt>mark@glines.orgE<gt> |