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.05'; |
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 ($tmp) = 0; |
my ($tmp) = 0; |
85 |
my (%mapping) = map { $_ => $tmp++ } (@names); |
my (%mapping) = map { $_ => $tmp++ } (@names); |
86 |
my (%otherargs) = (debug=>0, mountpoint=>""); |
my (%otherargs) = (debug=>0, mountpoint=>""); |
135 |
etc) can be imported either from POSIX or from Fcntl, often both. |
etc) can be imported either from POSIX or from Fcntl, often both. |
136 |
See their respective documentations, for more information. |
See their respective documentations, for more information. |
137 |
|
|
138 |
=head2 EXPORT |
=head2 EXPORTED SYMBOLS |
139 |
|
|
140 |
|
FUSE_DEBUG by default. |
141 |
|
|
142 |
None by default. |
You can request all exportable symbols by using the tag ":all". |
143 |
|
|
144 |
=head2 EXPORTABLE CONSTANTS |
You can request all debug symbols by using the tag ":debug". |
145 |
|
This will export FUSE_DEBUG. |
146 |
|
|
147 |
None. |
You can request the extended attribute symbols by using the tag ":xattr". |
148 |
|
This will export XATTR_CREATE and XATTR_REPLACE. |
149 |
|
|
150 |
=head2 FUNCTIONS |
=head2 FUNCTIONS |
151 |
|
|
366 |
|
|
367 |
-ENOANO(), $namelen, $files, $files_free, $blocks, $blocks_avail, $blocksize |
-ENOANO(), $namelen, $files, $files_free, $blocks, $blocks_avail, $blocksize |
368 |
|
|
369 |
|
=head3 flush |
370 |
|
|
371 |
|
Arguments: Pathname |
372 |
|
Returns an errno or 0 on success. |
373 |
|
|
374 |
|
Called to synchronise any cached data. This is called before the file |
375 |
|
is closed. It may be called multiple times before a file is closed. |
376 |
|
|
377 |
|
=head3 release |
378 |
|
|
379 |
|
Arguments: Pathname, numeric flags passed to open |
380 |
|
Returns an errno or 0 on success. |
381 |
|
|
382 |
|
Called to indicate that there are no more references to the file. Called once |
383 |
|
for every file with the same pathname and flags as were passed to open. |
384 |
|
|
385 |
|
=head3 fsync |
386 |
|
|
387 |
|
Arguments: Pathname, numeric flags |
388 |
|
Returns an errno or 0 on success. |
389 |
|
|
390 |
|
Called to synchronise the file's contents. If flags is non-zero, |
391 |
|
only synchronise the user data. Otherwise synchronise the user and meta data. |
392 |
|
|
393 |
|
=head3 setxattr |
394 |
|
|
395 |
|
Arguments: Pathname, extended attribute's name, extended attribute's value, numeric flags (which is an OR-ing of XATTR_CREATE and XATTR_REPLACE |
396 |
|
Returns an errno or 0 on success. |
397 |
|
|
398 |
|
Called to set the value of the named extended attribute. |
399 |
|
|
400 |
|
If you wish to reject setting of a particular form of extended attribute name |
401 |
|
(e.g.: regexps matching user\..* or security\..*), then return - EOPNOTSUPP. |
402 |
|
|
403 |
|
If flags is set to XATTR_CREATE and the extended attribute already exists, |
404 |
|
this should fail with - EEXIST. If flags is set to XATTR_REPLACE |
405 |
|
and the extended attribute doesn't exist, this should fail with - ENOATTR. |
406 |
|
|
407 |
|
XATTR_CREATE and XATTR_REPLACE are provided by this module, but not exported |
408 |
|
by default. To import them: |
409 |
|
|
410 |
|
use Fuse ':xattr'; |
411 |
|
|
412 |
|
or: |
413 |
|
|
414 |
|
use Fuse ':all'; |
415 |
|
|
416 |
|
=head3 getxattr |
417 |
|
|
418 |
|
Arguments: Pathname, extended attribute's name |
419 |
|
Returns an errno, 0 if there was no value, or the extended attribute's value. |
420 |
|
|
421 |
|
Called to get the value of the named extended attribute. |
422 |
|
|
423 |
|
=head3 listxattr |
424 |
|
|
425 |
|
Arguments: Pathname |
426 |
|
Returns a list: 0 or more text strings (the extended attribute names), followed by a numeric errno (usually 0). |
427 |
|
|
428 |
|
=head3 removexattr |
429 |
|
|
430 |
|
Arguments: Pathname, extended attribute's name |
431 |
|
Returns an errno or 0 on success. |
432 |
|
|
433 |
=head1 AUTHOR |
=head1 AUTHOR |
434 |
|
|
435 |
Mark Glines, E<lt>mark@glines.orgE<gt> |
Mark Glines, E<lt>mark@glines.orgE<gt> |