• R/O
  • SSH
  • HTTPS

perl-fuse-fv: Commit


Commit MetaInfo

Revision65 (tree)
Zeit2011-05-29 23:59:18
Autortofjw

Log Message

add some comments.

Ändern Zusammenfassung

Diff

--- Fuse-Class/trunk/lib/Fuse/Class.pm (revision 64)
+++ Fuse-Class/trunk/lib/Fuse/Class.pm (revision 65)
@@ -8,7 +8,6 @@
88
99 use warnings;
1010 use strict;
11-no strict qw(refs);
1211
1312 =head1 NAME
1413
@@ -16,11 +15,11 @@
1615
1716 =head1 VERSION
1817
19-Version 0.01
18+Version 0.02
2019
2120 =cut
2221
23-our $VERSION = '0.01';
22+our $VERSION = '0.02';
2423
2524 =head1 SYNOPSIS
2625
@@ -71,7 +70,7 @@
7170
7271 Nothing.
7372
74-=head1 FUNCTIONS
73+=head1 CONSTRUCTOR
7574
7675 =cut
7776
@@ -81,16 +80,68 @@
8180 # instance calling main
8281 use vars qw($_Module);
8382
83+=head2 new
84+
85+Create a new instance. This method is defined just for your convenience.
86+Default implementation returns blessed empty HASHREF.
87+
88+=cut
89+
90+#
91+# for your convenience.
92+#
93+sub new {
94+ my $class = shift;
95+ bless {}, $class;
96+}
97+
8498 my @callback;
8599
86-=head2 main
100+=head1 METHODS
87101
88-Same as defined in Fuse::main.
102+=cut
89103
104+=head2 main(OPT_KEY1 => OPT_VALUE1, OPT_KEY2 => OPT_VALUE2, ...)
105+
106+Start a main loop. Filesystem is mounted to the mountpoint pointed by
107+option "mountpoint".
108+
109+Options are taken as key=>value pair selected from following:
110+
111+=over
112+
113+=item debug => boolean
114+
115+This option controls tracing on or off. (Default is off).
116+
117+=item mountpoint => "path_to_mountpoint"
118+
119+Directory name to mount filesystem like "/mnt/mypoint".
120+This option has no default value and is mandatory.
121+
122+=item mountopts => "opt1,op2,..."
123+
124+Comma separated options for FUSE kernel module.
125+
126+=item nullpath_ok => boolean
127+
128+If true, empty pathname is passed to the methods like read, write, flush,
129+release, fsync, readdir, releasedir, fsyncdir, ftruncate, fgetattr and lock.
130+
131+To use this option, you must return file/directory handle from
132+open, opendir and create, and you must operate file/directory by
133+that handle insted of pathname.
134+
135+Only effective on Fuse 2.8 or later.
136+
137+=back
138+
139+For more information, see the documentation of Fuse.
140+
90141 =cut
91142
92143 sub main {
93- my $class = shift;
144+ my $self = shift;
94145 my %attr = @_;
95146
96147 my @args;
@@ -98,7 +149,7 @@
98149 push(@args, $opt, $attr{$opt}) if (defined($attr{$opt}));
99150 }
100151
101- local $_Module = $class;
152+ local $_Module = $self;
102153
103154 my %fnmap;
104155 foreach my $fnname (@callback) {
@@ -153,28 +204,26 @@
153204 }
154205 }
155206
207+=head1 METHODS MAY OVERRIDDEN
156208
157-=head2 new
209+=cut
158210
159-Create a new instance.
211+=head2 getattr(PATH_NAME)
160212
161-=cut
213+Returns a list of file attributes. Meaning of fields are same as
214+"stat" function like this:
162215
163-#
164-# for your convenience.
165-#
166-sub new {
167- my $class = shift;
168- bless {}, $class;
169-}
216+ ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
217+ $atime,$mtime,$ctime,$blksize,$blocks)
170218
171-=head2 getattr
219+On error, returns scalar value like 'return -ENOENT();'.
172220
173-Same as Fuse.
221+=head2 readlink(PATH_NAME)
174222
175-=head2 readlink
223+This method is called to dereference symbolic link.
224+Returns a destination path string or numeric error value.
176225
177-Same as Fuse. By Default implementation, returns -ENOENT.
226+By Default implementation, returns -ENOENT.
178227 You can leave this method if your FS does not have symlink.
179228
180229 =cut
@@ -183,8 +232,9 @@
183232 return -Errno::ENOENT();
184233 }
185234
186-=head2 getdir
235+=head2 getdir(DIRECTORY_NAME)
187236
237+
188238 Same as Fuse.
189239
190240 =head2 mknod
@@ -256,6 +306,17 @@
256306 return 0;
257307 }
258308
309+=head2 setxattr
310+
311+Same as Fuse. By default implementation, returns -ENOATTR.
312+You can leave this method if your FS does not have any extended attrs.
313+
314+=cut
315+
316+sub setxattr {
317+ return -Errno::EOPNOTSUPP();
318+}
319+
259320 =head2 getxattr
260321
261322 Same as Fuse. By default implementation, returns 0.
@@ -289,18 +350,22 @@
289350 return 0;
290351 }
291352
292-=head2 setxattr
353+=head2 opendir(DIRECTORY_NAME)
293354
294-Same as Fuse. By default implementation, returns -ENOATTR.
295-You can leave this method if your FS does not have any extended attrs.
355+Returns an errno, and a directory handle (optional)
296356
357+Called when opening a directory for reading. If special handling is
358+required to open a directory, this operation can be implemented to handle
359+that.
360+
361+Supported by Fuse version 2.3 or later.
362+
297363 =cut
298364
299-sub setxattr {
300- return -Errno::EOPNOTSUPP();
301-}
365+# sub opendir {
366+# return -Errno::EOPNOTSUPP();
367+# }
302368
303-
304369 =head1 AUTHOR
305370
306371 Toshimitsu FUJIWARA, C<< <tttfjw at gmail.com> >>
@@ -311,7 +376,7 @@
311376
312377 =head1 COPYRIGHT & LICENSE
313378
314-Copyright 2008 Toshimitsu FUJIWARA, all rights reserved.
379+Copyright 2008-2011 Toshimitsu FUJIWARA, all rights reserved.
315380
316381 This program is free software; you can redistribute it and/or modify it
317382 under the same terms as Perl itself.
Show on old repository browser